From owner-freebsd-current Sun Aug 13 16:17:54 1995 Return-Path: current-owner Received: (from majordom@localhost) by freefall.FreeBSD.org (8.6.11/8.6.6) id QAA11451 for current-outgoing; Sun, 13 Aug 1995 16:17:54 -0700 Received: from mail.cs.tu-berlin.de (mail.cs.tu-berlin.de [130.149.17.13]) by freefall.FreeBSD.org (8.6.11/8.6.6) with ESMTP id QAA11445 for ; Sun, 13 Aug 1995 16:17:45 -0700 Received: from localhost.cs.tu-berlin.de ([130.149.1.128]) by mail.cs.tu-berlin.de (8.6.12/8.6.12) with ESMTP id BAA01220 for ; Mon, 14 Aug 1995 01:10:25 +0200 Received: (from wosch@localhost) by localhost (8.6.9/8.6.9) id XAA25996; Sun, 13 Aug 1995 23:44:06 +0200 Date: Sun, 13 Aug 1995 23:44:06 +0200 From: Wolfram Schneider Message-Id: <199508132144.XAA25996@localhost> To: current@freebsd.org Subject: make(1) extension for SHELL COMMANDS Reply-to: Wolfram Schneider MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Sender: current-owner@freebsd.org Precedence: bulk from new manpage: If the first or first three characters of the command line are `@' and/or `-', and/or `!', the command is treated specially. A `@' causes the com- mand not to be echoed before it is executed. A `-' causes any non-zero exit status of the command line to be ignored. A `!' causes make to use exec and not /bin/sh. This makes live with quotes much easier. Example: date: date "+%D%M (test)\n" use /bin/sh due '(' date: !date "+%D%M (test)\n" use explicit exec. -- Wolfram Schneider http://hyperg.cs.tu-berlin.de/C~wosch --- 1.1 1995/08/13 16:54:38 +++ compat.c 1995/08/13 21:28:49 @@ -148,7 +148,8 @@ char *cmdStart; /* Start of expanded command */ register char *cp; Boolean silent, /* Don't print command */ - errCheck; /* Check errors */ + errCheck, /* Check errors */ + ForceExec; /* Don't use /bin/sh, use exec */ union wait reason; /* Reason for child's death */ int status; /* Description of child's death */ int cpid; /* Child actually found */ @@ -171,6 +172,7 @@ silent = gn->type & OP_SILENT; errCheck = !(gn->type & OP_IGNORE); + ForceExec = gn->type & OP_FORCE_EXEC; cmdNode = Lst_Member (gn->commands, (ClientData)cmd); cmdStart = Var_Subst (NULL, cmd, gn, FALSE); @@ -198,11 +200,13 @@ return(0); } - while ((*cmd == '@') || (*cmd == '-')) { + while ((*cmd == '@') || (*cmd == '-') || (*cmd == '!')) { if (*cmd == '@') { silent = TRUE; - } else { + } else if (*cmd == '-'){ errCheck = FALSE; + } else { + ForceExec = TRUE; } cmd++; } @@ -235,7 +239,16 @@ if (noExecute) { return (0); } - + + /* + * to force an exec and not /bin/sh ignore result from + * meta character checking + */ + if (ForceExec) { + while(*cp) + cp++; + } + if (*cp != '\0') { /* * If *cp isn't the null character, we hit a "meta" character and @@ -259,6 +272,18 @@ */ av = brk_string(cmd, &argc); av += 1; + if (ForceExec && DEBUG(JOB)) { + char **a = av; + + fprintf(stdout, "ForceExec %s\n", cmd); + fprintf(stdout, "execvp(\"%s\"", *av); + for(a = av; *a; a++) { + fprintf(stdout, ", \"%s\"", *a); + } + fprintf(stdout, ");\nargc: %d\n", argc); + } + + } local = TRUE; --- 1.1 1995/08/13 17:30:42 +++ job.c 1995/08/13 17:30:53 @@ -447,10 +447,10 @@ /* * Check for leading @' and -'s to control echoing and error checking. */ - while (*cmd == '@' || *cmd == '-') { + while (*cmd == '@' || *cmd == '-' || *cmd == '!') { if (*cmd == '@') { shutUp = TRUE; - } else { + } else if (*cmd == '-'){ errOff = TRUE; } cmd++; --- 1.1 1995/08/13 21:06:29 +++ make.1 1995/08/13 21:40:23 @@ -236,10 +236,12 @@ .Ql Ic :: operator is used. .Pp -If the first or first two characters of the command line are +If the first or first three characters of the command line are .Ql Ic @ and/or .Ql Ic \- , +and/or +.Ql Ic ! , the command is treated specially. A .Ql Ic @ @@ -247,6 +249,10 @@ A .Ql Ic \- causes any non-zero exit status of the command line to be ignored. +A +.Ql Ic ! +causes make to use exec and not /bin/sh. This makes live with +quotes and meta characters much easier. .Sh VARIABLE ASSIGNMENTS Variables in make are much like variables in the shell, and, by tradition, consist of all upper-case letters. --- 1.1 1995/08/13 17:08:19 +++ make.h 1995/08/13 17:08:26 @@ -179,6 +179,7 @@ * state of the -n or -t flags */ #define OP_JOIN 0x00000400 /* Target is out-of-date only if any of its * children was out-of-date */ +#define OP_FORCE_EXEC 0x00000800 /* Don't use /bin/sh, use exec */ #define OP_INVISIBLE 0x00004000 /* The node is invisible to its parents. * I.e. it doesn't show up in the parents's * local variables. */