Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/tr ANSIfy. Sprinkle const and __dead.
details: https://anonhg.NetBSD.org/src/rev/50cefc036774
branches: trunk
changeset: 769336:50cefc036774
user: joerg <joerg%NetBSD.org@localhost>
date: Tue Sep 06 18:33:46 2011 +0000
description:
ANSIfy. Sprinkle const and __dead.
diffstat:
usr.bin/tr/extern.h | 4 ++--
usr.bin/tr/str.c | 48 ++++++++++++++++++++----------------------------
usr.bin/tr/tr.c | 21 +++++++--------------
3 files changed, 29 insertions(+), 44 deletions(-)
diffs (204 lines):
diff -r 18c4bcfc40fd -r 50cefc036774 usr.bin/tr/extern.h
--- a/usr.bin/tr/extern.h Tue Sep 06 18:33:18 2011 +0000
+++ b/usr.bin/tr/extern.h Tue Sep 06 18:33:46 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: extern.h,v 1.6 2003/08/07 11:16:46 agc Exp $ */
+/* $NetBSD: extern.h,v 1.7 2011/09/06 18:33:46 joerg Exp $ */
/*-
* Copyright (c) 1991, 1993
@@ -45,4 +45,4 @@
#define NCHARS (UCHAR_MAX + 1) /* Number of possible characters. */
#define OOBCH (UCHAR_MAX + 1) /* Out of band character value. */
-int next __P((STR *));
+int next(STR *);
diff -r 18c4bcfc40fd -r 50cefc036774 usr.bin/tr/str.c
--- a/usr.bin/tr/str.c Tue Sep 06 18:33:18 2011 +0000
+++ b/usr.bin/tr/str.c Tue Sep 06 18:33:46 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: str.c,v 1.12 2009/04/13 23:50:49 lukem Exp $ */
+/* $NetBSD: str.c,v 1.13 2011/09/06 18:33:46 joerg Exp $ */
/*-
* Copyright (c) 1991, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)str.c 8.2 (Berkeley) 4/28/95";
#endif
-__RCSID("$NetBSD: str.c,v 1.12 2009/04/13 23:50:49 lukem Exp $");
+__RCSID("$NetBSD: str.c,v 1.13 2011/09/06 18:33:46 joerg Exp $");
#endif /* not lint */
#include <sys/types.h>
@@ -49,17 +49,16 @@
#include "extern.h"
-static int backslash __P((STR *));
-static int bracket __P((STR *));
-static int c_class __P((const void *, const void *));
-static void genclass __P((STR *));
-static void genequiv __P((STR *));
-static int genrange __P((STR *));
-static void genseq __P((STR *));
+static int backslash(STR *);
+static int bracket(STR *);
+static int c_class(const void *, const void *);
+static void genclass(STR *);
+static void genequiv(STR *);
+static int genrange(STR *);
+static void genseq(STR *);
int
-next(s)
- STR *s;
+next(STR *s)
{
int ch;
@@ -115,8 +114,7 @@
}
static int
-bracket(s)
- STR *s;
+bracket(STR *s)
{
char *p;
@@ -149,11 +147,11 @@
typedef struct {
const char *name;
- int (*func) __P((int));
+ int (*func)(int);
int *set;
} CLASS;
-static CLASS classes[] = {
+static const CLASS classes[] = {
{ "alnum", isalnum, NULL, },
{ "alpha", isalpha, NULL, },
{ "blank", isblank, NULL, },
@@ -169,10 +167,9 @@
};
static void
-genclass(s)
- STR *s;
+genclass(STR *s)
{
- int cnt, (*func) __P((int));
+ int cnt, (*func)(int);
CLASS *cp, tmp;
int *p;
@@ -195,8 +192,7 @@
}
static int
-c_class(a, b)
- const void *a, *b;
+c_class(const void *a, const void *b)
{
return (strcmp(((const CLASS *)a)->name, ((const CLASS *)b)->name));
}
@@ -206,8 +202,7 @@
* we just syntax check and grab the character.
*/
static void
-genequiv(s)
- STR *s;
+genequiv(STR *s)
{
if (*s->str == '\\') {
s->equiv[0] = backslash(s);
@@ -225,8 +220,7 @@
}
static int
-genrange(s)
- STR *s;
+genrange(STR *s)
{
int stopval;
char *savestart;
@@ -244,8 +238,7 @@
}
static void
-genseq(s)
- STR *s;
+genseq(STR *s)
{
char *ep;
@@ -287,8 +280,7 @@
* an escape code or a literal character.
*/
static int
-backslash(s)
- STR *s;
+backslash(STR *s)
{
int ch, cnt, val;
diff -r 18c4bcfc40fd -r 50cefc036774 usr.bin/tr/tr.c
--- a/usr.bin/tr/tr.c Tue Sep 06 18:33:18 2011 +0000
+++ b/usr.bin/tr/tr.c Tue Sep 06 18:33:46 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tr.c,v 1.8 2008/07/21 14:19:27 lukem Exp $ */
+/* $NetBSD: tr.c,v 1.9 2011/09/06 18:33:46 joerg Exp $ */
/*
* Copyright (c) 1988, 1993
@@ -39,7 +39,7 @@
#if 0
static char sccsid[] = "@(#)tr.c 8.2 (Berkeley) 5/4/95";
#endif
-__RCSID("$NetBSD: tr.c,v 1.8 2008/07/21 14:19:27 lukem Exp $");
+__RCSID("$NetBSD: tr.c,v 1.9 2011/09/06 18:33:46 joerg Exp $");
#endif /* not lint */
#include <sys/types.h>
@@ -90,14 +90,11 @@
STR s1 = { STRING1, NORMAL, 0, OOBCH, { 0, OOBCH }, NULL, NULL };
STR s2 = { STRING2, NORMAL, 0, OOBCH, { 0, OOBCH }, NULL, NULL };
-int main __P((int, char **));
-static void setup __P((int *, char *, STR *, int));
-static void usage __P((void));
+static void setup(int *, char *, STR *, int);
+__dead static void usage(void);
int
-main(argc, argv)
- int argc;
- char **argv;
+main(int argc, char **argv)
{
int ch, cnt, lastch, *p;
int cflag, dflag, sflag, isstring2;
@@ -236,11 +233,7 @@
}
static void
-setup(string, arg, str, cflag)
- int *string;
- char *arg;
- STR *str;
- int cflag;
+setup(int *string, char *arg, STR *str, int cflag)
{
int cnt, *p;
@@ -254,7 +247,7 @@
}
static void
-usage()
+usage(void)
{
(void)fprintf(stderr, "usage: tr [-cs] string1 string2\n");
(void)fprintf(stderr, " tr [-c] -d string1\n");
Home |
Main Index |
Thread Index |
Old Index