Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 23 Aug 1999 06:10:02 -0700 (PDT)
From:      Thomas Gellekum <tg@ihf.rwth-aachen.de>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: bin/13274: /bin/sh 'read' command does not work correctly
Message-ID:  <199908231310.GAA59061@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/13274; it has been noted by GNATS.

From: Thomas Gellekum <tg@ihf.rwth-aachen.de>
To: aa8vb@ipass.net
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: bin/13274: /bin/sh 'read' command does not work correctly
Date: 23 Aug 1999 14:13:38 +0200

 aa8vb@ipass.net writes:
 
 > 	Please fix /bin/sh so that the default behavior of the "read"
 > 	command is such that it merges lines ending with a trailing '\'
 >         (i.e. like it behaves now only if -e is specified).  Thanks.
 
 What's the verdict of the sh gurus? If I understand SUSV2 correctly,
 Randall is right, and the standard conforming behaviour is to continue
 reading. In that case we should kill the `-e' flag (see diffs below),
 IMHO.
 
 tg
 
 Index: miscbltin.c
 ===================================================================
 RCS file: /home/ncvs/src/bin/sh/miscbltin.c,v
 retrieving revision 1.19
 diff -u -r1.19 miscbltin.c
 --- miscbltin.c	1999/05/08 10:21:56	1.19
 +++ miscbltin.c	1999/08/23 12:30:21
 @@ -71,8 +71,7 @@
  
  
  /*
 - * The read builtin.  The -e option causes backslashes to escape the
 - * following character.
 + * The read builtin.
   *
   * This uses unbuffered input, which may be avoidable in some cases.
   */
 @@ -85,7 +84,6 @@
  	char **ap;
  	int backslash;
  	char c;
 -	int eflag;
  	char *prompt;
  	char *ifs;
  	char *p;
 @@ -98,18 +96,14 @@
  	struct termios told, tnew;
  	int tsaved;
  
 -	eflag = 0;
  	prompt = NULL;
  	tv.tv_sec = -1;
  	tv.tv_usec = 0;
 -	while ((i = nextopt("ep:t:")) != '\0') {
 +	while ((i = nextopt("p:t:")) != '\0') {
  		switch(i) {
  		case 'p':
  			prompt = optarg;
  			break;
 -		case 'e':
 -			eflag = 1;
 -			break;
  		case 't':
  			tv.tv_sec = strtol(optarg, &tvptr, 0);
  			if (tvptr == optarg)
 @@ -184,7 +178,7 @@
  				STPUTC(c, p);
  			continue;
  		}
 -		if (eflag && c == '\\') {
 +		if (c == '\\') {
  			backslash++;
  			continue;
  		}
 


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199908231310.GAA59061>