Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!seismo!lll-crg!mordor!sri-spam!sri-unix!hplabs!tektronix!tekgen!tektools!tonyb
From: tonyb@tektools.UUCP (Tony Birnseth)
Newsgroups: comp.bugs.4bsd
Subject: echo bug in 4.{2,3}BSD /bin/csh
Message-ID: <1987@tektools.UUCP>
Date: Thu, 11-Dec-86 23:29:29 EST
Article-I.D.: tektools.1987
Posted: Thu Dec 11 23:29:29 1986
Date-Received: Mon, 15-Dec-86 04:23:31 EST
Organization: Tektronix Inc., Beaverton, Or.
Lines: 74
Keywords: csh echo bug quote


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;