[comp.bugs.4bsd] echo bug in 4.{2,3}BSD /bin/csh

tonyb@tektools.UUCP (Tony Birnseth) (12/12/86)

Index: /bin/csh 4.3BSD

Description:
	Repeative echo's trim the quote bits off words.
	Quote bits should not be trimed.  Addtionally, the '-n' option
	should be valid even if it were quoted.

Repeat by:
	% repeat 3 echo '/genvmu*'
	/genvmu*
	/genvmunix
	/genvmunix

	Output should be:
	% repeat 3 echo '/genvmu*'
	/genvmu*
	/genvmu*
	/genvmu*

Fix:
	Don't trim the quote bits off words before output.
	Check for a quoted '-n' option as well.

	Apply the following diff to sh.func.c and define -DTEK_BUGS in 
	'DEFS' in the Makefile.

*** /tmp/,RCSt1027852	Thu Dec 11 17:03:03 1986
--- sh.func.c	Thu Dec 11 16:58:59 1986
***************
*** 743,748
  		v = glob(v);
  		if (v == 0)
  			bferr("No match");
  	} else
  		trim(v);
  	if (sep == ' ' && *v && !strcmp(*v, "-n"))

--- 751,768 -----
  		v = glob(v);
  		if (v == 0)
  			bferr("No match");
+ #ifdef TEK_BUGS
+ 	}
+ 	/*
+ 	 * Don't trim quote bit in case we are repeating - rdoty@tek
+ 	 * Repeat by "repeat 3 echo -n '/genvmu*'"
+ 	 * 	should produce: /genvmu*/genvmu*/genvmu*
+ 	 */
+ 	if( sep == ' ' && *v 
+ 	    && ( (*v)[0]&TRIM == '-' && (*v)[1]&TRIM == 'n' && (*v)[2]&TRIM == '\0' ) 
+ 	    || !strcmp(*v, "-n") )
+ 		nonl++, v++;
+ #else
  	} else
  		trim(v);
  	if (sep == ' ' && *v && !strcmp(*v, "-n"))
***************
*** 747,752
  		trim(v);
  	if (sep == ' ' && *v && !strcmp(*v, "-n"))
  		nonl++, v++;
  	while (cp = *v++) {
  		register int c;
  

--- 767,773 -----
  		trim(v);
  	if (sep == ' ' && *v && !strcmp(*v, "-n"))
  		nonl++, v++;
+ #endif TEK_BUGS
  	while (cp = *v++) {
  		register int c;