Skip site navigation (1)Skip section navigation (2)
Date:      24 Aug 1999 09:48:01 +0200
From:      Thomas Gellekum <tg@ihf.rwth-aachen.de>
To:        Sheldon Hearn <sheldonh@uunet.co.za>
Cc:        freebsd-bugs@FreeBSD.ORG
Subject:   Re: bin/13274: /bin/sh 'read' command does not work correctly
Message-ID:  <kq67251uxa.fsf@zabagek.ihf.rwth-aachen.de>
In-Reply-To: Sheldon Hearn's message of "Mon, 23 Aug 1999 06:50:03 -0700 (PDT)"
References:  <199908231350.GAA63612@freefall.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Sheldon Hearn <sheldonh@uunet.co.za> writes:

> The following reply was made to PR bin/13274; it has been noted by GNATS.
> 
> From: Sheldon Hearn <sheldonh@uunet.co.za>
> To: freebsd-gnats-submit@freebsd.org
> Cc:  
> Subject: Re: bin/13274: /bin/sh 'read' command does not work correctly
> Date: Mon, 23 Aug 1999 15:39:35 +0200
> 
>  If you want to score OpenGroup brownie points, reverse the meaning of
>  the -e option and call it the option -r option.  The OpenGroup Single

If I don't receive any `nay's on this I'll commit it before the
weekend, followed by a MFC shortly afterwards.

tg

Index: miscbltin.c
===================================================================
RCS file: /home/ncvs/src/bin/sh/miscbltin.c,v
retrieving revision 1.18.2.1
diff -u -r1.18.2.1 miscbltin.c
--- miscbltin.c	1999/05/08 10:43:02	1.18.2.1
+++ miscbltin.c	1999/08/23 14:27:24
@@ -71,8 +71,8 @@
 
 
 /*
- * The read builtin.  The -e option causes backslashes to escape the
- * following character.
+ * The read builtin.  The -r option causes backslashes to be treated like
+ * ordinary characters.
  *
  * This uses unbuffered input, which may be avoidable in some cases.
  */
@@ -85,7 +85,7 @@
 	char **ap;
 	int backslash;
 	char c;
-	int eflag;
+	char rflag;
 	char *prompt;
 	char *ifs;
 	char *p;
@@ -98,17 +98,17 @@
 	struct termios told, tnew;
 	int tsaved;
 
-	eflag = 0;
+	rflag = 0;
 	prompt = NULL;
 	tv.tv_sec = -1;
 	tv.tv_usec = 0;
-	while ((i = nextopt("ep:t:")) != '\0') {
+	while ((i = nextopt("rp:t:")) != '\0') {
 		switch(i) {
 		case 'p':
 			prompt = optarg;
 			break;
-		case 'e':
-			eflag = 1;
+		case 'r':
+			rflag = 1;
 			break;
 		case 't':
 			tv.tv_sec = strtol(optarg, &tvptr, 0);
@@ -184,7 +184,7 @@
 				STPUTC(c, p);
 			continue;
 		}
-		if (eflag && c == '\\') {
+		if (!rflag && 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?kq67251uxa.fsf>