Subject: Re: make weirdness?
To: Jason Thorpe <thorpej@OG.ORG>
From: Christos Zoulas <christos@deshaw.com>
List: port-sun3
Date: 09/12/1996 15:51:23
On Sep 12,  9:07am, thorpej@OG.ORG (Jason Thorpe) wrote:
-- Subject: make weirdness?

| "Makefile", line 34: Unassociated shell command "(${MACHINE} == "spar"
| Fatal errors encountered -- cannot continue
| ovation (thorpej) /usr/src/sbin 130% 
| 
| Since it doesn't seem to read the complete line, it seems as if 
| somthing's fishy... Also, if I setenv MACHINE to something else (like, 
| say, "amiga"), it works, because it doesn't reach the last case of the .if.

This is because there is a %.20s in the error format. Fixed that.

| Appending the continuation to the previous line (removing the '\') 
| works.

Yup..

| Before I dive into make(1) (something I'd much rather leave to the make 
| expert; HI CHRISTOS! :-), I'd like to know:

Hi Jason... No need to dive...

| 	a) Has anyone else experienced this?

Yes

| 	b) Have aliens invaded my 3/60?

No.

I am about to commit this patch.

--- parse.c.orig	Sat Mar 16 07:27:32 1996
+++ parse.c	Thu Sep 12 15:46:13 1996
@@ -2116,8 +2116,7 @@
 	 * special char.
 	 */
 	while ((c != '.') && (c != EOF)) {
-	    while (((c != '\n') || (lastc == '\\')) && (c != EOF))
-	    {
+	    while (((c != '\n') || (lastc == '\\')) && (c != EOF)) {
 		/*
 		 * Advance to next unescaped newline
 		 */
@@ -2143,10 +2142,18 @@
      */
     buf = Buf_Init (MAKE_BSIZE);
     if (c != '\n') {
+	lastc = '\0';
 	do {
-	    Buf_AddByte (buf, (Byte)c);
+	    if (lastc != '\0' && lastc != '\n')
+		Buf_AddByte (buf, (Byte) lastc);
+	    if ((lastc = c) == '\n')
+		lineno++;
 	    c = ParseReadc();
-	} while ((c != '\n') && (c != EOF));
+	    if (c == '\n' && lastc == '\\')
+		lastc = '\0';
+	} while (((c != '\n') || (lastc == '\0')) && (c != EOF));
+	if (lastc != '\0' && lastc != '\n')
+	    Buf_AddByte (buf, (Byte) lastc);
     }
     lineno++;
     
@@ -2533,7 +2540,7 @@
 			continue;
 		    } else {
 			Parse_Error (PARSE_FATAL,
-				     "Unassociated shell command \"%.20s\"",
+				     "Unassociated shell command \"%s\"",
 				     cp);
 		    }
 		}
christos