diff --git a/lang/cem/libcc.ansi/signal/raise.c b/lang/cem/libcc.ansi/signal/raise.c index f426ab1ab..484764bde 100644 --- a/lang/cem/libcc.ansi/signal/raise.c +++ b/lang/cem/libcc.ansi/signal/raise.c @@ -6,13 +6,13 @@ #include -int kill(int pid, int sig); -int getpid(void); +int _kill(int pid, int sig); +int _getpid(void); int raise(int sig) { if (sig < 0 || sig > _NSIG) return -1; - return kill(getpid(), sig); + return _kill(_getpid(), sig); } diff --git a/lang/cem/libcc.ansi/stdlib/abort.c b/lang/cem/libcc.ansi/stdlib/abort.c index d2fc9d39a..db9dcaebd 100644 --- a/lang/cem/libcc.ansi/stdlib/abort.c +++ b/lang/cem/libcc.ansi/stdlib/abort.c @@ -7,9 +7,12 @@ #include #include +extern void (*_clean)(void); + void abort(void) { + if (_clean) _clean(); /* flush all output files */ raise(SIGABRT); } diff --git a/lang/cem/libcc.ansi/stdlib/exit.c b/lang/cem/libcc.ansi/stdlib/exit.c index fb7f97cb0..353413f05 100644 --- a/lang/cem/libcc.ansi/stdlib/exit.c +++ b/lang/cem/libcc.ansi/stdlib/exit.c @@ -13,8 +13,9 @@ void (*__functab[NEXITS])(void); int __funccnt = 0; extern void _exit(int); -/* only fflush when there is output */ -int (*_fflush)(FILE *stream) = NULL; + +/* only flush output buffers when necessary */ +int (*_clean)(void) = NULL; static void _calls(void) @@ -30,6 +31,6 @@ void exit(int status) { _calls(); - if (_fflush) _fflush((FILE *)NULL) ; + if (_clean) _clean(); _exit(status) ; } diff --git a/lang/cem/libcc.ansi/stdlib/system.c b/lang/cem/libcc.ansi/stdlib/system.c index afe38aa87..09d38cb91 100644 --- a/lang/cem/libcc.ansi/stdlib/system.c +++ b/lang/cem/libcc.ansi/stdlib/system.c @@ -7,11 +7,11 @@ #include #include -extern int fork(void); -extern int wait(int *); +extern int _fork(void); +extern int _wait(int *); extern void _exit(int); -extern void execl(char *, ...); -extern void close(int); +extern void _execl(char *, ...); +extern void _close(int); #define FAIL 127 @@ -21,17 +21,17 @@ system(const char *str) int pid, exitstatus, waitval; int i; - if ((pid = fork()) < 0) return str ? -1 : 0; + if ((pid = _fork()) < 0) return str ? -1 : 0; if (pid == 0) { for (i = 3; i <= 20; i++) - close(i); + _close(i); if (!str) str = "cd ."; /* just testing for a shell */ - execl("/bin/sh", "sh", "-c", str, (char *) NULL); + _execl("/bin/sh", "sh", "-c", str, (char *) NULL); /* get here if execl fails ... */ _exit(FAIL); /* see manual page */ } - while ((waitval = wait(&exitstatus)) != pid) { + while ((waitval = _wait(&exitstatus)) != pid) { if (waitval == -1) break; } if (waitval == -1) {