Subject: bin/13594: More stylish bin/test
To: None <gnats-bugs@gnats.netbsd.org>
From: Petri Koistinen <thoron@mb-u04ip041.mbnet.fi>
List: netbsd-bugs
Date: 07/29/2001 22:36:20
>Number:         13594
>Category:       bin
>Synopsis:       More stylish bin/test
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sun Jul 29 12:32:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Petri Koistinen
>Release:        NetBSD-current 29-Jul-2001
>Organization:
>Environment:
System: NetBSD mb-u04ip041.mbnet.fi 1.5W NetBSD 1.5W (MUURAHAISKEKO) #5: Sat Jul 21 08:56:11 EEST 2001 thoron@legoland:/usr/src/sys/arch/amiga/compile/MUURAHAISKEKO amiga
Architecture: m68k
Machine: amiga
>Description:
	Patch for more stylized bin/test tool.
>How-To-Repeat:
>Fix:
Index: test.c
===================================================================
RCS file: /cvsroot/basesrc/bin/test/test.c,v
retrieving revision 1.22
diff -u -r1.22 test.c
--- test.c	2000/04/09 23:24:59	1.22
+++ test.c	2001/07/29 19:27:57
@@ -1,4 +1,4 @@
-/*	$NetBSD: test.c,v 1.22 2000/04/09 23:24:59 christos Exp $	*/
+/* $NetBSD: test.c,v 1.22 2000/04/09 23:24:59 christos Exp $ */
 
 /*
  * test(1); version 7-like  --  author Erik Baalbergen
@@ -15,15 +15,17 @@
 __RCSID("$NetBSD: test.c,v 1.22 2000/04/09 23:24:59 christos Exp $");
 #endif
 
-#include <sys/types.h>
 #include <sys/stat.h>
-#include <unistd.h>
+#include <sys/types.h>
+
 #include <ctype.h>
+#include <err.h>
 #include <errno.h>
+#include <string.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include <string.h>
-#include <err.h>
+#include <unistd.h>
+
 #ifdef __STDC__
 #include <stdarg.h>
 #else
@@ -200,12 +202,10 @@
 int main __P((int, char **));
 
 int
-main(argc, argv)
-	int argc;
-	char **argv;
+main(int argc, char *argv[])
 #endif
 {
-	int	res;
+	int res;
 
 
 	if (strcmp(argv[0], "[") == 0) {
@@ -227,9 +227,7 @@
 }
 
 static void
-syntax(op, msg)
-	const char	*op;
-	const char	*msg;
+syntax(const char *op, const char *msg)
 {
 	if (op && *op)
 		error("%s: %s", op, msg);
@@ -238,8 +236,7 @@
 }
 
 static int
-oexpr(n)
-	enum token n;
+oexpr(enum token n)
 {
 	int res;
 
@@ -251,8 +248,7 @@
 }
 
 static int
-aexpr(n)
-	enum token n;
+aexpr(enum token n)
 {
 	int res;
 
@@ -264,8 +260,7 @@
 }
 
 static int
-nexpr(n)
-	enum token n;			/* token */
+nexpr(enum token n /* token */)
 {
 	if (n == UNOT)
 		return !nexpr(t_lex(*++t_wp));
@@ -273,8 +268,7 @@
 }
 
 static int
-primary(n)
-	enum token n;
+primary(enum token n)
 {
 	enum token nn;
 	int res;
@@ -313,7 +307,7 @@
 }
 
 static int
-binop()
+binop(void)
 {
 	const char *opnd1, *opnd2;
 	struct t_op const *op;
@@ -359,9 +353,7 @@
 }
 
 static int
-filstat(nm, mode)
-	char *nm;
-	enum token mode;
+filstat(char *nm, enum token mode)
 {
 	struct stat s;
 
@@ -409,8 +401,7 @@
 }
 
 static enum token
-t_lex(s)
-	char *s;
+t_lex(char *s)
 {
 	struct t_op const *op = ops;
 
@@ -433,7 +424,7 @@
 }
 
 static int
-isoperand()
+isoperand(void)
 {
 	struct t_op const *op = ops;
 	char *s;
@@ -454,8 +445,7 @@
 
 /* atoi with error detection */
 static int
-getn(s)
-	const char *s;
+getn(const char *s)
 {
 	char *p;
 	long r;
@@ -469,15 +459,14 @@
 	while (isspace((unsigned char)*p))
 	      p++;
 	
-	if (*p)
+	if (*p != 0)
 	      error("%s: bad number", s);
 
 	return (int) r;
 }
 
 static int
-newerf (f1, f2)
-const char *f1, *f2;
+newerf(const char *f1, const char *f2)
 {
 	struct stat b1, b2;
 
@@ -487,8 +476,7 @@
 }
 
 static int
-olderf (f1, f2)
-const char *f1, *f2;
+olderf(const char *f1, const char *f2)
 {
 	struct stat b1, b2;
 
@@ -498,8 +486,7 @@
 }
 
 static int
-equalf (f1, f2)
-const char *f1, *f2;
+equalf(const char *f1, const char *f2)
 {
 	struct stat b1, b2;
 
>Release-Note:
>Audit-Trail:
>Unformatted: