9fans archive / 1996 / 02 / 7 /    prev next

From: miller@ham... miller@ham...
Subject: mistakes in test(1)
Date: Wed, 7 Feb 1996 07:21:15 -0500

I think there are two errors in the implementation of the test command,
as shown by the following examples:

	if (test -d . -a ! -f .) echo OK
	if (test ! ! -d .) echo OK

A suggested correction:

diff /sys/src/cmd/test.c test.c

86c86
<               return(!e3());
---
>               return(!e2());
193c193
<       return(dir.mode&CHDIR);
---
>       return((dir.mode&CHDIR)!=0);

--
Richard Miller <miller@ham...>
18 Lathbury Road, Oxford OX2 7AU, England