|
|
1.1 ! root 1: #include "sam.h" ! 2: /* ! 3: * A reasonable interface to the system calls ! 4: */ ! 5: syserror(a) ! 6: char *a; ! 7: { ! 8: extern int errno; ! 9: extern char *sys_errlist[]; ! 10: extern int sys_nerr; ! 11: dprint("%s: ", a); ! 12: error_s(Eio, (errno && errno<sys_nerr)? sys_errlist[errno] : "error 0"); ! 13: } ! 14: Read(f, a, n) ! 15: uchar *a; ! 16: { ! 17: if(read(f, (char *)a, n)!=n) ! 18: syserror("read"); ! 19: return n; ! 20: } ! 21: Write(f, a, n) ! 22: uchar *a; ! 23: { ! 24: int m; ! 25: if((m=write(f, (char *)a, n))!=n) ! 26: syserror("write"); ! 27: return m; ! 28: } ! 29: Lseek(f, n, w) ! 30: long n; ! 31: { ! 32: long lseek(); ! 33: if(lseek(f, n, w)==-1) ! 34: syserror("lseek"); ! 35: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.