diff options
author | imp <imp@FreeBSD.org> | 2002-02-02 06:50:57 +0000 |
---|---|---|
committer | imp <imp@FreeBSD.org> | 2002-02-02 06:50:57 +0000 |
commit | 5ef5088ac4e038d0a147a08377ef087fd6edf527 (patch) | |
tree | 01a827446e9ba4f34cf1e754fcac691f6c9eb1cf /bin/sh/var.c | |
parent | 50014e35418ca00d25ea852fc4f94acf80be4df3 (diff) | |
download | FreeBSD-src-5ef5088ac4e038d0a147a08377ef087fd6edf527.zip FreeBSD-src-5ef5088ac4e038d0a147a08377ef087fd6edf527.tar.gz |
o __P has been reoved
o Old-style K&R declarations have been converted to new C89 style
o register has been removed
o prototype for main() has been removed (gcc3 makes it an error)
o int main(int argc, char *argv[]) is the preferred main definition.
o Attempt to not break style(9) conformance for declarations more than
they already are.
o Change
int
foo() {
...
to
int
foo(void)
{
...
Diffstat (limited to 'bin/sh/var.c')
-rw-r--r-- | bin/sh/var.c | 92 |
1 files changed, 36 insertions, 56 deletions
diff --git a/bin/sh/var.c b/bin/sh/var.c index 056ae6f..099d4c5 100644 --- a/bin/sh/var.c +++ b/bin/sh/var.c @@ -77,7 +77,7 @@ struct varinit { struct var *var; int flags; char *text; - void (*func) __P((const char *)); + void (*func)(const char *); }; @@ -133,9 +133,9 @@ const struct varinit varinit[] = { struct var *vartab[VTABSIZE]; -STATIC struct var **hashvar __P((char *)); -STATIC int varequal __P((char *, char *)); -STATIC int localevar __P((char *)); +STATIC struct var **hashvar(char *); +STATIC int varequal(char *, char *); +STATIC int localevar(char *); /* * Initialize the varable symbol tables and import the environment @@ -163,7 +163,8 @@ INIT { */ void -initvar() { +initvar(void) +{ const struct varinit *ip; struct var *vp; struct var **vpp; @@ -195,9 +196,7 @@ initvar() { */ int -setvarsafe(name, val, flags) - char *name, *val; - int flags; +setvarsafe(char *name, char *val, int flags) { struct jmploc jmploc; struct jmploc *volatile savehandler = handler; @@ -223,9 +222,7 @@ setvarsafe(name, val, flags) */ void -setvar(name, val, flags) - char *name, *val; - int flags; +setvar(char *name, char *val, int flags) { char *p, *q; int len; @@ -267,9 +264,8 @@ setvar(name, val, flags) } STATIC int -localevar(s) - char *s; - { +localevar(char *s) +{ static char *lnames[7] = { "ALL", "COLLATE", "CTYPE", "MONETARY", "NUMERIC", "TIME", NULL @@ -296,9 +292,7 @@ localevar(s) */ void -setvareq(s, flags) - char *s; - int flags; +setvareq(char *s, int flags) { struct var *vp, **vpp; @@ -359,9 +353,8 @@ setvareq(s, flags) */ void -listsetvar(list) - struct strlist *list; - { +listsetvar(struct strlist *list) +{ struct strlist *lp; INTOFF; @@ -378,9 +371,8 @@ listsetvar(list) */ char * -lookupvar(name) - char *name; - { +lookupvar(char *name) +{ struct var *v; for (v = *hashvar(name) ; v ; v = v->next) { @@ -402,9 +394,7 @@ lookupvar(name) */ char * -bltinlookup(name, doall) - char *name; - int doall; +bltinlookup(char *name, int doall) { struct strlist *sp; struct var *v; @@ -432,7 +422,8 @@ bltinlookup(name, doall) */ char ** -environment() { +environment(void) +{ int nenv; struct var **vpp; struct var *vp; @@ -470,7 +461,8 @@ SHELLPROC { #endif void -shprocvar() { +shprocvar(void) +{ struct var **vpp; struct var *vp, **prev; @@ -503,9 +495,7 @@ shprocvar() { */ int -showvarscmd(argc, argv) - int argc __unused; - char **argv __unused; +showvarscmd(int argc __unused, char **argv __unused) { struct var **vpp; struct var *vp; @@ -526,9 +516,7 @@ showvarscmd(argc, argv) */ int -exportcmd(argc, argv) - int argc; - char **argv; +exportcmd(int argc, char **argv) { struct var **vpp; struct var *vp; @@ -545,6 +533,7 @@ exportcmd(argc, argv) vpp = hashvar(name); for (vp = *vpp ; vp ; vp = vp->next) { if (varequal(vp->text, name)) { + vp->flags |= flag; if ((vp->flags & VEXPORT) && localevar(vp->text)) { putenv(vp->text); @@ -577,9 +566,7 @@ found:; */ int -localcmd(argc, argv) - int argc __unused; - char **argv __unused; +localcmd(int argc __unused, char **argv __unused) { char *name; @@ -600,9 +587,8 @@ localcmd(argc, argv) */ void -mklocal(name) - char *name; - { +mklocal(char *name) +{ struct localvar *lvp; struct var **vpp; struct var *vp; @@ -644,7 +630,8 @@ mklocal(name) */ void -poplocalvars() { +poplocalvars(void) +{ struct localvar *lvp; struct var *vp; @@ -668,9 +655,7 @@ poplocalvars() { int -setvarcmd(argc, argv) - int argc; - char **argv; +setvarcmd(int argc, char **argv) { if (argc <= 2) return unsetcmd(argc, argv); @@ -689,9 +674,7 @@ setvarcmd(argc, argv) */ int -unsetcmd(argc, argv) - int argc __unused; - char **argv __unused; +unsetcmd(int argc __unused, char **argv __unused) { char **ap; int i; @@ -723,9 +706,8 @@ unsetcmd(argc, argv) */ int -unsetvar(s) - char *s; - { +unsetvar(char *s) +{ struct var **vpp; struct var *vp; @@ -764,9 +746,8 @@ unsetvar(s) */ STATIC struct var ** -hashvar(p) - char *p; - { +hashvar(char *p) +{ unsigned int hashval; hashval = ((unsigned char) *p) << 4; @@ -784,9 +765,8 @@ hashvar(p) */ STATIC int -varequal(p, q) - char *p, *q; - { +varequal(char *p, char *q) +{ while (*p == *q++) { if (*p++ == '=') return 1; |