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/2c7e522526d1
branches: trunk
changeset: 769326:2c7e522526d1
user: joerg <joerg%NetBSD.org@localhost>
date: Tue Sep 06 18:28:58 2011 +0000
description:
ANSIfy, static + __dead
diffstat:
usr.bin/rs/rs.c | 114 ++++++++++++++++++++-------------------------
usr.bin/ruptime/ruptime.c | 41 +++++++--------
2 files changed, 70 insertions(+), 85 deletions(-)
diffs (truncated from 331 to 300 lines):
diff -r 5cfd519f14c4 -r 2c7e522526d1 usr.bin/rs/rs.c
--- a/usr.bin/rs/rs.c Tue Sep 06 18:28:35 2011 +0000
+++ b/usr.bin/rs/rs.c Tue Sep 06 18:28:58 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rs.c,v 1.14 2009/07/13 19:05:41 roy Exp $ */
+/* $NetBSD: rs.c,v 1.15 2011/09/06 18:28:58 joerg Exp $ */
/*-
* Copyright (c) 1993
@@ -39,7 +39,7 @@
#if 0
static char sccsid[] = "@(#)rs.c 8.1 (Berkeley) 6/6/93";
#else
-__RCSID("$NetBSD: rs.c,v 1.14 2009/07/13 19:05:41 roy Exp $");
+__RCSID("$NetBSD: rs.c,v 1.15 2011/09/06 18:28:58 joerg Exp $");
#endif
#endif /* not lint */
@@ -56,7 +56,7 @@
#include <string.h>
#include <stdarg.h>
-long flags;
+static long flags;
#define TRANSPOSE 000001
#define MTRANSPOSE 000002
#define ONEPERLINE 000004
@@ -75,36 +75,34 @@
#define ONEPERCHAR 0100000
#define NOARGS 0200000
-short *colwidths;
-short *cord;
-short *icbd;
-short *ocbd;
-int nelem;
-char **elem;
-char **endelem;
-char *curline;
-int allocsize = BUFSIZ;
-int curlen;
-int irows, icols;
-int orows, ocols;
-int maxlen;
-int skip;
-int propgutter;
-char isep = ' ', osep = ' ';
-int owidth = 80, gutter = 2;
+static short *colwidths;
+static short *cord;
+static short *icbd;
+static short *ocbd;
+static int nelem;
+static char **elem;
+static char **endelem;
+static char *curline;
+static int allocsize = BUFSIZ;
+static int curlen;
+static int irows, icols;
+static int orows, ocols;
+static int maxlen;
+static int skip;
+static int propgutter;
+static char isep = ' ', osep = ' ';
+static int owidth = 80, gutter = 2;
-void usage __P((const char *, ...))
- __attribute__((__format__(__printf__, 1, 2)));
-void getargs __P((int, char *[]));
-void getfile __P((void));
-int get_line __P((void));
-char *getlist __P((short **, char *));
-char *getnum __P((int *, char *, int));
-char **getptrs __P((char **));
-int main __P((int, char **));
-void prepfile __P((void));
-void prints __P((char *, int));
-void putfile __P((void));
+static void usage(const char *, ...) __dead __printflike(1, 2);
+static void getargs(int, char *[]);
+static void getfile(void);
+static int get_line(void);
+static char *getlist(short **, char *);
+static char *getnum(int *, char *, int);
+static char **getptrs(char **);
+static void prepfile(void);
+static void prints(char *, int);
+static void putfile(void);
#define INCR(ep) do { \
if (++ep >= endelem) \
@@ -112,9 +110,7 @@
} while(0)
int
-main(argc, argv)
- int argc;
- char *argv[];
+main(int argc, char *argv[])
{
getargs(argc, argv);
getfile();
@@ -127,8 +123,8 @@
exit(0);
}
-void
-getfile()
+static void
+getfile(void)
{
char empty[1] = { '\0' };
char *p;
@@ -194,8 +190,8 @@
nelem = ep - elem;
}
-void
-putfile()
+static void
+putfile(void)
{
char **ep;
int i, j, n;
@@ -219,10 +215,8 @@
}
}
-void
-prints(s, col)
- char *s;
- int col;
+static void
+prints(char *s, int col)
{
int n;
char *p = s;
@@ -239,7 +233,7 @@
putchar(osep);
}
-void
+static void
usage(const char *msg, ...)
{
va_list ap;
@@ -252,8 +246,8 @@
exit(1);
}
-void
-prepfile()
+static void
+prepfile(void)
{
char **ep;
int i;
@@ -345,8 +339,8 @@
#define BSIZE 2048
char ibuf[BSIZE]; /* two screenfuls should do */
-int
-get_line() /* get line; maintain curline, curlen; manage storage */
+static int
+get_line(void) /* get line; maintain curline, curlen; manage storage */
{
static int putlength;
static char *endblock = ibuf + BSIZE;
@@ -378,9 +372,8 @@
return(c);
}
-char **
-getptrs(sp)
- char **sp;
+static char **
+getptrs(char **sp)
{
char **p;
@@ -394,10 +387,8 @@
return(sp);
}
-void
-getargs(ac, av)
- int ac;
- char *av[];
+static void
+getargs(int ac, char *av[])
{
char *p;
@@ -505,10 +496,8 @@
}
}
-char *
-getlist(list, p)
- short **list;
- char *p;
+static char *
+getlist(short **list, char *p)
{
int count = 1;
char *t;
@@ -538,10 +527,9 @@
return(t - 1);
}
-char *
-getnum(num, p, strict) /* num = number p points to; if (strict) complain */
- int *num, strict; /* returns pointer to end of num */
- char *p;
+static char *
+getnum(int *num, char *p, int strict) /* num = number p points to; if (strict) complain */
+ /* returns pointer to end of num */
{
char *t = p;
diff -r 5cfd519f14c4 -r 2c7e522526d1 usr.bin/ruptime/ruptime.c
--- a/usr.bin/ruptime/ruptime.c Tue Sep 06 18:28:35 2011 +0000
+++ b/usr.bin/ruptime/ruptime.c Tue Sep 06 18:28:58 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ruptime.c,v 1.14 2009/04/13 07:10:25 lukem Exp $ */
+/* $NetBSD: ruptime.c,v 1.15 2011/09/06 18:29:19 joerg Exp $ */
/*
* Copyright (c) 1983, 1993, 1994
@@ -37,7 +37,7 @@
#ifndef lint
/*static char sccsid[] = "from: @(#)ruptime.c 8.2 (Berkeley) 4/5/94";*/
-__RCSID("$NetBSD: ruptime.c,v 1.14 2009/04/13 07:10:25 lukem Exp $");
+__RCSID("$NetBSD: ruptime.c,v 1.15 2011/09/06 18:29:19 joerg Exp $");
#endif /* not lint */
#include <sys/param.h>
@@ -55,7 +55,7 @@
#include <tzfile.h>
#include <unistd.h>
-struct hs {
+static struct hs {
struct whod *hs_wd;
int hs_nusers;
} *hs;
@@ -64,18 +64,16 @@
#define WHDRSIZE (sizeof(struct whod) - \
sizeof (((struct whod *)0)->wd_we))
-size_t nhosts;
-time_t now;
-int rflg = 1;
+static size_t nhosts;
+static time_t now;
+static int rflg = 1;
-int hscmp(const void *, const void *);
-char *interval(time_t, const char *);
-int lcmp(const void *, const void *);
-int main(int, char **);
-void morehosts(void);
-int tcmp(const void *, const void *);
-int ucmp(const void *, const void *);
-void usage(void);
+static int hscmp(const void *, const void *);
+static char *interval(time_t, const char *);
+static int lcmp(const void *, const void *);
+static int tcmp(const void *, const void *);
+static int ucmp(const void *, const void *);
+__dead static void usage(void);
int
main(int argc, char **argv)
@@ -186,7 +184,7 @@
exit(0);
}
-char *
+static char *
interval(time_t tval, const char *updown)
{
static char resbuf[32];
@@ -214,16 +212,15 @@
#define HS(a) ((const struct hs *)(a))
/* Alphabetical comparison. */
-int
-hscmp(a1, a2)
- const void *a1, *a2;
+static int
+hscmp(const void *a1, const void *a2)
{
return (rflg *
strcmp(HS(a1)->hs_wd->wd_hostname, HS(a2)->hs_wd->wd_hostname));
}
/* Load average comparison. */
-int
Home |
Main Index |
Thread Index |
Old Index