Source-Changes-HG archive

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

[src/trunk]: src/usr.bin ANSIfy + static + __dead



details:   https://anonhg.NetBSD.org/src/rev/70f05e4fc69c
branches:  trunk
changeset: 769246:70f05e4fc69c
user:      joerg <joerg%NetBSD.org@localhost>
date:      Sun Sep 04 20:29:12 2011 +0000

description:
ANSIfy + static + __dead

diffstat:

 usr.bin/logname/logname.c |  15 +++++--------
 usr.bin/look/look.c       |  52 +++++++++++++++++++---------------------------
 usr.bin/mkdep/findcc.c    |   7 ++---
 usr.bin/mkdep/mkdep.c     |  11 ++++-----
 usr.bin/mkfifo/mkfifo.c   |  15 +++++--------
 5 files changed, 42 insertions(+), 58 deletions(-)

diffs (281 lines):

diff -r f187ce257106 -r 70f05e4fc69c usr.bin/logname/logname.c
--- a/usr.bin/logname/logname.c Sun Sep 04 20:28:59 2011 +0000
+++ b/usr.bin/logname/logname.c Sun Sep 04 20:29:12 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: logname.c,v 1.9 2008/07/21 14:19:23 lukem Exp $        */
+/*     $NetBSD: logname.c,v 1.10 2011/09/04 20:29:12 joerg Exp $       */
 
 /*-
  * Copyright (c) 1991, 1993, 1994
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = "@(#)logname.c  8.2 (Berkeley) 4/3/94";
 #endif
-__RCSID("$NetBSD: logname.c,v 1.9 2008/07/21 14:19:23 lukem Exp $");
+__RCSID("$NetBSD: logname.c,v 1.10 2011/09/04 20:29:12 joerg Exp $");
 #endif /* not lint */
 
 #include <stdio.h>
@@ -48,13 +48,10 @@
 #include <unistd.h>
 #include <err.h>
 
-int    main __P((int, char **));
-void   usage __P((void));
+__dead  static void    usage(void);
 
 int
-main(argc, argv)
-       int argc;
-       char *argv[];
+main(int argc, char *argv[])
 {
        int ch;
        char *p;
@@ -80,8 +77,8 @@
        exit(0);
 }
 
-void
-usage()
+static void
+usage(void)
 {
        (void)fprintf(stderr, "usage: logname\n");
        exit(1);
diff -r f187ce257106 -r 70f05e4fc69c usr.bin/look/look.c
--- a/usr.bin/look/look.c       Sun Sep 04 20:28:59 2011 +0000
+++ b/usr.bin/look/look.c       Sun Sep 04 20:29:12 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: look.c,v 1.14 2009/04/26 15:55:50 christos Exp $       */
+/*     $NetBSD: look.c,v 1.15 2011/09/04 20:29:32 joerg Exp $  */
 
 /*-
  * Copyright (c) 1991, 1993
@@ -42,7 +42,7 @@
 #if 0
 static char sccsid[] = "@(#)look.c     8.2 (Berkeley) 5/4/95";
 #endif
-__RCSID("$NetBSD: look.c,v 1.14 2009/04/26 15:55:50 christos Exp $");
+__RCSID("$NetBSD: look.c,v 1.15 2011/09/04 20:29:32 joerg Exp $");
 #endif /* not lint */
 
 /*
@@ -84,20 +84,17 @@
 #define        FOLD(c) (isascii(c) && isupper(c) ? tolower(c) : (c))
 #define        DICT(c) (isascii(c) && isalnum(c) ? (c) : NO_COMPARE)
 
-int dflag, fflag;
+static int dflag, fflag;
 
-char   *binary_search __P((char *, char *, char *));
-int     compare __P((char *, char *, char *));
-char   *linear_search __P((char *, char *, char *));
-int     look __P((char *, char *, char *));
-int     main __P((int, char **));
-void    print_from __P((char *, char *, char *));
-void    usage __P((void));
+static char    *binary_search(char *, char *, char *);
+static int      compare(char *, char *, char *);
+static char    *linear_search(char *, char *, char *);
+static int      look(char *, char *, char *);
+static void     print_from(char *, char *, char *);
+__dead static void      usage(void);
 
 int
-main(argc, argv)
-       int argc;
-       char *argv[];
+main(int argc, char *argv[])
 {
        struct stat sb;
        int ch, fd, termchar;
@@ -156,9 +153,8 @@
        exit(look(string, front, back));
 }
 
-int
-look(string, front, back)
-       char *string, *front, *back;
+static int
+look(char *string, char *front, char *back)
 {
        int ch;
        char *readp, *writep;
@@ -224,9 +220,8 @@
 #define        SKIP_PAST_NEWLINE(p, back) \
        while (p < back && *p++ != '\n');
 
-char *
-binary_search(string, front, back)
-       char *string, *front, *back;
+static char *
+binary_search(char *string, char *front, char *back)
 {
        char *p;
 
@@ -259,9 +254,8 @@
  *     o front points at the first character in a line. 
  *     o front is before or at the first line to be printed.
  */
-char *
-linear_search(string, front, back)
-       char *string, *front, *back;
+static char *
+linear_search(char *string, char *front, char *back)
 {
        while (front < back) {
                switch (compare(string, front, back)) {
@@ -282,9 +276,8 @@
 /*
  * Print as many lines as match string, starting at front.
  */
-void 
-print_from(string, front, back)
-       char *string, *front, *back;
+static void 
+print_from(char *string, char *front, char *back)
 {
        for (; front < back && compare(string, front, back) == EQUAL; ++front) {
                for (; front < back && *front != '\n'; ++front)
@@ -308,9 +301,8 @@
  * The string "s1" is null terminated.  The string s2 is '\n' terminated (or
  * "back" terminated).
  */
-int
-compare(s1, s2, back)
-       char *s1, *s2, *back;
+static int
+compare(char *s1, char *s2, char *back)
 {
        int ch;
 
@@ -331,8 +323,8 @@
        return (*s1 ? GREATER : EQUAL);
 }
 
-void
-usage()
+static void
+usage(void)
 {
        (void)fprintf(stderr, "usage: look [-df] [-t char] string [file]\n");
        exit(2);
diff -r f187ce257106 -r 70f05e4fc69c usr.bin/mkdep/findcc.c
--- a/usr.bin/mkdep/findcc.c    Sun Sep 04 20:28:59 2011 +0000
+++ b/usr.bin/mkdep/findcc.c    Sun Sep 04 20:29:12 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: findcc.c,v 1.5 2009/04/12 14:23:30 lukem Exp $ */
+/* $NetBSD: findcc.c,v 1.6 2011/09/04 20:30:06 joerg Exp $ */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
 #if !defined(lint)
 __COPYRIGHT("@(#) Copyright (c) 1999 The NetBSD Foundation, Inc.\
  All rights reserved.");
-__RCSID("$NetBSD: findcc.c,v 1.5 2009/04/12 14:23:30 lukem Exp $");
+__RCSID("$NetBSD: findcc.c,v 1.6 2011/09/04 20:30:06 joerg Exp $");
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -49,8 +49,7 @@
 #include "findcc.h"
 
 char *
-findcc(progname)
-       const char      *progname;
+findcc(const char *progname)
 {
        char   *path, *dir, *next;
        char   buffer[MAXPATHLEN];
diff -r f187ce257106 -r 70f05e4fc69c usr.bin/mkdep/mkdep.c
--- a/usr.bin/mkdep/mkdep.c     Sun Sep 04 20:28:59 2011 +0000
+++ b/usr.bin/mkdep/mkdep.c     Sun Sep 04 20:29:12 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mkdep.c,v 1.39 2011/06/30 20:09:42 wiz Exp $ */
+/* $NetBSD: mkdep.c,v 1.40 2011/09/04 20:30:06 joerg Exp $ */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
 #if !defined(lint)
 __COPYRIGHT("@(#) Copyright (c) 1999 The NetBSD Foundation, Inc.\
  All rights reserved.");
-__RCSID("$NetBSD: mkdep.c,v 1.39 2011/06/30 20:09:42 wiz Exp $");
+__RCSID("$NetBSD: mkdep.c,v 1.40 2011/09/04 20:30:06 joerg Exp $");
 #endif /* not lint */
 
 #include <sys/mman.h>
@@ -72,8 +72,8 @@
 } suff_list_t;
 
 /* tree of includes for -o processing */
-opt_t *opt;
-int width;
+static opt_t *opt;
+static int width;
 
 #define DEFAULT_PATH           _PATH_DEFPATH
 #define DEFAULT_FILENAME       ".depend"
@@ -81,14 +81,13 @@
 static void save_for_optional(const char *, const char *);
 static int write_optional(int, opt_t *, int);
 
-
 static inline void *
 deconst(const void *p)
 {
        return (const char *)p - (const char *)0 + (char *)0;
 }
 
-static void
+__dead static void
 usage(void)
 {
        (void)fprintf(stderr,
diff -r f187ce257106 -r 70f05e4fc69c usr.bin/mkfifo/mkfifo.c
--- a/usr.bin/mkfifo/mkfifo.c   Sun Sep 04 20:28:59 2011 +0000
+++ b/usr.bin/mkfifo/mkfifo.c   Sun Sep 04 20:29:12 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mkfifo.c,v 1.12 2008/07/21 14:19:24 lukem Exp $        */
+/*     $NetBSD: mkfifo.c,v 1.13 2011/09/04 20:30:34 joerg Exp $        */
 
 /*
  * Copyright (c) 1990, 1993
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = "@(#)mkfifo.c   8.2 (Berkeley) 1/5/94";
 #endif
-__RCSID("$NetBSD: mkfifo.c,v 1.12 2008/07/21 14:19:24 lukem Exp $");
+__RCSID("$NetBSD: mkfifo.c,v 1.13 2011/09/04 20:30:34 joerg Exp $");
 #endif /* not lint */
 
 #include <stdio.h>
@@ -52,13 +52,10 @@
 #include <unistd.h>
 #include <err.h>
 
-int    main __P((int, char **));
-static void usage __P((void));
+__dead static void usage(void);
 
 int
-main(argc, argv)
-       int argc;
-       char *argv[];
+main(int argc, char *argv[])
 {
        int ch, exitval;
        void *set;
@@ -102,8 +99,8 @@
        exit(exitval);
 }
 
-void
-usage()
+static void
+usage(void)
 {
        (void)fprintf(stderr, "usage: mkfifo [-m mode] fifoname ...\n");
        exit(1);



Home | Main Index | Thread Index | Old Index