Module Name: src
Committed By: joerg
Date: Tue Sep 6 18:28:58 UTC 2011
Modified Files:
src/usr.bin/rs: rs.c
Log Message:
ANSIfy, static + __dead
To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/usr.bin/rs/rs.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/rs/rs.c
diff -u src/usr.bin/rs/rs.c:1.14 src/usr.bin/rs/rs.c:1.15
--- src/usr.bin/rs/rs.c:1.14 Mon Jul 13 19:05:41 2009
+++ src/usr.bin/rs/rs.c Tue Sep 6 18:28:58 2011
@@ -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;
-
-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 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;
+
+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;