From owner-freebsd-current@FreeBSD.ORG Sun Apr 11 21:57:14 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0F08B16A4CE for ; Sun, 11 Apr 2004 21:57:14 -0700 (PDT) Received: from xorpc.icir.org (xorpc.icir.org [192.150.187.68]) by mx1.FreeBSD.org (Postfix) with ESMTP id E5CB643D1F for ; Sun, 11 Apr 2004 21:57:13 -0700 (PDT) (envelope-from rizzo@icir.org) Received: from xorpc.icir.org (localhost [127.0.0.1]) by xorpc.icir.org (8.12.9p1/8.12.8) with ESMTP id i3C4vCgd085658; Sun, 11 Apr 2004 21:57:12 -0700 (PDT) (envelope-from rizzo@xorpc.icir.org) Received: (from rizzo@localhost) by xorpc.icir.org (8.12.9p1/8.12.3/Submit) id i3C4vCG0085657; Sun, 11 Apr 2004 21:57:12 -0700 (PDT) (envelope-from rizzo) Date: Sun, 11 Apr 2004 21:57:12 -0700 From: Luigi Rizzo To: current@freebsd.org Message-ID: <20040411215712.A81465@xorpc.icir.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i Subject: proposed "make" directive: .echo X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Apr 2004 04:57:14 -0000 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 @@ -252,7 +252,7 @@ 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 @@ -1589,12 +1589,12 @@ * 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); @@ -1608,7 +1608,8 @@ /* 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); } /*- @@ -2446,7 +2447,10 @@ 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;