Use _ versions of system-calls

This commit is contained in:
ceriel 1991-02-22 16:57:42 +00:00
parent cf10cabb6f
commit 1118da779b
13 changed files with 43 additions and 44 deletions

View file

@ -88,10 +88,8 @@ extern char **_penvp;
extern char *_hol0(); extern char *_hol0();
extern _trp(); extern _trp();
extern exit(); extern _exit();
extern int open(); extern int _write();
extern int read();
extern int write();
_catch(erno) unsigned erno; { _catch(erno) unsigned erno; {
register struct errm *ep = &errors[0]; register struct errm *ep = &errors[0];
@ -146,10 +144,10 @@ _catch(erno) unsigned erno; {
p = q; p = q;
while (*p) while (*p)
p++; p++;
if (write(2,q,p-q) < 0) if (_write(2,q,p-q) < 0)
; ;
} }
exit(erno); _exit(erno);
error: error:
_trp(erno); _trp(erno);
} }

View file

@ -20,7 +20,7 @@
/* function clock:integer; extern; */ /* function clock:integer; extern; */
extern int times(); extern int _times();
struct tbuf { struct tbuf {
long utime; long utime;
@ -36,7 +36,7 @@ struct tbuf {
int clock() { int clock() {
struct tbuf t; struct tbuf t;
times(&t); _times(&t);
return( (int)(t.utime + t.stime) & return( (int)(t.utime + t.stime) &
#if EM_WSIZE <= 2 #if EM_WSIZE <= 2
077777 077777

View file

@ -25,7 +25,7 @@ extern struct file *_curfil;
extern _trp(); extern _trp();
extern _flush(); extern _flush();
extern _outcpt(); extern _outcpt();
extern int close(); extern int _close();
_xcls(f) struct file *f; { _xcls(f) struct file *f; {
@ -61,7 +61,7 @@ _cls(f) struct file *f; {
return; return;
#endif #endif
_xcls(f); _xcls(f);
if (close(f->ufd) != 0) if (_close(f->ufd) != 0)
_trp(ECLOSE); _trp(ECLOSE);
f->flags = 0; f->flags = 0;
} }

View file

@ -23,7 +23,7 @@
extern struct file **_extfl; extern struct file **_extfl;
extern int _extflc; extern int _extflc;
extern _cls(); extern _cls();
extern exit(); extern _exit();
_hlt(ecode) int ecode; { _hlt(ecode) int ecode; {
int i; int i;
@ -31,5 +31,5 @@ _hlt(ecode) int ecode; {
for (i = 0; i < _extflc; i++) for (i = 0; i < _extflc; i++)
if (_extfl[i] != (struct file *) 0) if (_extfl[i] != (struct file *) 0)
_cls(_extfl[i]); _cls(_extfl[i]);
exit(ecode); _exit(ecode);
} }

View file

@ -25,7 +25,7 @@
extern int errno; extern int errno;
extern _trp(); extern _trp();
extern int read(); extern int _read();
_incpt(f) struct file *f; { _incpt(f) struct file *f; {
@ -40,7 +40,7 @@ _incpt(f) struct file *f; {
if (f->count == 0) { if (f->count == 0) {
f->ptr = f->bufadr; f->ptr = f->bufadr;
for(;;) { for(;;) {
f->count=read(f->ufd,f->bufadr,f->buflen); f->count=_read(f->ufd,f->bufadr,f->buflen);
if ( f->count<0 ) { if ( f->count<0 ) {
if (errno != EINTR) _trp(EREAD) ; if (errno != EINTR) _trp(EREAD) ;
continue ; continue ;

View file

@ -24,7 +24,7 @@
extern (*_sig())(); extern (*_sig())();
extern _catch(); extern _catch();
#ifndef CPM #ifndef CPM
extern int gtty(); extern int _gtty();
#endif #endif
struct file **_extfl; struct file **_extfl;
@ -34,6 +34,7 @@ struct file *_curfil; /* points to file struct in case of errors */
int _pargc; int _pargc;
char **_pargv; char **_pargv;
char **_penvp; char **_penvp;
int _fp_hook = 1; /* This is for Minix, but does not harm others */
_ini(args,c,p,mainlb) char *args,*mainlb; int c; struct file **p; { _ini(args,c,p,mainlb) char *args,*mainlb; int c; struct file **p; {
struct file *f; struct file *f;
@ -65,7 +66,7 @@ _ini(args,c,p,mainlb) char *args,*mainlb; int c; struct file **p; {
#ifdef CPM #ifdef CPM
f->count = 1; f->count = 1;
#else #else
f->count = (gtty(1,buf) >= 0 ? 1 : PC_BUFLEN); f->count = (_gtty(1,buf) >= 0 ? 1 : PC_BUFLEN);
#endif #endif
f->buflen = f->count; f->buflen = f->count;
} }

View file

@ -31,32 +31,32 @@ extern char **_penvp;
extern _cls(); extern _cls();
extern _xcls(); extern _xcls();
extern _trp(); extern _trp();
extern int getpid(); extern int _getpid();
extern int creat(); extern int _creat();
extern int open(); extern int _open();
extern int close(); extern int _close();
extern int unlink(); extern int _unlink();
extern long lseek(); extern long _lseek();
static int tmpfil() { static int tmpfil() {
int i; char *p,*q; int i; char *p,*q;
i = getpid(); i = _getpid();
p = "/usr/tmp/plf.xxxxx"; p = "/usr/tmp/plf.xxxxx";
q = p + 13; q = p + 13;
do do
*q++ = (i & 07) + '0'; *q++ = (i & 07) + '0';
while (i >>= 3); while (i >>= 3);
*q = '\0'; *q = '\0';
if ((i = creat(p,0644)) < 0) if ((i = _creat(p,0644)) < 0)
if ((i = creat(p += 4,0644)) < 0) if ((i = _creat(p += 4,0644)) < 0)
if ((i = creat(p += 5,0644)) < 0) if ((i = _creat(p += 5,0644)) < 0)
goto error; goto error;
if (close(i) != 0) if (_close(i) != 0)
goto error; goto error;
if ((i = open(p,2)) < 0) if ((i = _open(p,2)) < 0)
goto error; goto error;
if (unlink(p) != 0) if (_unlink(p) != 0)
error: _trp(EREWR); error: _trp(EREWR);
return(i); return(i);
} }
@ -76,7 +76,7 @@ static int initfl(descr,sz,f) int descr; int sz; struct file *f; {
f->fname = "LOCAL"; f->fname = "LOCAL";
if ((descr & WRBIT) == 0 && (f->flags & 0377) == MAGIC) { if ((descr & WRBIT) == 0 && (f->flags & 0377) == MAGIC) {
_xcls(f); _xcls(f);
if (lseek(f->ufd,(long)0,0) == -1) if (_lseek(f->ufd,(long)0,0) == -1)
_trp(ERESET); _trp(ERESET);
} else { } else {
_cls(f); _cls(f);
@ -90,10 +90,10 @@ static int initfl(descr,sz,f) int descr; int sz; struct file *f; {
f->fname = _pargv[i]; f->fname = _pargv[i];
_cls(f); _cls(f);
if ((descr & WRBIT) == 0) { if ((descr & WRBIT) == 0) {
if ((f->ufd = open(f->fname,0)) < 0) if ((f->ufd = _open(f->fname,0)) < 0)
_trp(ERESET); _trp(ERESET);
} else { } else {
if ((f->ufd = creat(f->fname,0644)) < 0) if ((f->ufd = _creat(f->fname,0644)) < 0)
_trp(EREWR); _trp(EREWR);
} }
} }

View file

@ -25,7 +25,7 @@
extern int errno; extern int errno;
extern _trp(); extern _trp();
extern int write(); extern int _write();
_flush(f) struct file *f; { _flush(f) struct file *f; {
int i,n; int i,n;
@ -35,7 +35,7 @@ _flush(f) struct file *f; {
if (n <= 0) if (n <= 0)
return; return;
f->count = f->buflen; f->count = f->buflen;
if ((i = write(f->ufd,f->bufadr,n)) < 0 && errno == EINTR) if ((i = _write(f->ufd,f->bufadr,n)) < 0 && errno == EINTR)
return; return;
if (i != n) if (i != n)
_trp(EWRITE); _trp(EWRITE);

View file

@ -23,7 +23,7 @@
extern _cls(); extern _cls();
extern _trp(); extern _trp();
extern int creat(); extern int _creat();
/* procedure pcreat(var f:text; s:string); */ /* procedure pcreat(var f:text; s:string); */
@ -36,6 +36,6 @@ pcreat(f,s) struct file *f; char *s; {
f->size = 1; f->size = 1;
f->count = PC_BUFLEN; f->count = PC_BUFLEN;
f->buflen = PC_BUFLEN; f->buflen = PC_BUFLEN;
if ((f->ufd = creat(s,0644)) < 0) if ((f->ufd = _creat(s,0644)) < 0)
_trp(EREWR); _trp(EREWR);
} }

View file

@ -23,7 +23,7 @@
extern _cls(); extern _cls();
extern _trp(); extern _trp();
extern int open(); extern int _open();
/* procedure popen(var f:text; s:string); */ /* procedure popen(var f:text; s:string); */
@ -36,6 +36,6 @@ popen(f,s) struct file *f; char *s; {
f->size = 1; f->size = 1;
f->count = 0; f->count = 0;
f->buflen = PC_BUFLEN; f->buflen = PC_BUFLEN;
if ((f->ufd = open(s,0)) < 0) if ((f->ufd = _open(s,0)) < 0)
_trp(ERESET); _trp(ERESET);
} }

View file

@ -8,7 +8,7 @@
#include <em_abs.h> #include <em_abs.h>
extern trp(); extern _trp();
struct array_descr { struct array_descr {
int lbound; int lbound;
@ -21,5 +21,5 @@ struct array_descr *descr;
{ {
if( index < descr->lbound || if( index < descr->lbound ||
index > (int) descr->n_elts_min_one + descr->lbound ) index > (int) descr->n_elts_min_one + descr->lbound )
_trp(ERANGE); _trp(EARRAY);
} }

View file

@ -18,8 +18,8 @@
/* function uread(fd:integer; var b:buf; n:integer):integer; */ /* function uread(fd:integer; var b:buf; n:integer):integer; */
extern int read(); extern int _read();
int uread(fd,b,n) char *b; int fd,n; { int uread(fd,b,n) char *b; int fd,n; {
return(read(fd,b,n)); return(_read(fd,b,n));
} }

View file

@ -18,8 +18,8 @@
/* function uwrite(fd:integer; var b:buf; n:integer):integer; */ /* function uwrite(fd:integer; var b:buf; n:integer):integer; */
extern int write(); extern int _write();
int uwrite(fd,b,n) char *b; int fd,n; { int uwrite(fd,b,n) char *b; int fd,n; {
return(write(fd,b,n)); return(_write(fd,b,n));
} }