From 2f07e01bed31a6a5dfeacf19d26af2a7b4c3da16 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Sun, 10 May 2015 22:46:41 +0100 Subject: [PATCH] sh: args, ansify --- Applications/V7/cmd/sh/args.c | 19 +++++++------------ Applications/V7/cmd/sh/defs.h | 6 ++++++ 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/Applications/V7/cmd/sh/args.c b/Applications/V7/cmd/sh/args.c index 2acc5010..eb72c2bd 100644 --- a/Applications/V7/cmd/sh/args.c +++ b/Applications/V7/cmd/sh/args.c @@ -13,7 +13,7 @@ #include #include "defs.h" -static STRING *copyargs(); +static STRING *copyargs(STRING from[], int n); static DOLPTR dolh; CHAR flagadr[10]; @@ -30,9 +30,7 @@ int flagval[] = { /* ======== option handling ======== */ -int options(argc, argv) -STRING *argv; -int argc; +int options(int argc, STRING *argv) { register STRING cp; register STRING *argp = argv; @@ -83,8 +81,7 @@ int argc; return (argc); } -void setargs(argi) -STRING argi[]; +void setargs(STRING argi[]) { /* count args */ register STRING *argp = argi; @@ -100,8 +97,7 @@ STRING argi[]; assnum(&dolladr, dolc = argn - 1); } -DOLPTR freeargs(blk) -DOLPTR blk; +DOLPTR freeargs(DOLPTR blk) { register STRING *argp; register DOLPTR argr = 0; @@ -121,8 +117,7 @@ DOLPTR blk; return (argr); } -static STRING *copyargs(from, n) -STRING from[]; +static STRING *copyargs(STRING from[], int n) { register STRING *np = (STRING *) alloc(sizeof(STRING *) * n + 3 * BYTESPERWORD); @@ -140,7 +135,7 @@ STRING from[]; return (pp); } -clearup() +void clearup(void) { /* force `for' $* lists to go away */ while (argfor = freeargs(argfor)); @@ -149,7 +144,7 @@ clearup() while (pop()); } -DOLPTR useargs() +DOLPTR useargs(void) { if (dolh) { dolh->doluse++; diff --git a/Applications/V7/cmd/sh/defs.h b/Applications/V7/cmd/sh/defs.h index e169f3e5..0d40e451 100644 --- a/Applications/V7/cmd/sh/defs.h +++ b/Applications/V7/cmd/sh/defs.h @@ -291,3 +291,9 @@ extern const char badfile[]; extern address end[]; #include "ctype.h" + +extern int options(int argc, STRING *argv); +extern void setargs(STRING argi[]); +extern DOLPTR freeargs(DOLPTR blk); +extern void clearup(void); +extern DOLPTR useargs(void); -- 2.34.1