* added compilers lcc and bcc (linux86)
[mascara-docs.git] / compilers / linux86-0.16.17 / libc / msdos / mslib.c
blob90e23ef8cc4c2d590f19039b66d561d241cccbff
1 /* Copyright (C) 1998 Robert de Bath <rdebath@cix.compulink.co.uk>
2 * This file is part of the Linux-8086 C library and is distributed
3 * under the GNU Library General Public License.
4 */
6 #if !__FIRST_ARG_IN_AX__
7 #ifdef __AS386_16__
8 #ifdef __MSDOS__
10 #include <dos.h>
11 #include <fcntl.h>
12 #include <errno.h>
13 int errno;
15 #ifdef L_dos_chdir
16 chdir(path)
17 char * path;
19 #asm
20 mov bx,sp
21 mov bx,_chdir.path[bx]
22 cmp [bx+1],':
23 jnz do_chdir
24 mov dl,[bx]
25 and dl,#$3F
26 dec dl
27 mov ah,#$0E
28 int $21
29 do_chdir:
30 mov ah,#$3B
31 mov dx,bx
32 do_dxop:
33 int $21
34 jnc op_ok
35 br exterror
36 op_ok:
37 xor ax,ax
38 #endasm
40 #endif
42 #ifdef L_mkdir
43 mkdir(path)
44 char * path;
46 #asm
47 mov bx,sp
48 mov dx,_mkdir.path[bx]
49 mov ah,#$39
50 j do_dxop
51 #endasm
53 #endif
55 #ifdef L_rmdir
56 rmdir(path)
57 char * path;
59 #asm
60 mov bx,sp
61 mov dx,_rmdir.path[bx]
62 mov ah,#$3A
63 j do_dxop
64 #endasm
66 #endif
68 #ifdef L_unlink
69 unlink(path)
70 char * path;
72 #asm
73 mov bx,sp
74 mov dx,_unlink.path[bx]
75 mov ah,#$41
76 xor cx,cx ! Attrib 0 for servers.
77 j do_dxop
78 #endasm
80 #endif
82 /*************************************************************************
83 TO TEST ...
86 #ifdef L_sleep
87 sleep(secs)
88 unsigned secs;
90 int counter = 0;
91 int es = __get_es();
93 __set_es(0x40);
95 while(secs>0)
97 int c = __peek_es(0x6C);
98 while( c == __peek_es(0x6C) ) ;
100 counter += 549;
101 if( counter > 10000 )
103 secs--;
104 counter -= 10000;
107 /* Interrupt on ctrl-break */
108 if( __peek_es(0x71) & 0x80 ) break;
110 __set_es(es);
112 return secs;
114 #endif
116 /*************************************************************************
117 TODO ...
120 #ifdef L_dos_access
121 access(filename, amode)
122 char * filename;
123 int amode;
125 XXX;
127 #endif
129 #ifdef L__dos_allocmem
130 _dos_allocmem(size ...)
134 #endif
136 #ifdef L__chmod
137 _chmod(path, func, attrib)
138 char * path;
139 int func, attrib;
141 XXX;
143 #endif
145 #ifdef L_chmod
146 chmod(path, mode)
147 char * path;
148 int mode;
150 XXX;
152 #endif
154 #ifdef L_clock
155 clock_t clock()
157 XXX;
159 #endif
161 #ifdef L_ctrlbrk
162 ctrlbrk(func)
163 int (*func)();
165 XXX;
167 #endif
169 #ifdef L_delay
170 delay(millis)
171 unsigned millis;
173 XXX;
175 #endif
177 #ifdef L_dosexterr
178 dosexterr(ptr)
179 struct DOSERROR * ptr;
181 XXX;
183 #endif
186 #ifdef __dos_getdiskfree
189 #ifdef L_dup
190 dup(fd)
191 int fd;
193 XXX;
195 #endif
197 #ifdef L_dup2
198 dup2(ofd, nfd)
199 int ofd, nfd;
201 XXX;
203 #endif
205 #ifdef L_filelength
206 long
207 filelength(fd)
208 int fd;
210 XXX;
212 #endif
214 #ifdef L_findfirst
215 findfirst(path, fcb, attrib)
216 char * path;
217 void * fcb;
218 int attrib;
220 XXX;
222 #endif
224 #ifdef L_findnext
225 findnext(fcb)
226 void * fcb;
228 XXX;
230 #endif
232 #ifdef L_stat
233 stat(path, st)
234 char * path;
235 struct stat * st;
237 XXX;
239 #endif
241 #ifdef L_fstat
242 fstat(fd, st)
243 int fd;
244 struct stat * st;
246 XXX;
248 #endif
250 #ifdef L_getcbrk
251 getcbrk()
253 XXX int 0x21/33;
255 #endif
257 #ifdef L_setcbrk
258 setcbrk(mode)
259 int mode;
261 XXX int 0x21/33;
263 #endif
265 #ifdef L_getcwd
266 getcwd(buf, buflen)
267 char * buf;
268 int buflen;
270 XXX;
272 #endif
274 #ifdef L__getdrive
275 _getdrive()
277 XXX;
279 #endif
281 #ifdef L_getenv
282 char *
283 getenv(varname)
284 char * varname;
286 XXX;
288 #endif
290 #ifdef L_putenv
291 putenv(varname)
292 char * varname;
294 XXX;
296 #endif
298 #ifdef L_getpid
299 getpid()
301 XXX;
303 #endif
305 #ifdef L_rename
306 rename(oldname, newpath)
307 char *oldpath, *newpath;
309 XXX;
311 #endif
313 #ifdef L_setmode
314 setmode(fd, amode)
315 int fd, amode;
317 XXX;
319 #endif
322 #ifdef L_system
323 system(cmd)
324 char * cmd;
326 XXX;
328 #endif
330 #ifdef L_umask
331 umask(mode)
332 int mode;
334 XXX;
336 * save umask value for open() use it for read-only bit.
339 #endif
341 #ifdef L_utime
342 utime(path, times)
343 char * path;
344 stuct utimbuf * times;
346 XXX;
348 #endif
350 #endif /* __MSDOS__ */
351 #endif /* __AS386_16__ */
352 #endif /* !__FIRST_ARG_IN_AX__ */