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
|
/* $Id: dosutil.c,v 1.1.1.1 2000/06/27 01:47:58 amura Exp $ */
/*
* UNIX like functions for MS-DOS.
*
* Coded by Shigeki Yoshida (shige@csk.CO.JP)
*/
/*
* $Log: dosutil.c,v $
* Revision 1.1.1.1 2000/06/27 01:47:58 amura
* import to CVS
*
*/
/* 90.02.11 Created for Ng 1.0 MS-DOS ver. by S.Yoshida */
#include "config.h" /* 90.12.20 by S.Yoshida */
#include <dos.h>
#ifndef __TURBOC__ /* 90.03.23 by A.Shirahashi */
/* 90.03.24 Modified by S.Yoshida
* In old version (Ng 1.1), I used difftime() function to check
* sleeping time. But, it returns double floating point value type,
* and execute file was too big. So I change this function to not
* use difftime(). This new sleep() use syssec() that was in a
* ttyio.c. And move syssec() from ttyio.c to this dosutil.c file.
*/
sleep(sec)
int sec;
{
register int s, ss, se;
se = (ss = syssec()) + sec * 100;
do {
s = syssec();
if (se >= 6000 && s < ss) {
se -= 6000;
}
} while (s < se);
}
#endif /* __TURBOC__ */
/*
* Get system time, and return (second * 100) value.
*/
syssec()
{
union REGS regs;
regs.h.ah = 0x2c;
intdos(®s, ®s);
return(regs.h.dh * 100 + regs.h.dl);
}
#ifdef REGEX
bcmp(s1, s2, len)
register char *s1;
register char *s2;
register int len;
{
while (len--) {
if (*s1++ != *s2++) {
return(1);
}
}
return(0);
}
bzero(s, len)
register char *s;
register int len;
{
while (len--) {
*s++ = 0;
}
}
#endif /* REGEX */
|