CVS commit: src/bin/test

2018-09-13 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Thu Sep 13 22:00:58 UTC 2018

Modified Files:
src/bin/test: test.c

Log Message:
Allow SMALL (and TINY) builds of test (for SMALL/TINY builds of sh)
which support only the defined modes of operation of test, to allow
the version of sh on small install media be kept as small as possible.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/bin/test/test.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/test/test.c
diff -u src/bin/test/test.c:1.42 src/bin/test/test.c:1.43
--- src/bin/test/test.c:1.42	Wed Sep 12 23:33:31 2018
+++ src/bin/test/test.c	Thu Sep 13 22:00:58 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: test.c,v 1.42 2018/09/12 23:33:31 kre Exp $ */
+/* $NetBSD: test.c,v 1.43 2018/09/13 22:00:58 kre Exp $ */
 
 /*
  * test(1); version 7-like  --  author Erik Baalbergen
@@ -12,7 +12,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: test.c,v 1.42 2018/09/12 23:33:31 kre Exp $");
+__RCSID("$NetBSD: test.c,v 1.43 2018/09/13 22:00:58 kre Exp $");
 #endif
 
 #include 
@@ -91,10 +91,13 @@ enum token {
 
 enum token_types {
 	UNOP,
-	BINOP,
+	BINOP
+#ifndef SMALL
+		,
 	BUNOP,
 	BBINOP,
 	PAREN
+#endif
 };
 
 struct t_op {
@@ -103,9 +106,11 @@ struct t_op {
 };
 
 static const struct t_op cop[] = {
+#ifndef SMALL
 	{"!",	UNOT,	BUNOP},
 	{"(",	LPAREN,	PAREN},
 	{")",	RPAREN,	PAREN},
+#endif
 	{"<",	STRLT,	BINOP},
 	{"=",	STREQ,	BINOP},
 	{">",	STRGT,	BINOP},
@@ -132,7 +137,9 @@ static const struct t_op mop2[] = {
 	{"L",	FILSYM,	UNOP},
 	{"O",	FILUID,	UNOP},
 	{"S",	FILSOCK,UNOP},
+#ifndef SMALL
 	{"a",	BAND,	BBINOP},
+#endif
 	{"b",	FILBDEV,UNOP},
 	{"c",	FILCDEV,UNOP},
 	{"d",	FILDIR,	UNOP},
@@ -142,7 +149,9 @@ static const struct t_op mop2[] = {
 	{"h",	FILSYM,	UNOP},		/* for backwards compat */
 	{"k",	FILSTCK,UNOP},
 	{"n",	STRNZ,	UNOP},
+#ifndef SMALL
 	{"o",	BOR,	BBINOP},
+#endif
 	{"p",	FILFIFO,UNOP},
 	{"r",	FILRD,	UNOP},
 	{"s",	FILGZ,	UNOP},
@@ -153,22 +162,26 @@ static const struct t_op mop2[] = {
 	{"z",	STREZ,	UNOP},
 };
 
+#ifndef SMALL
 static char **t_wp;
 static struct t_op const *t_wp_op;
+#endif
 
+#ifndef SMALL
 __dead static void syntax(const char *, const char *);
 static int oexpr(enum token);
 static int aexpr(enum token);
 static int nexpr(enum token);
-static struct t_op const *findop(const char *);
 static int primary(enum token);
 static int binop(void);
+static enum token t_lex(char *);
+static int isoperand(void);
+#endif
+static struct t_op const *findop(const char *);
 static int perform_unop(enum token, const char *);
 static int perform_binop(enum token, const char *, const char *);
 static int test_access(struct stat *, mode_t);
 static int filstat(const char *, enum token);
-static enum token t_lex(char *);
-static int isoperand(void);
 static long long getn(const char *);
 static int newerf(const char *, const char *);
 static int olderf(const char *, const char *);
@@ -292,6 +305,10 @@ main(int argc, char *argv[])
 	 * operators and operands that happen to look like operators)
 	 */
 
+#ifdef SMALL
+	error("SMALL test, no fallback usage");
+#else
+
 	t_wp = [1];
 	res = !oexpr(t_lex(*t_wp));
 
@@ -299,8 +316,10 @@ main(int argc, char *argv[])
 		syntax(*t_wp, "unexpected operator");
 
 	return res;
+#endif
 }
 
+#ifndef SMALL
 static void
 syntax(const char *op, const char *msg)
 {
@@ -310,6 +329,7 @@ syntax(const char *op, const char *msg)
 	else
 		error("%s", msg);
 }	
+#endif
 
 static int
 one_arg(const char *arg)
@@ -333,12 +353,14 @@ two_arg(const char *a1, const char *a2)
 	if (op != NULL && op->op_type == UNOP)
 		return !perform_unop(op->op_num, a2);
 
+#ifndef TINY
 	/*
 	 * an extension, but as we've entered the realm of the unspecified
 	 * we're allowed...		test ( $a )	where a=''
 	 */
 	if (a1[0] == '(' && a2[0] == ')' && (a1[1] | a2[1]) == 0)
 		return 1;
+#endif
 
 	return -1;
 }
@@ -363,8 +385,10 @@ three_arg(const char *a1, const char *a2
 		return res;
 	}
 
+#ifndef TINY
 	if (a1[0] == '(' && a3[0] == ')' && a3[1] == '\0')
 		return one_arg(a2);
+#endif
 
 	return -1;
 }
@@ -384,12 +408,15 @@ four_arg(const char *a1, const char *a2,
 		return res;
 	}
 
+#ifndef TINY
 	if (a1[0] == '(' && a4[0] == ')' && a4[1] == '\0')
 		return two_arg(a2, a3);
+#endif
 
 	return -1;
 }
 
+#ifndef SMALL
 static int
 oexpr(enum token n)
 {
@@ -456,6 +483,7 @@ primary(enum token n)
 
 	return strlen(*t_wp) > 0;
 }
+#endif /* !SMALL */
 
 static int
 perform_unop(enum token n, const char *opnd)
@@ -472,6 +500,7 @@ perform_unop(enum token n, const char *o
 	}
 }
 
+#ifndef SMALL
 static int
 binop(void)
 {
@@ -487,6 +516,7 @@ binop(void)
 		
 	return perform_binop(op->op_num, opnd1, opnd2);
 }
+#endif
 
 static int
 perform_binop(enum token op_num, const char *opnd1, const char *opnd2)
@@ -780,6 +810,7 @@ findop(const char *s)
 	}
 }
 
+#ifndef SMALL
 static enum token
 t_lex(char *s)
 {
@@ -815,6 +846,7 

CVS commit: src/bin/test

2018-09-12 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Wed Sep 12 23:33:31 UTC 2018

Modified Files:
src/bin/test: test.c

Log Message:
PR standards/34646

Make test(1) always use the POSIX "number of args" evaluation rules
when they apply.

Only fall back to the old expression evaluation when there are more
than 4 args, or when the args given cannot work as a test expression
using the POSIX rules.  That is when the result is unspecified.

Also fix old bug where a string of whitespace is considered to be a
valid number (at least one digit is needed amongst it somewhere...)

XXX pullup -8


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/bin/test/test.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/test/test.c
diff -u src/bin/test/test.c:1.41 src/bin/test/test.c:1.42
--- src/bin/test/test.c:1.41	Mon Sep  5 01:00:07 2016
+++ src/bin/test/test.c	Wed Sep 12 23:33:31 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: test.c,v 1.41 2016/09/05 01:00:07 sevan Exp $ */
+/* $NetBSD: test.c,v 1.42 2018/09/12 23:33:31 kre Exp $ */
 
 /*
  * test(1); version 7-like  --  author Erik Baalbergen
@@ -12,7 +12,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: test.c,v 1.41 2016/09/05 01:00:07 sevan Exp $");
+__RCSID("$NetBSD: test.c,v 1.42 2018/09/12 23:33:31 kre Exp $");
 #endif
 
 #include 
@@ -160,10 +160,13 @@ __dead static void syntax(const char *, 
 static int oexpr(enum token);
 static int aexpr(enum token);
 static int nexpr(enum token);
+static struct t_op const *findop(const char *);
 static int primary(enum token);
 static int binop(void);
+static int perform_unop(enum token, const char *);
+static int perform_binop(enum token, const char *, const char *);
 static int test_access(struct stat *, mode_t);
-static int filstat(char *, enum token);
+static int filstat(const char *, enum token);
 static enum token t_lex(char *);
 static int isoperand(void);
 static long long getn(const char *);
@@ -171,6 +174,11 @@ static int newerf(const char *, const ch
 static int olderf(const char *, const char *);
 static int equalf(const char *, const char *);
 
+static int one_arg(const char *);
+static int two_arg(const char *, const char *);
+static int three_arg(const char *, const char *, const char *);
+static int four_arg(const char *, const char *, const char *, const char *);
+
 #if defined(SHELL)
 extern void error(const char *, ...) __dead __printflike(1, 2);
 extern void *ckmalloc(size_t);
@@ -226,9 +234,64 @@ main(int argc, char *argv[])
 		argv[argc] = NULL;
 	}
 
-	if (argc < 2)
+	/*
+	 * POSIX defines operations of test for up to 4 args
+	 * (depending upon what the args are in some cases)
+	 *
+	 * arg count does not include the command name, (but argc does)
+	 * nor the closing ']' when the command was '[' (removed above)
+	 *
+	 * None of the following allow -a or -o as an operator (those
+	 * only apply in the evaluation of unspeicified expressions)
+	 *
+	 * Note that the xxx_arg() functions return "shell" true/false
+	 * (0 == true, 1 == false) or -1 for "unspecified case"
+	 *
+	 * Other functions return C true/false (1 == true, 0 == false)
+	 *
+	 * Hence we simply return the result from xxx_arg(), but
+	 * invert the result of oexpr() below before returning it.
+	 */
+	switch (argc - 1) {
+	case -1:		/* impossible, but never mind */
+	case 0:			/* test $awhere a=''false */
 		return 1;
 
+	case 1:			/* test "$a" */
+		return one_arg(argv[1]);		/* always works */
+
+	case 2:			/* test op "$a" */
+		res = two_arg(argv[1], argv[2]);
+		if (res >= 0)
+			return res;
+		break;
+
+	case 3:			/* test "$a" op "$b" or test ! op "$a" */
+		res = three_arg(argv[1], argv[2], argv[3]);
+		if (res >= 0)
+			return res;
+		break;
+
+	case 4:			/* test ! "$a" op "$b" or test ( op "$a" ) */
+		res = four_arg(argv[1], argv[2], argv[3], argv[4]);
+		if (res >= 0)
+			return res;
+		break;
+
+	default:
+		break;
+	}
+
+	/*
+	 * All other cases produce unspecified results
+	 * (including cases above with small arg counts where the
+	 * args are not what was expected to be seen)
+	 *
+	 * We fall back to the old method, of attempting to parse
+	 * the expr (highly ambiguous as there is no distinction between
+	 * operators and operands that happen to look like operators)
+	 */
+
 	t_wp = [1];
 	res = !oexpr(t_lex(*t_wp));
 
@@ -246,6 +309,85 @@ syntax(const char *op, const char *msg)
 		error("%s: %s", op, msg);
 	else
 		error("%s", msg);
+}	
+
+static int
+one_arg(const char *arg)
+{
+	/*
+	 * True (exit 0, so false...) if arg is not a null string
+	 * False (so exit 1, so true) if it is.
+	 */
+	return *arg == '\0';
+}
+
+static int
+two_arg(const char *a1, const char *a2)
+{
+	static struct t_op const *op;
+
+	if (a1[0] == '!' && a1[1] == 0)
+		return !one_arg(a2);
+
+	op = findop(a1);
+	if (op != NULL && op->op_type == UNOP)
+		return !perform_unop(op->op_num, a2);
+
+	/*
+	 * an extension, but as we've 

CVS commit: src/bin/test

2017-10-18 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Wed Oct 18 18:11:54 UTC 2017

Modified Files:
src/bin/test: test.1

Log Message:
Remove unnecessary Tn.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/bin/test/test.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/test/test.1
diff -u src/bin/test/test.1:1.32 src/bin/test/test.1:1.33
--- src/bin/test/test.1:1.32	Wed Oct 18 08:54:59 2017
+++ src/bin/test/test.1	Wed Oct 18 18:11:54 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: test.1,v 1.32 2017/10/18 08:54:59 kre Exp $
+.\"	$NetBSD: test.1,v 1.33 2017/10/18 18:11:54 wiz Exp $
 .\"
 .\" Copyright (c) 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -108,8 +108,7 @@ is nonzero.
 .It Fl p Ar file
 True if
 .Ar file
-exists and is a named pipe
-.Po Tn FIFO Pc .
+exists and is a named pipe (FIFO).
 .It Fl r Ar file
 True if
 .Ar file



CVS commit: src/bin/test

2017-10-18 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Wed Oct 18 08:54:59 UTC 2017

Modified Files:
src/bin/test: test.1

Log Message:
I have seen (way too often) uses of test(1) that are not defined to
actually work (but just happen to, today, and in some cases, even
that trusts to some luck.)

It has been recently pointed out to me that the man page (ie: this
file) doesn't give any real guidance to what is really acceptable,
and what is not.

The CAVEATS section does note that the grammar is ambiguous, but then
just says that test(1) implements what POSIX requires, and refers
readers to the relevant section of the POSIX standard for more details.
That is probably asking too much of the average reader...

So, add some extra information in the CAVEATS with what is defined to work,
and what should be avoided.   Not all of the POSIX rules are here, but this
might hopefully help script authors avoid some of the pitfalls.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/bin/test/test.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/test/test.1
diff -u src/bin/test/test.1:1.31 src/bin/test/test.1:1.32
--- src/bin/test/test.1:1.31	Mon Jul  3 21:33:24 2017
+++ src/bin/test/test.1	Wed Oct 18 08:54:59 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: test.1,v 1.31 2017/07/03 21:33:24 wiz Exp $
+.\"	$NetBSD: test.1,v 1.32 2017/10/18 08:54:59 kre Exp $
 .\"
 .\" Copyright (c) 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -32,7 +32,7 @@
 .\"
 .\" @(#)test.1	8.1 (Berkeley) 5/31/93
 .\"
-.Dd August 12, 2016
+.Dd October 17, 2017
 .Dt TEST 1
 .Os
 .Sh NAME
@@ -328,3 +328,57 @@ section 4.62.4,
 are evaluated consistently according to the rules specified in the
 standards document.
 All other cases are subject to the ambiguity in the command semantics.
+.Pp
+This means that
+.Nm
+should not be used with more than 4 operands
+(where the terminating
+.Cm \&]
+in the case of the
+.Nm \&[
+command does not count as an operand,)
+and that the obsolete
+.Fl a
+and
+.Fl o
+options should not be used.
+Instead invoke
+.Nm
+multiple times connected by the
+.Dq &&
+and
+.Dq ||
+operators from
+.Xr sh 1 .
+When those operators are not used, there is no need
+for the parentheses as grouping symbols, so those should also be
+avoided.
+Using
+.Xr sh 1 Ns 's
+.Cm \&!
+command instead of the equivalent operator from
+.Nm
+can also protect the script from future test enhancements.
+.Pp
+Most expressions with 3 or less operands will evaluate as expected,
+though be aware that with 3 operands,
+if the second is a known binary operator,
+that is always evaluated,
+regardless of what the other operands might suggest had been intended.
+If, and only if, the middle operand is not a defined binary operator
+is the first operand examined to see if it is
+.Cm \&!
+in which case the remaining operands are evaluated as a two operand test,
+and the result inverted.
+The only other defined three operand case is the meaningless
+degenerate case where parentheses (1st and 3rd operands)
+surround a one operand expression.
+.Pp
+With 4 operands there are just two defined cases, the first
+where the first operand is
+.Cm \&!
+in which case the result of the three operand test on the
+remaining operands is inverted,
+and the second is similar to the 3 operand case,
+the degenerate case of parentheses surrounding an (in this case)
+2 operand test expression.



CVS commit: src/bin/test

2016-08-11 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Fri Aug 12 03:17:41 UTC 2016

Modified Files:
src/bin/test: test.1

Log Message:
Document the version test first appeared.
Bump date.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/bin/test/test.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/test/test.1
diff -u src/bin/test/test.1:1.29 src/bin/test/test.1:1.30
--- src/bin/test/test.1:1.29	Fri May 27 05:50:07 2016
+++ src/bin/test/test.1	Fri Aug 12 03:17:41 2016
@@ -1,4 +1,4 @@
-.\"	$NetBSD: test.1,v 1.29 2016/05/27 05:50:07 dholland Exp $
+.\"	$NetBSD: test.1,v 1.30 2016/08/12 03:17:41 sevan Exp $
 .\"
 .\" Copyright (c) 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -32,7 +32,7 @@
 .\"
 .\" @(#)test.1	8.1 (Berkeley) 5/31/93
 .\"
-.Dd December 16, 2012
+.Dd August 12, 2016
 .Dt TEST 1
 .Os
 .Sh NAME
@@ -313,6 +313,11 @@ The
 utility implements a superset of the
 .St -p1003.2
 specification.
+.Sh HISTORY
+A
+.Nm
+utility appeared in
+.At v7 .
 .Sh CAVEATS
 The
 .Nm



CVS commit: src/bin/test

2016-05-26 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Fri May 27 05:50:07 UTC 2016

Modified Files:
src/bin/test: test.1

Log Message:
usage nit


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/bin/test/test.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/test/test.1
diff -u src/bin/test/test.1:1.28 src/bin/test/test.1:1.29
--- src/bin/test/test.1:1.28	Sun Dec 16 17:57:49 2012
+++ src/bin/test/test.1	Fri May 27 05:50:07 2016
@@ -1,4 +1,4 @@
-.\"	$NetBSD: test.1,v 1.28 2012/12/16 17:57:49 wiz Exp $
+.\"	$NetBSD: test.1,v 1.29 2016/05/27 05:50:07 dholland Exp $
 .\"
 .\" Copyright (c) 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -275,7 +275,7 @@ True if either
 .Ar expression1
 or
 .Ar expression2
-are true.
+is true.
 .It Cm \&( Ar expression Cm \&)
 True if
 .Ar expression



CVS commit: src/bin/test

2013-05-04 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Sat May  4 06:26:44 UTC 2013

Modified Files:
src/bin/test: test.c

Log Message:
test(1): Compare timestamp in nsec scale in -nt/-ot.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/bin/test/test.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/test/test.c
diff -u src/bin/test/test.c:1.39 src/bin/test/test.c:1.40
--- src/bin/test/test.c:1.39	Thu Mar 15 02:02:21 2012
+++ src/bin/test/test.c	Sat May  4 06:26:44 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: test.c,v 1.39 2012/03/15 02:02:21 joerg Exp $ */
+/* $NetBSD: test.c,v 1.40 2013/05/04 06:26:44 uebayasi Exp $ */
 
 /*
  * test(1); version 7-like  --  author Erik Baalbergen
@@ -12,7 +12,7 @@
 
 #include sys/cdefs.h
 #ifndef lint
-__RCSID($NetBSD: test.c,v 1.39 2012/03/15 02:02:21 joerg Exp $);
+__RCSID($NetBSD: test.c,v 1.40 2013/05/04 06:26:44 uebayasi Exp $);
 #endif
 
 #include sys/stat.h
@@ -694,7 +694,7 @@ newerf(const char *f1, const char *f2)
 
 	return (stat(f1, b1) == 0 
 		stat(f2, b2) == 0 
-		b1.st_mtime  b2.st_mtime);
+		timespeccmp(b1.st_mtim, b2.st_mtim, ));
 }
 
 static int
@@ -704,7 +704,7 @@ olderf(const char *f1, const char *f2)
 
 	return (stat(f1, b1) == 0 
 		stat(f2, b2) == 0 
-		b1.st_mtime  b2.st_mtime);
+		timespeccmp(b1.st_mtim, b2.st_mtim, ));
 }
 
 static int



CVS commit: src/bin/test

2012-12-16 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sun Dec 16 17:57:49 UTC 2012

Modified Files:
src/bin/test: test.1

Log Message:
- Remove unneeded consecutive argument in `.Nm' macros;
- rename `GRAMMAR AMBIGUITY' section to `CAVEATS', and move it to
  correct location;
- bump date.

From Bug Hunting.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/bin/test/test.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/test/test.1
diff -u src/bin/test/test.1:1.27 src/bin/test/test.1:1.28
--- src/bin/test/test.1:1.27	Tue Nov 10 18:19:46 2009
+++ src/bin/test/test.1	Sun Dec 16 17:57:49 2012
@@ -1,4 +1,4 @@
-.\	$NetBSD: test.1,v 1.27 2009/11/10 18:19:46 wiz Exp $
+.\	$NetBSD: test.1,v 1.28 2012/12/16 17:57:49 wiz Exp $
 .\
 .\ Copyright (c) 1991, 1993
 .\	The Regents of the University of California.  All rights reserved.
@@ -32,7 +32,7 @@
 .\
 .\ @(#)test.1	8.1 (Berkeley) 5/31/93
 .\
-.Dd November 10, 2009
+.Dd December 16, 2012
 .Dt TEST 1
 .Os
 .Sh NAME
@@ -40,13 +40,13 @@
 .Nm \[
 .Nd condition evaluation utility
 .Sh SYNOPSIS
-.Nm test
+.Nm
 .Ar expression
 .Nm \[
 .Ar expression Cm \]
 .Sh DESCRIPTION
 The
-.Nm test
+.Nm
 utility evaluates
 .Ar expression
 and, if it evaluates
@@ -55,12 +55,12 @@ it returns 1 (false).
 If
 .Ar expression
 is not given,
-.Nm test
+.Nm
 also
 returns 1 (false).
 .Pp
 All operators and flags are separate arguments to the
-.Nm test
+.Nm
 utility.
 .Pp
 The following primaries are used to construct
@@ -293,19 +293,9 @@ Note that all file tests with the except
 and
 .Fl L
 follow symbolic links and thus evaluate the test for the file pointed at.
-.Sh GRAMMAR AMBIGUITY
-The
-.Nm test
-grammar is inherently ambiguous.
-In order to assure a degree of consistency, the cases described in
-.St -p1003.2
-section 4.62.4,
-are evaluated consistently according to the rules specified in the
-standards document.
-All other cases are subject to the ambiguity in the command semantics.
 .Sh EXIT STATUS
 The
-.Nm test
+.Nm
 utility exits with one of the following values:
 .Bl -tag -width Ds
 .It 0
@@ -319,7 +309,17 @@ An error occurred.
 .El
 .Sh STANDARDS
 The
-.Nm test
+.Nm
 utility implements a superset of the
 .St -p1003.2
 specification.
+.Sh CAVEATS
+The
+.Nm
+grammar is inherently ambiguous.
+In order to assure a degree of consistency, the cases described in
+.St -p1003.2
+section 4.62.4,
+are evaluated consistently according to the rules specified in the
+standards document.
+All other cases are subject to the ambiguity in the command semantics.



CVS commit: src/bin/test

2009-05-06 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Wed May  6 08:26:43 UTC 2009

Modified Files:
src/bin/test: test.1

Log Message:
Remove leading zero in Dd argument.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/bin/test/test.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/test/test.1
diff -u src/bin/test/test.1:1.25 src/bin/test/test.1:1.26
--- src/bin/test/test.1:1.25	Tue May  5 19:04:01 2009
+++ src/bin/test/test.1	Wed May  6 08:26:43 2009
@@ -1,4 +1,4 @@
-.\	$NetBSD: test.1,v 1.25 2009/05/05 19:04:01 jschauma Exp $
+.\	$NetBSD: test.1,v 1.26 2009/05/06 08:26:43 wiz Exp $
 .\
 .\ Copyright (c) 1991, 1993
 .\	The Regents of the University of California.  All rights reserved.
@@ -32,7 +32,7 @@
 .\
 .\ @(#)test.1	8.1 (Berkeley) 5/31/93
 .\
-.Dd May 05, 2009
+.Dd May 5, 2009
 .Dt TEST 1
 .Os
 .Sh NAME



CVS commit: src/bin/test

2009-05-05 Thread Jan Schaumann
Module Name:src
Committed By:   jschauma
Date:   Tue May  5 19:04:01 UTC 2009

Modified Files:
src/bin/test: test.1

Log Message:
Note that all file tests with the exception of -h and -L follow symbolic
links and thus evaluate the test for the file pointed at.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/bin/test/test.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/test/test.1
diff -u src/bin/test/test.1:1.24 src/bin/test/test.1:1.25
--- src/bin/test/test.1:1.24	Sun Apr 12 13:52:20 2009
+++ src/bin/test/test.1	Tue May  5 19:04:01 2009
@@ -1,4 +1,4 @@
-.\	$NetBSD: test.1,v 1.24 2009/04/12 13:52:20 joerg Exp $
+.\	$NetBSD: test.1,v 1.25 2009/05/05 19:04:01 jschauma Exp $
 .\
 .\ Copyright (c) 1991, 1993
 .\	The Regents of the University of California.  All rights reserved.
@@ -32,7 +32,7 @@
 .\
 .\ @(#)test.1	8.1 (Berkeley) 5/31/93
 .\
-.Dd May 31, 1993
+.Dd May 05, 2009
 .Dt TEST 1
 .Os
 .Sh NAME
@@ -278,6 +278,12 @@
 operator has higher precedence than the
 .Fl o
 operator.
+.Pp
+Note that all file tests with the exception of
+.Fl h
+and
+.Fl L
+follow symbolic links and thus evaluate the test for the file pointed at.
 .Sh GRAMMAR AMBIGUITY
 The
 .Nm test



CVS commit: src/bin/test

2009-04-12 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Sun Apr 12 13:52:20 UTC 2009

Modified Files:
src/bin/test: test.1

Log Message:
Fix markup.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/bin/test/test.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/test/test.1
diff -u src/bin/test/test.1:1.23 src/bin/test/test.1:1.24
--- src/bin/test/test.1:1.23	Tue May 15 22:00:51 2007
+++ src/bin/test/test.1	Sun Apr 12 13:52:20 2009
@@ -1,4 +1,4 @@
-.\	$NetBSD: test.1,v 1.23 2007/05/15 22:00:51 uwe Exp $
+.\	$NetBSD: test.1,v 1.24 2009/04/12 13:52:20 joerg Exp $
 .\
 .\ Copyright (c) 1991, 1993
 .\	The Regents of the University of California.  All rights reserved.
@@ -43,7 +43,7 @@
 .Nm test
 .Ar expression
 .Nm \[
-.Ar expression Cm ]
+.Ar expression Cm \]
 .Sh DESCRIPTION
 The
 .Nm test