#ifndef lint static char *rcsid = "$Header: /tmp_mnt/vida/disks/disk5/Users/terry/r/gassy/RCS/syscalls.c,v 1.5 1992/08/09 22:07:40 terry Exp terry $"; #endif #include "types.h" #include #include #ifndef NeXT #include #endif #include #include extern int fclose(); extern int fflush(); extern int unlink(); extern void error(); extern char *sys_errlist[]; extern int sys_nerr; extern int errno; extern long total_allocked; #define WHY errno >= sys_nerr ? "Reason unknown" : sys_errlist[errno] STRING Malloc(n) INT n; { char *s; if (!(s = malloc(n))){ error("could not malloc %d chars. (%s)", n, WHY); } total_allocked += (long)n; return (STRING) s; } FILE * Fopen(file, mode) STRING file; STRING mode; { FILE *fp, *fopen(); if (!(fp = fopen(file, mode))){ error("could not open '%s' with mode '%s'. (%s)", file, mode, WHY); } return fp; } VOID Fflush(fp) FILE *fp; { if (fflush(fp) == EOF){ error("could not fflush. (%s)", WHY); } return; } VOID Unlink(f) STRING f; { if (unlink(f) == -1){ error("could not unlink. (%s)", WHY); } return; } VOID Fclose(fp) FILE *fp; { if (fclose(fp) == EOF){ error("could not fclose. (%s)", WHY); } return; }