From 28fb5f0f30b785f0b7d5ae7ad53b472c19fb25e8 Mon Sep 17 00:00:00 2001 From: sam Date: Thu, 4 Sep 2003 13:29:16 +0000 Subject: [PATCH] * Fucking K&R syntax! git-svn-id: svn://svn.zoy.org/elk/trunk@89 55e467fa-43c5-0310-a8a2-de718669efc6 --- lib/unix/error.c | 4 ++-- lib/unix/fdescr.c | 28 +++++++++++++++------------- lib/unix/file.c | 36 +++++++++++++++++++----------------- lib/unix/lock.c | 6 +++--- lib/unix/misc.c | 6 ++++-- lib/unix/passwd.c | 7 ++++--- lib/unix/process.c | 35 +++++++++++++++++++---------------- lib/unix/signal.c | 16 ++++++++-------- lib/unix/system.c | 8 +++++--- lib/unix/temp.c | 6 ++++-- lib/unix/time.c | 12 +++++++----- lib/unix/unix.c | 8 ++++---- lib/unix/wait.c | 10 ++++++---- 13 files changed, 100 insertions(+), 82 deletions(-) diff --git a/lib/unix/error.c b/lib/unix/error.c index 04cee20..a9d6d14 100644 --- a/lib/unix/error.c +++ b/lib/unix/error.c @@ -94,7 +94,7 @@ static SYMDESCR Errno_Syms[] = { Object Unix_Errobj, V_Call_Errhandler; -static Object P_Errorp(x) Object x; { +static Object P_Errorp(Object x) { return EQ(x, Unix_Errobj) ? True : False; } @@ -105,7 +105,7 @@ static Object P_Errno() { return Nullp(sym) ? Make_Integer(Saved_Errno) : sym; } -elk_init_unix_error() { +void elk_init_unix_error() { Unix_Errobj = Intern("*unix-error-object*"); Unix_Errobj = Const_Cons(Unix_Errobj, Null); Global_GC_Link(Unix_Errobj); diff --git a/lib/unix/fdescr.c b/lib/unix/fdescr.c index 9289e4f..36f9929 100644 --- a/lib/unix/fdescr.c +++ b/lib/unix/fdescr.c @@ -30,6 +30,8 @@ #include "unix.h" +#include + static SYMDESCR Open_Syms[] = { { "read", 1 }, { "write", 2 }, @@ -82,13 +84,13 @@ SYMDESCR Lseek_Syms[] = { /* Dangerous: may be used to close the filedescriptor of a port. */ -static Object P_Close(fd) Object fd; { +static Object P_Close(Object fd) { if (close(Get_Integer(fd)) == -1) Raise_System_Error("~E"); return Void; } -static Object P_Close_On_Exec(argc, argv) int argc; Object *argv; { +static Object P_Close_On_Exec(int argc, Object *argv) { int flags, fd; fd = Get_Integer(argv[0]); @@ -102,7 +104,7 @@ static Object P_Close_On_Exec(argc, argv) int argc; Object *argv; { return flags & 1 ? True : False; } -static Object P_Dup(argc, argv) int argc; Object *argv; { +static Object P_Dup(int argc, Object *argv) { int fd = Get_Integer(argv[0]), ret; if ((ret = (argc == 1 ? dup(fd) : dup2(fd, Get_Integer(argv[1])))) == -1) @@ -110,7 +112,7 @@ static Object P_Dup(argc, argv) int argc; Object *argv; { return Make_Integer(ret); } -static Object P_Filedescriptor_Flags(argc, argv) int argc; Object *argv; { +static Object P_Filedescriptor_Flags(int argc, Object *argv) { int flags, fd; fd = Get_Integer(argv[0]); @@ -123,7 +125,7 @@ static Object P_Filedescriptor_Flags(argc, argv) int argc; Object *argv; { return Bits_To_Symbols((unsigned long)flags, 1, Fcntl_Flags); } -static Object P_Fildescriptor_Port(fd, mode) Object fd, mode; { +static Object P_Fildescriptor_Port(Object fd, Object mode) { int n, flags; FILE *fp; Object ret; @@ -153,7 +155,7 @@ static Object P_Fildescriptor_Port(fd, mode) Object fd, mode; { return ret; } -static Object P_Isatty(fd) Object fd; { +static Object P_Isatty(Object fd) { return isatty(Get_Integer(fd)) ? True : False; } @@ -167,7 +169,7 @@ static Object P_List_Open_Modes() { /* Bad assumption: off_t fits into an unsigned int. */ -static Object P_Lseek(fd, off, whence) Object fd, off, whence; { +static Object P_Lseek(Object fd, Object off, Object whence) { off_t ret; if ((ret = lseek(Get_Integer(fd), (off_t)Get_Long(off), @@ -201,7 +203,7 @@ static Object P_Num_Filedescriptors() { return Make_Integer(Num_Filedescriptors()); } -static Object P_Open(argc, argv) int argc; Object *argv; { +static Object P_Open(int argc, Object *argv) { Object fn; int mode, n; @@ -226,14 +228,14 @@ static Object P_Pipe() { return Integer_Pair(fd[0], fd[1]); } -static Object P_Port_Filedescriptor(port) Object port; { +static Object P_Port_Filedescriptor(Object port) { Check_Type(port, T_Port); if ((PORT(port)->flags & (P_STRING|P_OPEN)) != P_OPEN) Primitive_Error("~s: invalid port", port); return Make_Integer(fileno(PORT(port)->file)); } -static Object Read_Write(argc, argv, readflg) int argc; Object *argv; { +static Object Read_Write(int argc, Object *argv, int readflg) { struct S_String *sp; int len, fd; @@ -255,15 +257,15 @@ static Object Read_Write(argc, argv, readflg) int argc; Object *argv; { /* Avoid name clash with P_Read/P_Write of interpreter kernel */ -static Object P_Readx(argc, argv) int argc; Object *argv; { +static Object P_Readx(int argc, Object *argv) { return Read_Write(argc, argv, 1); } -static Object P_Writex(argc, argv) int argc; Object *argv; { +static Object P_Writex(int argc, Object *argv) { return Read_Write(argc, argv, 0); } -static Object P_Ttyname(fd) Object fd; { +static Object P_Ttyname(Object fd) { char *ret; extern char *ttyname(); diff --git a/lib/unix/file.c b/lib/unix/file.c index b9c718d..91d76f5 100644 --- a/lib/unix/file.c +++ b/lib/unix/file.c @@ -30,6 +30,8 @@ #include "unix.h" +#include + #ifdef HAVE_UTIME_H # include #else @@ -55,7 +57,7 @@ static SYMDESCR Access_Syms[] = { { 0, 0 } }; -static Object P_Accessp(fn, mode) Object fn, mode; { +static Object P_Accessp(Object fn, Object mode) { if (access(Get_Strsym(fn), (int)Symbols_To_Bits(mode, 1, Access_Syms)) == 0) return True; @@ -63,37 +65,37 @@ static Object P_Accessp(fn, mode) Object fn, mode; { return False; } -static Object P_Chdir(fn) Object fn; { +static Object P_Chdir(Object fn) { if (chdir(Get_Strsym(fn)) == -1) Raise_System_Error1("~s: ~E", fn); return Void; } -static Object P_Chmod(fn, mode) Object fn, mode; { +static Object P_Chmod(Object fn, Object mode) { if (chmod(Get_Strsym(fn), Get_Integer(mode)) == -1) Raise_System_Error1("~s: ~E", fn); return Void; } -static Object P_Chown(fn, uid, gid) Object fn, uid, gid; { +static Object P_Chown(Object fn, Object uid, Object gid) { if (chown(Get_Strsym(fn), Get_Integer(uid), Get_Integer(gid)) == -1) Raise_System_Error1("~s: ~E", fn); return Void; } -static Object P_Link(fn1, fn2) Object fn1, fn2; { +static Object P_Link(Object fn1, Object fn2) { if (link(Get_Strsym(fn1), Get_Strsym(fn2)) == -1) Raise_System_Error2("(~s ~s): ~E", fn1, fn2); return Void; } -static Object P_Mkdir(fn, mode) Object fn, mode; { +static Object P_Mkdir(Object fn, Object mode) { if (mkdir(Get_Strsym(fn), Get_Integer(mode)) == -1) Raise_System_Error1("~s: ~E", fn); return Void; } -static Object P_Read_Directory(fn) Object fn; { +static Object P_Read_Directory(Object fn) { DIR *d; #ifdef HAVE_DIRENT struct dirent *dp; @@ -125,7 +127,7 @@ static Object P_Read_Directory(fn) Object fn; { return ret; } -static Object P_Rename(fromfn, tofn) Object fromfn, tofn; { +static Object P_Rename(Object fromfn, Object tofn) { #ifdef HAVE_RENAME if (rename(Get_Strsym(fromfn), Get_Strsym(tofn)) == -1) Raise_System_Error2("(~s ~s): ~E", fromfn, tofn); @@ -149,7 +151,7 @@ static Object P_Rename(fromfn, tofn) Object fromfn, tofn; { return Void; } -static Object General_Stat(obj, ret, l) Object obj, ret; int l; { +static Object General_Stat(Object obj, Object ret, int l) { Object x; struct stat st; char *s, *fn = 0; @@ -212,16 +214,16 @@ static Object General_Stat(obj, ret, l) Object obj, ret; int l; { return Void; } -static Object P_Stat(obj, ret) Object obj, ret; { +static Object P_Stat(Object obj, Object ret) { return General_Stat(obj, ret, 0); } #ifdef SYMLINKS -static Object P_Lstat(obj, ret) Object obj, ret; { +static Object P_Lstat(Object obj, Object ret) { return General_Stat(obj, ret, 1); } -static Object P_Readlink(fn) Object fn; { +static Object P_Readlink(Object fn) { char *buf; int len; Object ret; @@ -238,26 +240,26 @@ static Object P_Readlink(fn) Object fn; { return ret; } -static Object P_Rmdir(fn) Object fn; { +static Object P_Rmdir(Object fn) { if (rmdir(Get_Strsym(fn)) == -1) Raise_System_Error1("~s: ~E", fn); return Void; } -static Object P_Symlink(fn1, fn2) Object fn1, fn2; { +static Object P_Symlink(Object fn1, Object fn2) { if (symlink(Get_Strsym(fn1), Get_Strsym(fn2)) == -1) Raise_System_Error2("(~s ~s): ~E", fn1, fn2); return Void; } #endif -static Object P_Unlink(fn) Object fn; { +static Object P_Unlink(Object fn) { if (unlink(Get_Strsym(fn)) == -1) Raise_System_Error1("~s: ~E", fn); return Void; } -static Object P_Utime(argc, argv) int argc; Object *argv; { +static Object P_Utime(int argc, Object *argv) { struct utimbuf ut; if (argc == 2) @@ -272,7 +274,7 @@ static Object P_Utime(argc, argv) int argc; Object *argv; { return Void; } -elk_init_unix_file() { +void elk_init_unix_file() { Def_Prim(P_Accessp, "unix-access?", 2, 2, EVAL); Def_Prim(P_Chdir, "unix-chdir", 1, 1, EVAL); Def_Prim(P_Chmod, "unix-chmod", 2, 2, EVAL); diff --git a/lib/unix/lock.c b/lib/unix/lock.c index f2168df..75b3754 100644 --- a/lib/unix/lock.c +++ b/lib/unix/lock.c @@ -43,8 +43,8 @@ #ifdef LOCKS -static Object P_Internal_Lock_Operation(fd, lck, block, what, ret) - Object fd, lck, block, what, ret; { +static Object P_Internal_Lock_Operation(Object fd, Object lck, Object block, + Object what, Object ret) { #ifdef RECORD_LOCKS struct flock fl; #else @@ -108,7 +108,7 @@ static Object P_Internal_Lock_Operation(fd, lck, block, what, ret) #endif -elk_init_unix_lock() { +void elk_init_unix_lock() { #ifdef LOCKS Def_Prim(P_Internal_Lock_Operation, "unix-internal-lock-operation", 5, 5, EVAL); diff --git a/lib/unix/misc.c b/lib/unix/misc.c index b37fcfe..af43e26 100644 --- a/lib/unix/misc.c +++ b/lib/unix/misc.c @@ -30,7 +30,9 @@ #include "unix.h" -static Object P_Getpass(prompt) Object prompt; { +#include + +static Object P_Getpass(Object prompt) { char *ret; extern char *getpass(); @@ -42,6 +44,6 @@ static Object P_Getpass(prompt) Object prompt; { return Make_String(ret, strlen(ret)); } -elk_init_unix_misc() { +void elk_init_unix_misc() { Def_Prim(P_Getpass, "unix-getpass", 1, 1, EVAL); } diff --git a/lib/unix/passwd.c b/lib/unix/passwd.c index 64f06d2..6b1a251 100644 --- a/lib/unix/passwd.c +++ b/lib/unix/passwd.c @@ -30,10 +30,11 @@ #include "unix.h" +#include #include #include -static Object P_Get_Passwd(argc, argv) int argc; Object *argv; { +static Object P_Get_Passwd(int argc, Object *argv) { struct passwd *p; Object arg, x; @@ -93,7 +94,7 @@ static Object P_End_Passwd() { return Void; } -static Object P_Get_Group(argc, argv) int argc; Object *argv; { +static Object P_Get_Group(int argc, Object *argv) { char **pp; struct group *p; Object arg, member, x; @@ -156,7 +157,7 @@ static Object P_End_Group() { return Void; } -elk_init_unix_passwd() { +void elk_init_unix_passwd() { Def_Prim(P_Get_Passwd, "unix-get-passwd-vector-fill!", 1, 2, VARARGS); Def_Prim(P_Rewind_Passwd, "unix-rewind-passwd", 0, 0, EVAL); Def_Prim(P_End_Passwd, "unix-end-passwd", 0, 0, EVAL); diff --git a/lib/unix/process.c b/lib/unix/process.c index 97fe1c7..64025b6 100644 --- a/lib/unix/process.c +++ b/lib/unix/process.c @@ -30,6 +30,8 @@ #include "unix.h" +#include +#include #include /* "extern" in front of the next declaration causes the Ultrix 4.2 linker @@ -48,7 +50,8 @@ static Object P_Environ() { GC_Link2(ret, cell); for (ep = environ; *ep; ep++) { cell = Cons(Null, Null); - if (p = index(*ep, '=')) + p = index(*ep, '='); + if (p) *p++ = 0; else p = c+1; str = Make_String(p, strlen(p)); @@ -116,11 +119,11 @@ static Object General_Exec(argc, argv, path) int argc; Object *argv; Raise_System_Error1("~s: ~E", fn); } -static Object P_Exec(argc, argv) int argc; Object *argv; { +static Object P_Exec(int argc, Object *argv) { return General_Exec(argc, argv, 0); } -static Object P_Exec_Path(argc, argv) int argc; Object *argv; { +static Object P_Exec_Path(int argc, Object *argv) { if (argc == 3) /* There is no execvpe (yet?). */ Primitive_Error("environment argument not supported"); return General_Exec(argc, argv, 1); @@ -138,7 +141,7 @@ static Object P_Fork() { return Make_Integer(pid); } -static Object P_Getenv(e) Object e; { +static Object P_Getenv(Object e) { extern char *getenv(); char *s; @@ -195,7 +198,7 @@ static Object P_Getgroups() { return ret; } -static Object P_Nice(incr) Object incr; { +static Object P_Nice(Object incr) { int ret; errno = 0; @@ -204,10 +207,9 @@ static Object P_Nice(incr) Object incr; { return Make_Integer(ret); } -static Object Open_Pipe(cmd, flags) Object cmd; int flags; { +static Object Open_Pipe(Object cmd, int flags) { FILE *fp; Object ret; - extern pclose(); Disable_Interrupts; if ((fp = popen(Get_String(cmd), flags == P_INPUT ? "r" : "w")) == 0) { @@ -221,16 +223,16 @@ static Object Open_Pipe(cmd, flags) Object cmd; int flags; { return ret; } -static Object P_Open_Input_Pipe(cmd) Object cmd; { +static Object P_Open_Input_Pipe(Object cmd) { return Open_Pipe(cmd, P_INPUT); } -static Object P_Open_Output_Pipe(cmd) Object cmd; { +static Object P_Open_Output_Pipe(Object cmd) { return Open_Pipe(cmd, 0); } -static Object P_Process_Resources(ret1, ret2) Object ret1, ret2; { - static hzval; +static Object P_Process_Resources(Object ret1, Object ret2) { + static int hzval; struct tms tms; Object x; GC_Node2; @@ -266,12 +268,12 @@ static Object P_Process_Resources(ret1, ret2) Object ret1, ret2; { return Make_Integer(hzval); } -static Object P_Sleep(s) Object s; { +static Object P_Sleep(Object s) { (void)sleep(Get_Unsigned(s)); return Void; } -static Object P_System(cmd) Object cmd; { +static Object P_System(Object cmd) { int n, pid, status; char *s = Get_String(cmd); @@ -297,12 +299,13 @@ static Object P_System(cmd) Object cmd; { if (n == -1) return False; */ - if (n = (status & 0377)) + n = status & 0377; + if (n) return Cons(Make_Integer(n), Null); return Make_Integer((status >> 8) & 0377); } -static Object P_Umask(mask) Object mask; { +static Object P_Umask(Object mask) { return Make_Integer(umask(Get_Integer(mask))); } @@ -351,7 +354,7 @@ err: return ret; } -elk_init_unix_process() { +void elk_init_unix_process() { Def_Prim(P_Environ, "unix-environ", 0, 0, EVAL); Def_Prim(P_Exec, "unix-exec", 2, 3, VARARGS); Def_Prim(P_Exec_Path, "unix-exec-path", 2, 3, VARARGS); diff --git a/lib/unix/signal.c b/lib/unix/signal.c index de6b186..b041bc8 100644 --- a/lib/unix/signal.c +++ b/lib/unix/signal.c @@ -178,7 +178,7 @@ static SYMDESCR Signal_Syms[] = { { 0, 0 } }; -static Object P_Kill(pid, sig) Object pid, sig; { +static Object P_Kill(Object pid, Object sig) { int t, s; if ((t = TYPE(sig)) == T_Fixnum || t == T_Bignum) @@ -209,12 +209,12 @@ static Object P_Pause() { static Object Handlers; -static Object P_Alarm(s) Object s; { +static Object P_Alarm(Object s) { return Make_Unsigned(alarm(Get_Unsigned(s))); } /*ARGSUSED*/ -void General_Handler(sig) int sig; { +void General_Handler(int sig) { Object fun, args; #ifndef BSD_SIGNALS @@ -233,7 +233,7 @@ void General_Handler(sig) int sig; { /*NOTREACHED*/ } -static Object Action_To_Sym(act) void (*act)(); { +static Object Action_To_Sym(void (*act)()) { char *sym; if (act == Signal_Exit) @@ -247,7 +247,7 @@ static Object Action_To_Sym(act) void (*act)(); { return Intern(sym); } -void Add_To_Mask(sig) int sig; { +void Add_To_Mask(int sig) { #ifdef POSIX_SIGNALS sigaddset(&Sigset_Block, sig); #else @@ -257,7 +257,7 @@ void Add_To_Mask(sig) int sig; { Force_Disable_Interrupts; } -void Remove_From_Mask(sig) int sig; { +void Remove_From_Mask(int sig) { #ifdef POSIX_SIGNALS sigdelset(&Sigset_Block, sig); #else @@ -265,7 +265,7 @@ void Remove_From_Mask(sig) int sig; { #endif } -static Object P_Signal(argc, argv) int argc; Object *argv; { +static Object P_Signal(int argc, Object *argv) { int sig; Object handler, old; void (*disp)(); @@ -321,7 +321,7 @@ static Object P_Signal(argc, argv) int argc; Object *argv; { } #endif /* RELIABLE_SIGNALS */ -elk_init_unix_signal() { +void elk_init_unix_signal() { Define_Symbol(&Sym_Exit, "exit"); Define_Symbol(&Sym_Default, "default"); Define_Symbol(&Sym_Ignore, "ignore"); diff --git a/lib/unix/system.c b/lib/unix/system.c index 385d1f5..d4157b0 100644 --- a/lib/unix/system.c +++ b/lib/unix/system.c @@ -30,6 +30,8 @@ #include "unix.h" +#include + #if defined(HAVE_UNAME) && !defined(HAVE_GETHOSTNAME) # include #endif @@ -49,7 +51,7 @@ static SYMDESCR Limit_Syms[] = { { 0, 0 } }; -static Object P_File_Limit(lim, f) Object lim, f; { +static Object P_File_Limit(Object lim, Object f) { int op, fd; long ret; char *fn = 0; @@ -163,7 +165,7 @@ static Object P_Job_Controlp() { #endif } -static Object P_System_Info(ret) Object ret; { +static Object P_System_Info(Object ret) { #ifdef HAVE_GETHOSTNAME char hostname[MAXHOSTNAMELEN]; char *p = hostname; @@ -198,7 +200,7 @@ static Object P_System_Info(ret) Object ret; { return Void; } -elk_init_unix_system() { +void elk_init_unix_system() { Def_Prim(P_File_Limit, "unix-file-limit", 2, 2, EVAL); Def_Prim(P_List_File_Limits, "unix-list-file-limits", 0, 0, EVAL); Def_Prim(P_Job_Controlp, "unix-job-control?", 0, 0, EVAL); diff --git a/lib/unix/temp.c b/lib/unix/temp.c index d9c7351..ad8710e 100644 --- a/lib/unix/temp.c +++ b/lib/unix/temp.c @@ -30,6 +30,8 @@ #include "unix.h" +#include + #ifdef HAVE_TEMPNAM /* Make sure only one of these is defined (if any) */ # undef HAVE_TMPNAM /* Order of preference: tempnam, mktemp, tmpnam */ # undef HAVE_MKTEMP @@ -43,7 +45,7 @@ # undef HAVE_MKTEMP #endif -static Object P_Tempname(argc, argv) int argc; Object *argv; { +static Object P_Tempname(int argc, Object *argv) { char *name, *dir = 0, *pref = 0; Object ret; #ifdef HAVE_TMPNAM @@ -117,6 +119,6 @@ fail: ; return ret; } -elk_init_unix_temp() { +void elk_init_unix_temp() { Def_Prim(P_Tempname, "unix-tempname", 0, 2, VARARGS); } diff --git a/lib/unix/time.c b/lib/unix/time.c index 5d1a264..c37203a 100644 --- a/lib/unix/time.c +++ b/lib/unix/time.c @@ -30,6 +30,8 @@ #include "unix.h" +#include + #if !defined(HAVE_GETTIMEOFDAY) && defined(HAVE_FTIME) # include #endif @@ -40,7 +42,7 @@ extern time_t time(); -static Object P_Decode_Time(t, ret, utc) Object t, ret, utc; { +static Object P_Decode_Time(Object t, Object ret, Object utc) { time_t tt; struct tm *tp; Object *op; @@ -62,7 +64,7 @@ static Object P_Decode_Time(t, ret, utc) Object t, ret, utc; { return Void; } -static Object P_Nanotime(ret) Object ret; { +static Object P_Nanotime(Object ret) { Object x, y; #ifdef HAVE_GETTIMEOFDAY struct timeval tv; @@ -114,7 +116,7 @@ static Object P_Time() { return Make_Unsigned_Long((unsigned long)t); } -static struct tm *Get_Tm(v) Object v; { +static struct tm *Get_Tm(Object v) { static struct tm tm; int i, n; Object *op; @@ -146,7 +148,7 @@ static struct tm *Get_Tm(v) Object v; { return &tm; } -static Object P_Time_To_String(t) Object t; { +static Object P_Time_To_String(Object t) { time_t tt; char *ret; @@ -165,7 +167,7 @@ static Object P_Time_To_String(t) Object t; { return Make_String(ret, strlen(ret)); } -elk_init_unix_time() { +void elk_init_unix_time() { Def_Prim(P_Time, "unix-time", 0, 0, EVAL); Def_Prim(P_Decode_Time, "unix-decode-time-vector-fill!", 3, 3, EVAL); Def_Prim(P_Time_To_String, "unix-time->string-internal", 1, 1, EVAL); diff --git a/lib/unix/unix.c b/lib/unix/unix.c index e73eaa8..d34169e 100644 --- a/lib/unix/unix.c +++ b/lib/unix/unix.c @@ -30,7 +30,7 @@ #include "unix.h" -Object Integer_Pair(a, b) int a, b; { +Object Integer_Pair(int a, int b) { Object x, y; GC_Node2; @@ -43,7 +43,7 @@ Object Integer_Pair(a, b) int a, b; { return x; } -Object Syms_To_List(p) SYMDESCR *p; { +Object Syms_To_List(SYMDESCR *p) { Object ret, mode; GC_Node; @@ -57,12 +57,12 @@ Object Syms_To_List(p) SYMDESCR *p; { return P_Reverse(ret); } -void Check_Result_Vector(x, len) Object x; { +void Check_Result_Vector(Object x, int len) { Check_Type(x, T_Vector); if (VECTOR(x)->size != len) Primitive_Error("argument vector has the wrong length"); } -elk_init_unix_unix() { +void elk_init_unix_unix() { P_Provide(Intern("unix.so")); } diff --git a/lib/unix/wait.c b/lib/unix/wait.c index e75e38d..c04c2c0 100644 --- a/lib/unix/wait.c +++ b/lib/unix/wait.c @@ -34,6 +34,8 @@ #include "unix.h" +#include + #if defined(HAVE_WAITPID) || defined(HAVE_WAIT4) # define WAIT_PROCESS #endif @@ -110,7 +112,7 @@ static Object General_Wait(ret, ruret, haspid, pid, options) status = "none"; st = code = 0; #ifdef WAIT_RUSAGE - bzero((char *)&ru, sizeof(ru)); + memset((char *)&ru, 0, sizeof(ru)); #endif } else if (WIFSTOPPED(st)) { status = "stopped"; code = WSTOPSIG(st); @@ -138,7 +140,7 @@ static Object General_Wait(ret, ruret, haspid, pid, options) return Void; } -static Object P_Wait(argc, argv) int argc; Object *argv; { +static Object P_Wait(int argc, Object *argv) { int flags = 0; if (argc == 3) @@ -154,13 +156,13 @@ static Object P_Wait(argc, argv) int argc; Object *argv; { /* If WAIT_PROCESS is supported, then WAIT_OPTIONS is supported as well, * because both waitpid() and wait4() accept options. */ -static Object P_Wait_Process(argc, argv) int argc; Object *argv; { +static Object P_Wait_Process(int argc, Object *argv) { return General_Wait(argv[0], argv[1], 1, Get_Integer(argv[2]), argc == 4 ? (int)Symbols_To_Bits(argv[3], 1, Wait_Flags) : 0); } #endif -elk_init_unix_wait() { +void elk_init_unix_wait() { Def_Prim(P_Wait, "unix-wait-vector-fill!", 2, 3, VARARGS); #ifdef WAIT_PROCESS Def_Prim(P_Wait_Process, "unix-wait-process-vector-fill!", 3, 4, VARARGS);