[net.bugs.4bsd] Bug in /bin/test in 4.2

stephen@comp.lancs.ac.uk (Stephen J. Muir) (08/07/86)

Index:	bin/test.c 4.2 [Fix]

Description:
	The "-a" and "-o" operators in the "test" command do not work when the
	left-hand expression is a single argument.
Repeat-By:
	Issue the command "test 1 -a 1".
Fix:
*** test.c.orig	Wed Aug  6 22:30:04 1986
--- test.c	Wed Aug  6 22:31:15 1986
***************
*** 107,113
  		return(EQ(nxtarg(0), ""));
  
  	p2 = nxtarg(1);
! 	if (p2==0)
  		return(!EQ(a,""));
  	if(EQ(p2, "="))
  		return(EQ(nxtarg(0), a));

--- 107,114 -----
  		return(EQ(nxtarg(0), ""));
  
  	p2 = nxtarg(1);
! 	if (p2==0 || EQ(p2,"-a") || EQ(p2,"-o")) {
! 		ap--;
  		return(!EQ(a,""));
  	}
  	if(EQ(p2, "="))
***************
*** 109,114
  	p2 = nxtarg(1);
  	if (p2==0)
  		return(!EQ(a,""));
  	if(EQ(p2, "="))
  		return(EQ(nxtarg(0), a));
  

--- 110,116 -----
  	if (p2==0 || EQ(p2,"-a") || EQ(p2,"-o")) {
  		ap--;
  		return(!EQ(a,""));
+ 	}
  	if(EQ(p2, "="))
  		return(EQ(nxtarg(0), a));
  
-- 
EMAIL:	stephen@comp.lancs.ac.uk	| Post: University of Lancaster,
UUCP:	...!mcvax!ukc!dcl-cs!stephen	|	Department of Computing,
Phone:	+44 524 65201 Ext. 4120		|	Bailrigg, Lancaster, UK.
Project:Alvey ECLIPSE Distribution	|	LA1 4YR