summaryrefslogtreecommitdiff
path: root/sys/arch/i386/boot.dos/dossys.c
blob: d62157826fcd2b07a70f3eca8be8265e238a7240 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
#ifdef DOSREAD

#include <sys/param.h>

short doserrno;
short doshandle = -1;
void bcopy(), pcpy();

void _read();

char iobuf[DEV_BSIZE];

char *doserrors[] ={
  /* 00 */ "no error",
         /* 01 */ "function number invalid",
         /* 02 */ "file not found",
         /* 03 */ "path not found",
         /* 04 */ "too many open files (no handles available)",
         /* 05 */ "access denied",
         /* 06 */ "invalid handle",
         /* 07 */ "memory control block destroyed",
         /* 08 */ "insufficient memory",
         /* 09 */ "memory block address invalid",
         /* 0A */ "environment invalid (usually >32K in length)",
         /* 0B */ "format invalid",
         /* 0C */ "access code invalid",
         /* 0D */ "data invalid",
         /* 0E */ "reserved",
         /* 0F */ "invalid drive",
         /* 10 */ "attempted to remove current directory",
         /* 11 */ "not same device",
         /* 12 */ "no more files",
         /* 13 */ "disk write-protected",
         /* 14 */ "unknown unit",
         /* 15 */ "drive not ready",
         /* 16 */ "unknown command",
         /* 17 */ "data error (CRC)",
         /* 18 */ "bad request structure length",
         /* 19 */ "seek error",
         /* 1A */ "unknown media type (non-DOS disk)",
         /* 1B */ "sector not found",
         /* 1C */ "printer out of paper",
         /* 1D */ "write fault",
         /* 1E */ "read fault",
         /* 1F */ "general failure",
         /* 20 */ "sharing violation",
         /* 21 */ "lock violation",
         /* 22 */ "disk change invalid (ES:DI -> media ID structure)(see #0839)",
         /* 23 */ "FCB unavailable",
         /* 24 */ "sharing buffer overflow",
         /* 25 */ "(DOS 4+) code page mismatch",
         /* 26 */ "(DOS 4+) cannot complete file operation (out of input)",
         /* 27 */ "(DOS 4+) insufficient disk space",
         /* 28 */ "Reserved error (0x28)",
         /* 29 */ "Reserved error (0x29)",
         /* 2A */ "Reserved error (0x2A)",
         /* 2B */ "Reserved error (0x2B)",
         /* 2C */ "Reserved error (0x2C)",
         /* 2D */ "Reserved error (0x2D)",
         /* 2E */ "Reserved error (0x2E)",
         /* 2F */ "Reserved error (0x2F)",
         /* 30 */ "Reserved error (0x30)",
         /* 31 */ "Reserved error (0x31)",
         /* 32 */ "network request not supported",
         /* 33 */ "remote computer not listening",
         /* 34 */ "duplicate name on network",
         /* 35 */ "network name not found",
         /* 36 */ "network busy",
         /* 37 */ "network device no longer exists",
         /* 38 */ "network BIOS command limit exceeded",
         /* 39 */ "network adapter hardware error",
         /* 3A */ "incorrect response from network",
         /* 3B */ "unexpected network error",
         /* 3C */ "incompatible remote adapter",
         /* 3D */ "print queue full",
         /* 3E */ "queue not full",
         /* 3F */ "not enough space to print file",
         /* 40 */ "network name was deleted",
         /* 41 */ "network: Access denied",
         /* 42 */ "network device type incorrect",
         /* 43 */ "network name not found",
         /* 44 */ "network name limit exceeded",
         /* 45 */ "network BIOS session limit exceeded",
         /* 46 */ "temporarily paused",
         /* 47 */ "network request not accepted",
         /* 48 */ "network print/disk redirection paused",
         /* 49 */ "network software not installed",
         /* 4A */ "unexpected adapter close",
         /* 4B */ "(LANtastic) password expired",
         /* 4C */ "(LANtastic) login attempt invalid at this time",
         /* 4D */ "(LANtastic v3+) disk limit exceeded on network node",
         /* 4E */ "(LANtastic v3+) not logged in to network node",
         /* 4F */ "reserved",
         /* 50 */ "file exists",
         /* 51 */ "reserved",
         /* 52 */ "cannot make directory",
         /* 53 */ "fail on INT 24h",
         /* 54 */ "(DOS 3.3+) too many redirections",
         /* 55 */ "(DOS 3.3+) duplicate redirection",
         /* 56 */ "(DOS 3.3+) invalid password",
         /* 57 */ "(DOS 3.3+) invalid parameter",
         /* 58 */ "(DOS 3.3+) network write fault",
         /* 59 */ "(DOS 4+) function not supported on network",
         /* 5A */ "(DOS 4+) required system component not installed",
         /* 64 */ "(MSCDEX) unknown error",
         /* 65 */ "(MSCDEX) not ready",
         /* 66 */ "(MSCDEX) EMS memory no longer valid",
         /* 67 */ "(MSCDEX) not High Sierra or ISO-9660 format",
         /* 68 */ "(MSCDEX) door open",
       };


void __dosread(buffer, count, copy)
      char *buffer;
      int count;
      void (*copy)();
{
  int size;
  int cnt2;

  while (count) {
    size=count;

    if (size>DEV_BSIZE)
      size=DEV_BSIZE;

    size=dosread(doshandle,iobuf,size);
    twiddle();
    copy(iobuf , buffer, size);
    buffer += size;
    count -= size;
  }
}

char *printdoserror(char *header)
{
  static char buf[32];
  int max=sizeof(doserrors)/sizeof(doserrors[0]);
  if (doserrno<max && doserrno>=0)
    printf("%s: %s\n",header,doserrors[doserrno]);
  else
    printf("%s: Unknown error %d\n",header,doserrno);
}

doclose()
{
  if (doshandle>=0) {
    if (dosclose(doshandle)<0) {
      printdoserror("Dosclose");
      doshandle = -1;
      return -1;
    }
  }
  return 0;
}

dosopenrd(char *cp)
{
  if (doshandle<0) {
    doshandle=dosopen(cp);
    if (doshandle<0) {
      printdoserror("dosopen");
      return -1;
    }
  }
  return 0;
}

#endif