proposed "make" directive: .echo

From: Luigi Rizzo <rizzo_at_icir.org>
Date: Sun, 11 Apr 2004 21:57:12 -0700
Any objection to implemeting the '.echo' directive in "make",
similar to .error but not causing the program to abort ?

BTW, i notice that the handling of line numbers is totally
broken in .for/.endfor loops -- the line number is always
reset to 0 at the beginning of the loop

	cheers
	luigi

Index: parse.c
===================================================================
RCS file: /home/ncvs/src/usr.bin/make/parse.c,v
retrieving revision 1.22.2.1
diff -u -r1.22.2.1 parse.c
--- parse.c	26 Dec 2002 14:36:38 -0000	1.22.2.1
+++ parse.c	12 Apr 2004 04:26:56 -0000
_at__at_ -252,7 +252,7 _at__at_
 static void ParseUnreadc __P((int));
 static void ParseHasCommands __P((ClientData));
 static void ParseDoInclude __P((char *));
-static void ParseDoError __P((char *));
+static void ParseDoError __P((char *, int));
 #ifdef SYSVINCLUDE
 static void ParseTraditionalInclude __P((char *));
 #endif
_at__at_ -1589,12 +1589,12 _at__at_
  *	The input is the line minus the ".error".  We substitute variables,
  *	print the message and exit(1) or just print a warning if the ".error"
  *	directive is malformed.
+ *	Don't exit if second argument is true ('.echo' case)
  *
  *---------------------------------------------------------------------
  */
 static void
-ParseDoError(errmsg)
-    char          *errmsg;	/* error message */
+ParseDoError(char *errmsg, int is_echo)
 {
 	if (!isspace(*errmsg)) {
 		Parse_Error(PARSE_WARNING, "invalid syntax: .error%s", errmsg);
_at__at_ -1608,7 +1608,8 _at__at_
 
 	/* use fprintf/exit instead of Parse_Error to terminate immediately */
 	fprintf(stderr, "\"%s\", line %d: %s\n", fname, lineno, errmsg);
-	exit(1);
+	if (!is_echo)
+		exit(1);
 }
 
 /*-
_at__at_ -2446,7 +2447,10 _at__at_
 		    ParseDoInclude (cp + 7);
 		    goto nextLine;
 		} else if (strncmp (cp, "error", 5) == 0) {
-		    ParseDoError(cp + 5);
+		    ParseDoError(cp + 5, 0);
+	            goto nextLine;	    
+		} else if (strncmp (cp, "echo", 4) == 0) {
+		    ParseDoError(cp + 4, 1);
 	            goto nextLine;	    
 		} else if (strncmp(cp, "undef", 5) == 0) {
 		    char *cp2;
Received on Sun Apr 11 2004 - 19:57:14 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:50 UTC