/* * Some missing functions that are needed. * * Written by ceder. */ static char *rcsid = "$Id: missing-ansi.c,v 0.3 1991/08/28 02:21:17 ceder Exp $"; #include #include #if defined(__sequent__) && !defined(DEBUG_MALLOC) void * memcpy (void * s1, const void * s2, size_t n) { extern bcopy(const char *b1, char *b2, unsigned int length); /* bcopy takes the parameters the other way round. */ bcopy(s2, s1, n); return s1; /* Since ANSI says so */ } #endif #if defined(__sequent__) || defined(__sun__) extern double difftime(time_t t1, time_t t2) { return (double) t1 - (double) t2; } #endif #ifdef __sequent__ /* * This version in NOT 100 % ANSI-conformant, but it is enough to run LysKOM * (I hope) /ceder */ extern time_t mktime (const struct tm * temeptr ) { int nyears; int nleaps; int ndays; nyears = temeptr->tm_year - 70; nleaps = (nyears+2) / 4; ndays = 365 * nyears + nleaps + temeptr->tm_yday; return (time_t) ( temeptr->tm_sec + 60 * ( temeptr->tm_min + 60 * ( temeptr->tm_hour + 24 * ndays ))); } #endif #if defined(__sequent__) || defined(__sun__) #include #include extern char *sys_errlist[]; extern int sys_nerr; const char *strerror(int eno) { static char buf[200]; if (eno < 0 || eno >= sys_nerr) { sprintf(buf, "error #%d", eno); return buf; } else return sys_errlist[eno]; } #endif