Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/sup/source Cleanup, part 2:



details:   https://anonhg.NetBSD.org/src/rev/ee25c0a0c43c
branches:  trunk
changeset: 533906:ee25c0a0c43c
user:      wiz <wiz%NetBSD.org@localhost>
date:      Wed Jul 10 20:19:38 2002 +0000

description:
Cleanup, part 2:
Remove 'register'. ANSIfy. indent(1). Static -> static.
Change some ``#include <header.h>'' to ``#include "header.h"'' for
local headers.
Fix function declaration mistakes uncovered by ANSIfication.

diffstat:

 usr.sbin/sup/source/atoo.c         |    18 +-
 usr.sbin/sup/source/errmsg.c       |    42 +-
 usr.sbin/sup/source/expand.c       |   206 ++--
 usr.sbin/sup/source/ffilecopy.c    |    35 +-
 usr.sbin/sup/source/filecopy.c     |    14 +-
 usr.sbin/sup/source/log.c          |    92 +-
 usr.sbin/sup/source/netcryptvoid.c |    32 +-
 usr.sbin/sup/source/nxtarg.c       |    28 +-
 usr.sbin/sup/source/path.c         |    39 +-
 usr.sbin/sup/source/quit.c         |    10 +-
 usr.sbin/sup/source/read_line.c    |    30 +-
 usr.sbin/sup/source/run.c          |   125 +-
 usr.sbin/sup/source/salloc.c       |    14 +-
 usr.sbin/sup/source/scan.c         |   727 ++++++++--------
 usr.sbin/sup/source/scm.c          |   220 ++--
 usr.sbin/sup/source/scmio.c        |   531 ++++++------
 usr.sbin/sup/source/skipto.c       |    27 +-
 usr.sbin/sup/source/stree.c        |   360 ++++----
 usr.sbin/sup/source/supcdefs.h     |     4 +-
 usr.sbin/sup/source/supcmain.c     |   294 +++---
 usr.sbin/sup/source/supcmeat.c     |  1352 ++++++++++++++++----------------
 usr.sbin/sup/source/supcmisc.c     |   234 ++---
 usr.sbin/sup/source/supcname.c     |    71 +-
 usr.sbin/sup/source/supcparse.c    |   169 ++--
 usr.sbin/sup/source/supcvers.c     |     8 +-
 usr.sbin/sup/source/supfilesrv.c   |  1464 ++++++++++++++++++-----------------
 usr.sbin/sup/source/supmsg.c       |   820 +++++++++++--------
 usr.sbin/sup/source/supscan.c      |   278 +++---
 usr.sbin/sup/source/vprintf.c      |    32 +-
 29 files changed, 3726 insertions(+), 3550 deletions(-)

diffs (truncated from 11997 to 300 lines):

diff -r d56fb9ef97e4 -r ee25c0a0c43c usr.sbin/sup/source/atoo.c
--- a/usr.sbin/sup/source/atoo.c        Wed Jul 10 19:58:02 2002 +0000
+++ b/usr.sbin/sup/source/atoo.c        Wed Jul 10 20:19:38 2002 +0000
@@ -1,9 +1,9 @@
-/*     $NetBSD: atoo.c,v 1.3 1997/06/17 18:56:05 christos Exp $        */
+/*     $NetBSD: atoo.c,v 1.4 2002/07/10 20:19:38 wiz Exp $     */
 
 /*
  * Copyright (c) 1991 Carnegie Mellon University
  * All Rights Reserved.
- * 
+ *
  * Permission to use, copy, modify and distribute this software and its
  * documentation is hereby granted, provided that both the copyright
  * notice and this permission notice appear in all copies of the
@@ -42,17 +42,17 @@
 #include "supcdefs.h"
 #include "supextern.h"
 
-unsigned int atoo(ap)
-char *ap;
+unsigned int 
+atoo(char *ap)
 {
-       register unsigned int n;
-       register char *p;
+       unsigned int n;
+       char *p;
 
        p = ap;
        n = 0;
-       while(*p == ' ' || *p == '      ')
+       while (*p == ' ' || *p == '     ')
                p++;
-       while(*p >= '0' && *p <= '7')
+       while (*p >= '0' && *p <= '7')
                n = n * 8 + *p++ - '0';
-       return(n);
+       return (n);
 }
diff -r d56fb9ef97e4 -r ee25c0a0c43c usr.sbin/sup/source/errmsg.c
--- a/usr.sbin/sup/source/errmsg.c      Wed Jul 10 19:58:02 2002 +0000
+++ b/usr.sbin/sup/source/errmsg.c      Wed Jul 10 20:19:38 2002 +0000
@@ -1,9 +1,9 @@
-/*     $NetBSD: errmsg.c,v 1.6 2002/07/10 18:53:57 wiz Exp $   */
+/*     $NetBSD: errmsg.c,v 1.7 2002/07/10 20:19:38 wiz Exp $   */
 
 /*
  * Copyright (c) 1991 Carnegie Mellon University
  * All Rights Reserved.
- * 
+ *
  * Permission to use, copy, modify and distribute this software and its
  * documentation is hereby granted, provided that both the copyright
  * notice and this permission notice appear in all copies of the
@@ -39,38 +39,38 @@
 #ifndef __NetBSD__
 static char *itoa(char *, unsigned);
 
-static char *itoa(p,n)
-char *p;
-unsigned n;
+static char *
+itoa(char *p, unsigned n)
 {
-    if (n >= 10)
-       p =itoa(p,n/10);
-    *p++ = (n%10)+'0';
-    return(p);
+       if (n >= 10)
+               p = itoa(p, n / 10);
+       *p++ = (n % 10) + '0';
+       return (p);
 }
 #endif
 
-const char *errmsg(cod)
-int cod;
+const char *
+errmsg(int cod)
 {
 #ifndef __NetBSD__
-       extern int      errno;
-       extern int      sys_nerr;
-       extern char     *sys_errlist[];
+       extern int errno;
+       extern int sys_nerr;
+       extern char *sys_errlist[];
        static char unkmsg[] = "Unknown error ";
-       static char unk[sizeof(unkmsg)+11];             /* trust us */
+       static char unk[sizeof(unkmsg) + 11];   /* trust us */
 #endif
 
-       if (cod < 0) cod = errno;
+       if (cod < 0)
+               cod = errno;
 
 #ifndef __NetBSD__
-       if((cod >= 0) && (cod < sys_nerr))
-           return(sys_errlist[cod]);
+       if ((cod >= 0) && (cod < sys_nerr))
+               return (sys_errlist[cod]);
 
-       strcpy(unk,unkmsg);
-       *itoa(&unk[sizeof(unkmsg)-1],cod) = '\0';
+       strcpy(unk, unkmsg);
+       *itoa(&unk[sizeof(unkmsg) - 1], cod) = '\0';
 
-       return(unk);
+       return (unk);
 #else
        return strerror(cod);
 #endif
diff -r d56fb9ef97e4 -r ee25c0a0c43c usr.sbin/sup/source/expand.c
--- a/usr.sbin/sup/source/expand.c      Wed Jul 10 19:58:02 2002 +0000
+++ b/usr.sbin/sup/source/expand.c      Wed Jul 10 20:19:38 2002 +0000
@@ -1,9 +1,9 @@
-/*     $NetBSD: expand.c,v 1.13 2002/07/10 18:53:57 wiz Exp $  */
+/*     $NetBSD: expand.c,v 1.14 2002/07/10 20:19:39 wiz Exp $  */
 
 /*
  * Copyright (c) 1991 Carnegie Mellon University
  * All Rights Reserved.
- * 
+ *
  * Permission to use, copy, modify and distribute this software and its
  * documentation is hereby granted, provided that both the copyright
  * notice and this permission notice appear in all copies of the
@@ -75,17 +75,17 @@
 #include <stdlib.h>
 #include <unistd.h>
 
-static jmp_buf sjbuf;
+static jmp_buf sjbuf;
 
-static char    pathbuf[MAXPATHLEN];
-static char    *path, *pathp, *lastpathp;
+static char pathbuf[MAXPATHLEN];
+static char *path, *pathp, *lastpathp;
 
-static char    *globchars = "{[*?";    /* meta characters */
-static char    *entp;                  /* current dir entry pointer */
+static char *globchars = "{[*?";/* meta characters */
+static char *entp;             /* current dir entry pointer */
 
-static char    **BUFFER;               /* pointer to the buffer */
-static int     BUFSIZE;                /* maximum number in buffer */
-static int     bufcnt;                 /* current number in buffer */
+static char **BUFFER;          /* pointer to the buffer */
+static int BUFSIZE;            /* maximum number in buffer */
+static int bufcnt;             /* current number in buffer */
 
 #define fixit(a) (a[0] ? a : ".")
 
@@ -96,13 +96,11 @@
 static int match(char *, char *);
 static int amatch(char *, char *);
 static void addone(char *, char *);
-static int addpath(int);
+static int addpath(char);
 static int gethdir(char *, int);
 
-int expand(spec, buffer, bufsize)
-       register char *spec;
-       char **buffer;
-       int bufsize;
+int 
+expand(char *spec, char **buffer, int bufsize)
 {
        pathp = path = pathbuf;
        *pathp = 0;
@@ -111,40 +109,45 @@
        BUFSIZE = bufsize;
        bufcnt = 0;
        if (setjmp(sjbuf) == 0)
-           glob(spec);
-       return(bufcnt);
+               glob(spec);
+       return (bufcnt);
 }
 
-static void glob(as)
-       char *as;
+static void 
+glob(char *as)
 {
-       register char *cs;
-       register char *spathp, *oldcs;
+       char *cs;
+       char *spathp, *oldcs;
        struct stat stb;
 
        spathp = pathp;
        cs = as;
        if (*cs == '~' && pathp == path) {
-               if (addpath('~')) goto endit;
+               if (addpath('~'))
+                       goto endit;
                for (cs++; isalnum(*cs) || *cs == '_' || *cs == '-';)
-                       if (addpath(*cs++)) goto endit;
+                       if (addpath(*cs++))
+                               goto endit;
                if (!*cs || *cs == '/') {
                        if (pathp != path + 1) {
                                *pathp = 0;
-                               if (gethdir(path + 1,sizeof path-1)) goto endit;
-                               strncpy(path, path + 1, sizeof path-1);
+                               if (gethdir(path + 1, sizeof path - 1))
+                                       goto endit;
+                               strncpy(path, path + 1, sizeof path - 1);
                        } else
-                               strncpy(path, (char *)getenv("HOME"), sizeof path-1);
-                       path[sizeof path-1] = '\0';
+                               strncpy(path, (char *) getenv("HOME"), sizeof path - 1);
+                       path[sizeof path - 1] = '\0';
                        pathp = path + strlen(path);
                }
        }
        while (*cs == 0 || strchr(globchars, *cs) == 0) {
                if (*cs == 0) {
-                       if (lstat(fixit(path), &stb) >= 0) addone(path, "");
+                       if (lstat(fixit(path), &stb) >= 0)
+                               addone(path, "");
                        goto endit;
                }
-               if (addpath(*cs++)) goto endit;
+               if (addpath(*cs++))
+                       goto endit;
        }
        oldcs = cs;
        while (cs > as && *cs != '/')
@@ -165,13 +168,13 @@
        return;
 }
 
-static void matchdir(pattern)
-       char *pattern;
+static void 
+matchdir(char *pattern)
 {
 #ifdef HAS_POSIX_DIR
-       register struct dirent *dp;
+       struct dirent *dp;
 #else
-       register struct direct *dp;
+       struct direct *dp;
 #endif
        DIR *dirp;
 
@@ -180,9 +183,11 @@
                return;
        while ((dp = readdir(dirp)) != NULL) {
 #if defined(HAS_POSIX_DIR) && !defined(__SVR4)
-               if (dp->d_fileno == 0) continue;
+               if (dp->d_fileno == 0)
+                       continue;
 #else
-               if (dp->d_ino == 0) continue;
+               if (dp->d_ino == 0)
+                       continue;
 #endif
                if (match(dp->d_name, pattern))
                        addone(path, dp->d_name);
@@ -191,33 +196,36 @@
        return;
 }
 
-static int execbrc(p, s)
-       char *p, *s;
+static int 
+execbrc(char *p, char *s)
 {
        char restbuf[MAXPATHLEN + 1];
-       register char *pe, *pm, *pl;
+       char *pe, *pm, *pl;
        int brclev = 0;
        char *lm, savec, *spathp;
 
        for (lm = restbuf; *p != '{'; *lm++ = *p++)
                continue;
        for (pe = ++p; *pe; pe++)
-       switch (*pe) {
-       case '{':
-               brclev++;
-               continue;
-       case '}':
-               if (brclev == 0) goto pend;
-               brclev--;
-               continue;
-       case '[':
-               for (pe++; *pe && *pe != ']'; pe++)
+               switch (*pe) {
+               case '{':
+                       brclev++;
+                       continue;
+               case '}':
+                       if (brclev == 0)
+                               goto pend;
+                       brclev--;
                        continue;



Home | Main Index | Thread Index | Old Index