From b5b1da6f1ae8703d42d1e93e8abe82793c08c8e4 Mon Sep 17 00:00:00 2001 From: George Koehler Date: Fri, 10 Nov 2017 16:26:27 -0500 Subject: [PATCH] Adjust dependencies in modules/src{print,string,system} Drop dependency on in modules+headers; assume that compiler knows ANSI C89. Add missing dependency from print to string; #include . Because had commented out the declarations of sys_lock() and sys_unlock(), I now stop building lock.c and unlock.c. --- modules/src/print/build.lua | 11 ++++++----- modules/src/print/doprnt.c | 5 +---- modules/src/print/format.c | 9 +++------ modules/src/print/fprint.c | 17 +---------------- modules/src/print/print.c | 15 +-------------- modules/src/print/print.h | 15 +++++---------- modules/src/print/sprint.c | 16 +--------------- modules/src/string/build.lua | 5 +---- modules/src/system/build.lua | 16 +++++++++------- modules/src/system/system.h | 34 ++++++++++++++++------------------ 10 files changed, 44 insertions(+), 99 deletions(-) diff --git a/modules/src/print/build.lua b/modules/src/print/build.lua index 67c873b69..745c622dc 100644 --- a/modules/src/print/build.lua +++ b/modules/src/print/build.lua @@ -1,12 +1,13 @@ clibrary { name = "lib", - srcs = { "./*.c" }, + srcs = { + "./doprnt.c", "./format.c", "./fprint.c", "./print.c", + "./sprint.c", + }, hdrs = { "./print.h" }, deps = { - "modules+headers", + "./param.h", + "modules/src/string+lib", "modules/src/system+lib", - "./*.h" } } - - diff --git a/modules/src/print/doprnt.c b/modules/src/print/doprnt.c index 90a2794a1..a77b7d2c1 100644 --- a/modules/src/print/doprnt.c +++ b/modules/src/print/doprnt.c @@ -16,10 +16,7 @@ %d = int $ */ void -doprnt(fp, fmt, argp) - File *fp; - char *fmt; - va_list argp; +doprnt(File *fp, char *fmt, va_list argp) { char buf[SSIZE]; diff --git a/modules/src/print/format.c b/modules/src/print/format.c index e207eaa02..2ad920bc8 100644 --- a/modules/src/print/format.c +++ b/modules/src/print/format.c @@ -5,13 +5,12 @@ /* $Id$ */ #include +#include #include #include "print.h" -extern char *long2str(); - static int -integral(c) +integral(int c) { switch (c) { case 'b': @@ -36,9 +35,7 @@ integral(c) %d = int $ */ int -_format(buf, fmt, argp) - char *buf, *fmt; - register va_list argp; +_format(char *buf, char *fmt, va_list argp) { register char *pf = fmt; register char *pb = buf; diff --git a/modules/src/print/fprint.c b/modules/src/print/fprint.c index ae08e97a9..c401858a9 100644 --- a/modules/src/print/fprint.c +++ b/modules/src/print/fprint.c @@ -17,27 +17,12 @@ $ */ /*VARARGS*/ void -fprint -#if __STDC__ - (File *fp, char *fmt, ...) +fprint(File *fp, char *fmt, ...) { -#else - (va_alist) - va_dcl -{ - File *fp; - char *fmt; -#endif va_list args; char buf[SSIZE]; -#if __STDC__ va_start(args, fmt); -#else - va_start(args); - fp = va_arg(args, File *); - fmt = va_arg(args, char *); -#endif sys_write(fp, buf, _format(buf, fmt, args)); va_end(args); } diff --git a/modules/src/print/print.c b/modules/src/print/print.c index bb1211687..cd9346e98 100644 --- a/modules/src/print/print.c +++ b/modules/src/print/print.c @@ -17,25 +17,12 @@ $ */ /*VARARGS*/ void -print -#if __STDC__ - (char *fmt, ...) +print(char *fmt, ...) { -#else - (va_alist) - va_dcl -{ - char *fmt; -#endif va_list args; char buf[SSIZE]; -#if __STDC__ va_start(args, fmt); -#else - va_start(args); - fmt = va_arg(args, char *); -#endif sys_write(STDOUT, buf, _format(buf, fmt, args)); va_end(args); } diff --git a/modules/src/print/print.h b/modules/src/print/print.h index 3b511b600..56372376a 100644 --- a/modules/src/print/print.h +++ b/modules/src/print/print.h @@ -7,17 +7,12 @@ #ifndef __PRINT_INCLUDED__ #define __PRINT_INCLUDED__ -#include -#if __STDC__ #include -#else -#include -#endif -_PROTOTYPE(void print, (char *fmt, ...)); -_PROTOTYPE(void fprint, (File *f, char *fmt, ...)); -_PROTOTYPE(void doprnt, (File *f, char *fmt, va_list ap)); -_PROTOTYPE(int _format, (char *buf, char *fmt, va_list ap)); -_PROTOTYPE(char *sprint, (char *buf, char *fmt, ...)); +void print(char *fmt, ...); +void fprint(File *f, char *fmt, ...); +void doprnt(File *f, char *fmt, va_list ap); +int _format(char *buf, char *fmt, va_list ap); +char *sprint(char *buf, char *fmt, ...); #endif /* __PRINT_INCLUDED__ */ diff --git a/modules/src/print/sprint.c b/modules/src/print/sprint.c index 614997c32..d88b47e69 100644 --- a/modules/src/print/sprint.c +++ b/modules/src/print/sprint.c @@ -17,25 +17,11 @@ $ */ /*VARARGS*/ char * -sprint -#if __STDC__ - (char *buf, char *fmt, ...) +sprint(char *buf, char *fmt, ...) { -#else - (va_alist) - va_dcl -{ - char *buf, *fmt; -#endif va_list args; -#if __STDC__ va_start(args, fmt); -#else - va_start(args); - buf = va_arg(args, char *); - fmt = va_arg(args, char *); -#endif buf[_format(buf, fmt, args)] = '\0'; va_end(args); return buf; diff --git a/modules/src/string/build.lua b/modules/src/string/build.lua index 647a32146..da63ed613 100644 --- a/modules/src/string/build.lua +++ b/modules/src/string/build.lua @@ -6,8 +6,5 @@ clibrary { "./str2bts.c", "./str2long.c", "./strindex.c", "./strrindex.c", "./strzero.c", }, - deps = { - "./ack_string.h", - "modules+headers", - }, + hdrs = { "./ack_string.h", }, } diff --git a/modules/src/system/build.lua b/modules/src/system/build.lua index cecae7d5e..c9eba2979 100644 --- a/modules/src/system/build.lua +++ b/modules/src/system/build.lua @@ -1,11 +1,13 @@ clibrary { name = "lib", - srcs = { "./*.c" }, - hdrs = { "./system.h" }, - deps = { - "modules+headers", - "./*.h" + srcs = { + "./access.c", "./break.c", "./chmode.c", "./close.c", + "./create.c", "./filesize.c", + --"./lock.c", + "./modtime.c", "./open.c", "./read.c", "./remove.c", + "./rename.c", "./seek.c", "./stop.c", "./system.c", + --"./unlock.c", + "./write.c", }, + hdrs = { "./system.h" }, } - - diff --git a/modules/src/system/system.h b/modules/src/system/system.h index 8a5825173..f596defe4 100644 --- a/modules/src/system/system.h +++ b/modules/src/system/system.h @@ -6,8 +6,6 @@ #ifndef __SYSTEM_INCLUDED__ #define __SYSTEM_INCLUDED__ -#include - struct _sys_fildes { int o_fd; /* UNIX filedescriptor */ int o_flags; /* flags for open; 0 if not used */ @@ -33,24 +31,24 @@ extern File _sys_ftab[]; #define S_EXIT 1 #define S_ABORT 2 -_PROTOTYPE(int sys_open, (char *, int, File **)); -_PROTOTYPE(void sys_close, (File *)); -_PROTOTYPE(int sys_read, (File *, char *, int, int *)); -_PROTOTYPE(int sys_write, (File *, char *, int)); -_PROTOTYPE(int sys_seek, (File *, long, int, long *)); -_PROTOTYPE(int sys_reset, (File *)); -_PROTOTYPE(int sys_access, (char *, int)); -_PROTOTYPE(int sys_remove, (char *)); -_PROTOTYPE(int sys_rename, (char *, char *)); -_PROTOTYPE(long sys_filesize, (char *)); -_PROTOTYPE(int sys_chmode, (char *, int)); +int sys_open(char *, int, File **); +void sys_close(File *); +int sys_read(File *, char *, int, int *); +int sys_write(File *, char *, int); +int sys_seek(File *, long, int, long *); +int sys_reset(File *); +int sys_access(char *, int); +int sys_remove(char *); +int sys_rename(char *, char *); +long sys_filesize(char *); +int sys_chmode(char *, int); #if 0 -_PROTOTYPE(int sys_lock, (char *)); -_PROTOTYPE(int sys_unlock, (char *)); +int sys_lock(char *); +int sys_unlock(char *); #endif -_PROTOTYPE(char *sys_break, (int)); -_PROTOTYPE(void sys_stop, (int)); -_PROTOTYPE(long sys_modtime, (char *)); +char *sys_break(int); +void sys_stop(int); +long sys_modtime(char *); /* standard file decsriptors */ #define STDIN &_sys_ftab[0]