home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The World of Computer Software
/
World_Of_Computer_Software-02-387-Vol-3of3.iso
/
d
/
dshar116.zip
/
DOSFN.C
< prev
next >
Wrap
C/C++ Source or Header
|
1993-03-08
|
2KB
|
118 lines
/* for old MS-C who lacks _dos_xxxx() */
#include <dos.h>
#include "common.h"
#define NULL 0
static char myDTA[DTASIZE];
static char far *myDTAp = myDTA;
unsigned _dos_getfileattr(s, ap)
char *s;
unsigned *ap;
{
char far *fars = s;
union REGS in, out;
struct SREGS segreg;
in . x . ax = 0x4300;
in . x . dx = (unsigned int)s;
segreg . ds = FP_SEG(fars);
intdosx(&in, &out, &segreg);
return(out . x . cflag ? out . x . ax : ((*ap = out . x . cx), 0));
}
#if 0 /* Not used */
unsigned _dos_setfileattr(s, a)
char *s;
unsigned a;
{
char far *fars = s;
union REGS in, out;
struct SREGS segreg;
in . x . ax = 0x4301;
in . x . cx = a;
in . x . dx = (unsigned int)s;
segreg . ds = FP_SEG(fars);
intdosx(&in, &out, &segreg);
return(out . x . cflag ? out . x . ax : 0);
}
#endif
unsigned _dos_getftime(f, p, q)
int f;
unsigned *p, *q;
{
union REGS in, out;
in . x . ax = 0x5700;
in . x . bx = f;
intdos(&in, &out);
return(out . x . cflag ? out . x . ax :
(*p = out . x . dx, *q = out . x . cx, 0));
}
#if 0 /* Not used */
unsigned _dos_setftime(f, d, t)
int f;
unsigned d, t;
{
union REGS in, out;
in . x . ax = 0x5701;
in . x . bx = f;
in . x . cx = t;
in . x . dx = d;
intdos(&in, &out);
return(out . x . cflag ? out . x . ax : 0);
}
#endif
unsigned _dos_findfirst(s, i, p)
char *s; /* findnext when s == NULL */
unsigned i;
struct find_t *p;
{
char far *fars = s;
union REGS in, out;
struct SREGS segreg;
in . h . ah = 0x1a;
in . x . dx = (unsigned int)myDTA;
segreg . ds = FP_SEG(myDTAp);
intdosx(&in, &out, &segreg);
if(s == NULL){
memcpy(myDTA, (char *)p, sizeof(struct find_t));
in . h . ah = 0x4f;
} else {
in . h . ah = 0x4e;
in . x . cx = i;
in . x . dx = (unsigned int)s;
segreg . ds = FP_SEG(fars);
}
intdosx(&in, &out, &segreg);
return(out . x . cflag ? out . x . ax :
(memcpy((char *)p, myDTA, sizeof(struct find_t)), 0));
}
unsigned _dos_findnext(p)
struct find_t *p;
{
return _dos_findfirst(NULL, 0, p);
}
#ifdef MSC4
isatty(fd) /* MSC4 has buggy isatty() */
register int fd;
{
union REGS in, out;
in . x . ax = 0x4400;
in . x . bx = fd;
intdos(&in, &out);
return(!out . x . cflag && (out . x . ax & 0x80));
}
#endif