Module Name:    src
Committed By:   rillig
Date:           Fri Oct 30 07:19:30 UTC 2020

Modified Files:
        src/usr.bin/make: cond.c job.c main.c make.h parse.c targ.c var.c

Log Message:
make(1): rename VAR_CMD to VAR_CMDLINE

Since make has to do with both the command line and child commands, the
former name was confusing.


To generate a diff of this commit:
cvs rdiff -u -r1.169 -r1.170 src/usr.bin/make/cond.c
cvs rdiff -u -r1.293 -r1.294 src/usr.bin/make/job.c
cvs rdiff -u -r1.409 -r1.410 src/usr.bin/make/main.c
cvs rdiff -u -r1.175 -r1.176 src/usr.bin/make/make.h
cvs rdiff -u -r1.410 -r1.411 src/usr.bin/make/parse.c
cvs rdiff -u -r1.125 -r1.126 src/usr.bin/make/targ.c
cvs rdiff -u -r1.593 -r1.594 src/usr.bin/make/var.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/cond.c
diff -u src/usr.bin/make/cond.c:1.169 src/usr.bin/make/cond.c:1.170
--- src/usr.bin/make/cond.c:1.169	Mon Oct 26 21:34:10 2020
+++ src/usr.bin/make/cond.c	Fri Oct 30 07:19:30 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cond.c,v 1.169 2020/10/26 21:34:10 rillig Exp $	*/
+/*	$NetBSD: cond.c,v 1.170 2020/10/30 07:19:30 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -93,7 +93,7 @@
 #include "dir.h"
 
 /*	"@(#)cond.c	8.2 (Berkeley) 1/2/94"	*/
-MAKE_RCSID("$NetBSD: cond.c,v 1.169 2020/10/26 21:34:10 rillig Exp $");
+MAKE_RCSID("$NetBSD: cond.c,v 1.170 2020/10/30 07:19:30 rillig Exp $");
 
 /*
  * The parsing of conditional expressions is based on this grammar:
@@ -246,7 +246,8 @@ ParseFuncArg(const char **pp, Boolean do
 	    void *nestedVal_freeIt;
 	    VarEvalFlags eflags = VARE_UNDEFERR | (doEval ? VARE_WANTRES : 0);
 	    const char *nestedVal;
-	    (void)Var_Parse(&p, VAR_CMD, eflags, &nestedVal, &nestedVal_freeIt);
+	    (void)Var_Parse(&p, VAR_CMDLINE, eflags, &nestedVal,
+			    &nestedVal_freeIt);
 	    /* TODO: handle errors */
 	    Buf_AddStr(&argBuf, nestedVal);
 	    free(nestedVal_freeIt);
@@ -283,7 +284,7 @@ static Boolean
 FuncDefined(size_t argLen MAKE_ATTR_UNUSED, const char *arg)
 {
     char *freeIt;
-    Boolean result = Var_Value(arg, VAR_CMD, &freeIt) != NULL;
+    Boolean result = Var_Value(arg, VAR_CMDLINE, &freeIt) != NULL;
     bmake_free(freeIt);
     return result;
 }
@@ -443,7 +444,8 @@ CondParser_String(CondParser *par, Boole
 		     (doEval ? VARE_WANTRES : 0);
 	    nested_p = par->p;
 	    atStart = nested_p == start;
-	    parseResult = Var_Parse(&nested_p, VAR_CMD, eflags, &str, freeIt);
+	    parseResult = Var_Parse(&nested_p, VAR_CMDLINE, eflags, &str,
+				    freeIt);
 	    /* TODO: handle errors */
 	    if (str == var_Error) {
 		if (parseResult & VPR_ANY_MSG)
@@ -683,7 +685,7 @@ ParseEmptyArg(const char **linePtr, Bool
     *argPtr = NULL;
 
     (*linePtr)--;		/* Make (*linePtr)[1] point to the '('. */
-    (void)Var_Parse(linePtr, VAR_CMD, doEval ? VARE_WANTRES : 0,
+    (void)Var_Parse(linePtr, VAR_CMDLINE, doEval ? VARE_WANTRES : 0,
 		    &val, &val_freeIt);
     /* TODO: handle errors */
     /* If successful, *linePtr points beyond the closing ')' now. */

Index: src/usr.bin/make/job.c
diff -u src/usr.bin/make/job.c:1.293 src/usr.bin/make/job.c:1.294
--- src/usr.bin/make/job.c:1.293	Mon Oct 26 23:28:52 2020
+++ src/usr.bin/make/job.c	Fri Oct 30 07:19:30 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: job.c,v 1.293 2020/10/26 23:28:52 rillig Exp $	*/
+/*	$NetBSD: job.c,v 1.294 2020/10/30 07:19:30 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -143,7 +143,7 @@
 #include "trace.h"
 
 /*	"@(#)job.c	8.2 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: job.c,v 1.293 2020/10/26 23:28:52 rillig Exp $");
+MAKE_RCSID("$NetBSD: job.c,v 1.294 2020/10/30 07:19:30 rillig Exp $");
 
 /* A shell defines how the commands are run.  All commands for a target are
  * written into a single file, which is then given to the shell to execute
@@ -2059,7 +2059,7 @@ Shell_Init(void)
 #endif
 	shellPath = str_concat3(_PATH_DEFSHELLDIR, "/", shellName);
     }
-    Var_Set_with_flags(".SHELL", shellPath, VAR_CMD, VAR_SET_READONLY);
+    Var_Set_with_flags(".SHELL", shellPath, VAR_CMDLINE, VAR_SET_READONLY);
     if (commandShell->exit == NULL) {
 	commandShell->exit = "";
     }

Index: src/usr.bin/make/main.c
diff -u src/usr.bin/make/main.c:1.409 src/usr.bin/make/main.c:1.410
--- src/usr.bin/make/main.c:1.409	Wed Oct 28 03:21:25 2020
+++ src/usr.bin/make/main.c	Fri Oct 30 07:19:30 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.409 2020/10/28 03:21:25 rillig Exp $	*/
+/*	$NetBSD: main.c,v 1.410 2020/10/30 07:19:30 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -118,7 +118,7 @@
 #include "trace.h"
 
 /*	"@(#)main.c	8.3 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: main.c,v 1.409 2020/10/28 03:21:25 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.410 2020/10/30 07:19:30 rillig Exp $");
 #if defined(MAKE_NATIVE) && !defined(lint)
 __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
 	    "The Regents of the University of California.  "
@@ -649,7 +649,7 @@ rearg:
 	for (; argc > 1; ++argv, --argc) {
 		VarAssign var;
 		if (Parse_IsVar(argv[1], &var)) {
-			Parse_DoVar(&var, VAR_CMD);
+			Parse_DoVar(&var, VAR_CMDLINE);
 		} else {
 			if (!*argv[1])
 				Punt("illegal (null) argument.");
@@ -743,7 +743,7 @@ static Boolean
 Main_SetVarObjdir(const char *var, const char *suffix)
 {
 	char *path_freeIt;
-	const char *path = Var_Value(var, VAR_CMD, &path_freeIt);
+	const char *path = Var_Value(var, VAR_CMDLINE, &path_freeIt);
 	const char *xpath;
 	char *xpath_freeIt;
 
@@ -1036,12 +1036,12 @@ HandlePWD(const struct stat *curdir_st)
 	if (ignorePWD || (pwd = getenv("PWD")) == NULL)
 		return;
 
-	if (Var_Value("MAKEOBJDIRPREFIX", VAR_CMD, &prefix_freeIt) != NULL) {
+	if (Var_Value("MAKEOBJDIRPREFIX", VAR_CMDLINE, &prefix_freeIt) != NULL) {
 		bmake_free(prefix_freeIt);
 		return;
 	}
 
-	makeobjdir = Var_Value("MAKEOBJDIR", VAR_CMD, &makeobjdir_freeIt);
+	makeobjdir = Var_Value("MAKEOBJDIR", VAR_CMDLINE, &makeobjdir_freeIt);
 	if (makeobjdir != NULL && strchr(makeobjdir, '$') != NULL)
 		goto ignore_pwd;
 
@@ -1236,10 +1236,10 @@ static void
 InitVpath(void)
 {
 	char *vpath, savec, *path;
-	if (!Var_Exists("VPATH", VAR_CMD))
+	if (!Var_Exists("VPATH", VAR_CMDLINE))
 		return;
 
-	(void)Var_Subst("${VPATH}", VAR_CMD, VARE_WANTRES, &vpath);
+	(void)Var_Subst("${VPATH}", VAR_CMDLINE, VARE_WANTRES, &vpath);
 	/* TODO: handle errors */
 	path = vpath;
 	do {
@@ -1272,7 +1272,7 @@ ReadMakefiles(void)
 	} else {
 		char *p1;
 		(void)Var_Subst("${" MAKEFILE_PREFERENCE "}",
-				VAR_CMD, VARE_WANTRES, &p1);
+				VAR_CMDLINE, VARE_WANTRES, &p1);
 		/* TODO: handle errors */
 		(void)str2Lst_Append(opts.makefiles, p1, NULL);
 		(void)Lst_ForEachUntil(opts.makefiles,
@@ -1426,7 +1426,7 @@ main(int argc, char **argv)
 	Var_Set("MFLAGS", "", VAR_GLOBAL);
 	Var_Set(".ALLTARGETS", "", VAR_GLOBAL);
 	/* some makefiles need to know this */
-	Var_Set(MAKE_LEVEL ".ENV", MAKE_LEVEL_ENV, VAR_CMD);
+	Var_Set(MAKE_LEVEL ".ENV", MAKE_LEVEL_ENV, VAR_CMDLINE);
 
 	/*
 	 * Set some other useful macros
@@ -1530,7 +1530,7 @@ main(int argc, char **argv)
 	if (!opts.noBuiltins || !opts.printVars) {
 	    /* ignore /dev/null and anything starting with "no" */
 	    (void)Var_Subst("${.MAKE.DEPENDFILE:N/dev/null:Nno*:T}",
-		VAR_CMD, VARE_WANTRES, &makeDependfile);
+			    VAR_CMDLINE, VARE_WANTRES, &makeDependfile);
 	    if (makeDependfile[0] != '\0') {
 		/* TODO: handle errors */
 		doing_depend = TRUE;
@@ -2127,7 +2127,7 @@ Main_ExportMAKEFLAGS(Boolean first)
     once = FALSE;
 
     expr = "${.MAKEFLAGS} ${.MAKEOVERRIDES:O:u:@v@$v=${$v:Q}@}";
-    (void)Var_Subst(expr, VAR_CMD, VARE_WANTRES, &s);
+    (void)Var_Subst(expr, VAR_CMDLINE, VARE_WANTRES, &s);
     /* TODO: handle errors */
     if (s[0] != '\0') {
 #ifdef POSIX

Index: src/usr.bin/make/make.h
diff -u src/usr.bin/make/make.h:1.175 src/usr.bin/make/make.h:1.176
--- src/usr.bin/make/make.h:1.175	Wed Oct 28 03:21:25 2020
+++ src/usr.bin/make/make.h	Fri Oct 30 07:19:30 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: make.h,v 1.175 2020/10/28 03:21:25 rillig Exp $	*/
+/*	$NetBSD: make.h,v 1.176 2020/10/30 07:19:30 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -362,7 +362,7 @@ typedef struct GNode {
     /* The "local" variables that are specific to this target and this target
      * only, such as $@, $<, $?.
      *
-     * Also used for the global variable scopes VAR_GLOBAL, VAR_CMD,
+     * Also used for the global variable scopes VAR_GLOBAL, VAR_CMDLINE,
      * VAR_INTERNAL, which contain variables with arbitrary names. */
     HashTable context;
 
@@ -435,7 +435,7 @@ extern GNode	*VAR_INTERNAL;	/* Variables
 				 */
 extern GNode    *VAR_GLOBAL;	/* Variables defined in a global context, e.g
 				 * in the Makefile itself */
-extern GNode    *VAR_CMD;	/* Variables defined on the command line */
+extern GNode    *VAR_CMDLINE;	/* Variables defined on the command line */
 extern char	var_Error[];	/* Value returned by Var_Parse when an error
 				 * is encountered. It actually points to
 				 * an empty string, so naive callers needn't

Index: src/usr.bin/make/parse.c
diff -u src/usr.bin/make/parse.c:1.410 src/usr.bin/make/parse.c:1.411
--- src/usr.bin/make/parse.c:1.410	Thu Oct 29 20:37:47 2020
+++ src/usr.bin/make/parse.c	Fri Oct 30 07:19:30 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: parse.c,v 1.410 2020/10/29 20:37:47 rillig Exp $	*/
+/*	$NetBSD: parse.c,v 1.411 2020/10/30 07:19:30 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -117,7 +117,7 @@
 #include "pathnames.h"
 
 /*	"@(#)parse.c	8.3 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: parse.c,v 1.410 2020/10/29 20:37:47 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.411 2020/10/30 07:19:30 rillig Exp $");
 
 /* types and constants */
 
@@ -741,7 +741,7 @@ ParseMessage(const char *directive)
 	return FALSE;		/* missing argument */
 
     cpp_skip_whitespace(&p);
-    (void)Var_Subst(p, VAR_CMD, VARE_WANTRES, &arg);
+    (void)Var_Subst(p, VAR_CMDLINE, VARE_WANTRES, &arg);
     /* TODO: handle errors */
 
     Parse_Error(mtype, "%s", arg);
@@ -1063,7 +1063,7 @@ ParseDependencyTargetWord(/*const*/ char
 	    const char *nested_val;
 	    void *freeIt;
 
-	    (void)Var_Parse(&nested_p, VAR_CMD, VARE_UNDEFERR|VARE_WANTRES,
+	    (void)Var_Parse(&nested_p, VAR_CMDLINE, VARE_UNDEFERR|VARE_WANTRES,
 			    &nested_val, &freeIt);
 	    /* TODO: handle errors */
 	    free(freeIt);
@@ -1477,7 +1477,7 @@ ParseDoDependencyTargets(char **inout_cp
 	     * went well and FALSE if there was an error in the
 	     * specification. On error, line should remain untouched.
 	     */
-	    if (!Arch_ParseArchive(&line, targets, VAR_CMD)) {
+	    if (!Arch_ParseArchive(&line, targets, VAR_CMDLINE)) {
 		Parse_Error(PARSE_FATAL,
 			    "Error in archive specification: \"%s\"", line);
 		return FALSE;
@@ -1579,7 +1579,7 @@ ParseDoDependencySourcesMundane(char *st
 
 	if (*end == '(') {
 	    GNodeList *sources = Lst_New();
-	    if (!Arch_ParseArchive(&start, sources, VAR_CMD)) {
+	    if (!Arch_ParseArchive(&start, sources, VAR_CMDLINE)) {
 		Parse_Error(PARSE_FATAL,
 			    "Error in source archive spec \"%s\"", start);
 		return FALSE;
@@ -1952,7 +1952,7 @@ VarAssign_EvalShell(const char *name, co
     cmd = uvalue;
     if (strchr(cmd, '$') != NULL) {
 	char *ecmd;
-	(void)Var_Subst(cmd, VAR_CMD, VARE_UNDEFERR|VARE_WANTRES, &ecmd);
+	(void)Var_Subst(cmd, VAR_CMDLINE, VARE_UNDEFERR | VARE_WANTRES, &ecmd);
 	/* TODO: handle errors */
 	cmd = cmd_freeIt = ecmd;
     }
@@ -2274,7 +2274,7 @@ ParseDoInclude(char *line)
      * Substitute for any variables in the file name before trying to
      * find the thing.
      */
-    (void)Var_Subst(file, VAR_CMD, VARE_WANTRES, &file);
+    (void)Var_Subst(file, VAR_CMDLINE, VARE_WANTRES, &file);
     /* TODO: handle errors */
 
     Parse_include_file(file, endc == '>', *line == 'd', silent);
@@ -2489,7 +2489,7 @@ ParseTraditionalInclude(char *line)
      * Substitute for any variables in the file name before trying to
      * find the thing.
      */
-    (void)Var_Subst(file, VAR_CMD, VARE_WANTRES, &all_files);
+    (void)Var_Subst(file, VAR_CMDLINE, VARE_WANTRES, &all_files);
     /* TODO: handle errors */
 
     if (*file == '\0') {
@@ -2539,7 +2539,7 @@ ParseGmakeExport(char *line)
     /*
      * Expand the value before putting it in the environment.
      */
-    (void)Var_Subst(value, VAR_CMD, VARE_WANTRES, &value);
+    (void)Var_Subst(value, VAR_CMDLINE, VARE_WANTRES, &value);
     /* TODO: handle errors */
 
     setenv(variable, value, 1);
@@ -3029,7 +3029,7 @@ ParseDependency(char *line)
      * It simply returns the special empty string var_Error,
      * which cannot be detected in the result of Var_Subst. */
     eflags = DEBUG(LINT) ? VARE_WANTRES : VARE_UNDEFERR | VARE_WANTRES;
-    (void)Var_Subst(line, VAR_CMD, eflags, &expanded_line);
+    (void)Var_Subst(line, VAR_CMDLINE, eflags, &expanded_line);
     /* TODO: handle errors */
 
     /* Need a fresh list for the target nodes */

Index: src/usr.bin/make/targ.c
diff -u src/usr.bin/make/targ.c:1.125 src/usr.bin/make/targ.c:1.126
--- src/usr.bin/make/targ.c:1.125	Mon Oct 26 21:34:10 2020
+++ src/usr.bin/make/targ.c	Fri Oct 30 07:19:30 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: targ.c,v 1.125 2020/10/26 21:34:10 rillig Exp $	*/
+/*	$NetBSD: targ.c,v 1.126 2020/10/30 07:19:30 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -121,7 +121,7 @@
 #include "dir.h"
 
 /*	"@(#)targ.c	8.2 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: targ.c,v 1.125 2020/10/26 21:34:10 rillig Exp $");
+MAKE_RCSID("$NetBSD: targ.c,v 1.126 2020/10/30 07:19:30 rillig Exp $");
 
 static GNodeList *allTargets;	/* the list of all targets found so far */
 #ifdef CLEANUP
@@ -538,7 +538,7 @@ Targ_PrintGraph(int pass)
     debug_printf("#*** Global Variables:\n");
     Var_Dump(VAR_GLOBAL);
     debug_printf("#*** Command-line Variables:\n");
-    Var_Dump(VAR_CMD);
+    Var_Dump(VAR_CMDLINE);
     debug_printf("\n");
     Dir_PrintDirectories();
     debug_printf("\n");

Index: src/usr.bin/make/var.c
diff -u src/usr.bin/make/var.c:1.593 src/usr.bin/make/var.c:1.594
--- src/usr.bin/make/var.c:1.593	Fri Oct 30 06:59:12 2020
+++ src/usr.bin/make/var.c	Fri Oct 30 07:19:30 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.593 2020/10/30 06:59:12 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.594 2020/10/30 07:19:30 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -129,7 +129,7 @@
 #include    "metachar.h"
 
 /*	"@(#)var.c	8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.593 2020/10/30 06:59:12 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.594 2020/10/30 07:19:30 rillig Exp $");
 
 #define VAR_DEBUG1(fmt, arg1) DEBUG1(VAR, fmt, arg1)
 #define VAR_DEBUG2(fmt, arg1, arg2) DEBUG2(VAR, fmt, arg1, arg2)
@@ -175,12 +175,12 @@ static Boolean save_dollars = TRUE;
 /*
  * Internally, variables are contained in four different contexts.
  *	1) the environment. They cannot be changed. If an environment
- *	    variable is appended to, the result is placed in the global
- *	    context.
- *	2) the global context. Variables set in the Makefile are located in
- *	    the global context.
+ *	   variable is appended to, the result is placed in the global
+ *	   context.
+ *	2) the global context. Variables set in the makefiles are located
+ *	   here.
  *	3) the command-line context. All variables set on the command line
- *	   are placed in this context. They are UNALTERABLE once placed here.
+ *	   are placed in this context.
  *	4) the local context. Each target has associated with it a context
  *	   list. On this list are located the structures describing such
  *	   local variables as $(@) and $(*)
@@ -189,10 +189,10 @@ static Boolean save_dollars = TRUE;
  */
 GNode          *VAR_INTERNAL;	/* variables from make itself */
 GNode          *VAR_GLOBAL;	/* variables from the makefile */
-GNode          *VAR_CMD;	/* variables defined on the command-line */
+GNode          *VAR_CMDLINE;	/* variables defined on the command-line */
 
 typedef enum VarFindFlags {
-    FIND_CMD		= 0x01,	/* look in VAR_CMD when searching */
+    FIND_CMD		= 0x01,	/* look in VAR_CMDLINE when searching */
     FIND_GLOBAL		= 0x02,	/* look in VAR_GLOBAL as well */
     FIND_ENV		= 0x04	/* look in the environment also */
 } VarFindFlags;
@@ -356,7 +356,7 @@ GNode_FindVar(GNode *ctxt, const char *v
  *	name		name to find
  *	ctxt		context in which to find it
  *	flags		FIND_GLOBAL	look in VAR_GLOBAL as well
- *			FIND_CMD	look in VAR_CMD as well
+ *			FIND_CMD	look in VAR_CMDLINE as well
  *			FIND_ENV	look in the environment as well
  *
  * Results:
@@ -381,13 +381,13 @@ VarFind(const char *name, GNode *ctxt, V
 
     /*
      * First look for the variable in the given context. If it's not there,
-     * look for it in VAR_CMD, VAR_GLOBAL and the environment, in that order,
+     * look for it in VAR_CMDLINE, VAR_GLOBAL and the environment, in that order,
      * depending on the FIND_* flags in 'flags'
      */
     var = GNode_FindVar(ctxt, name, nameHash);
 
-    if (var == NULL && (flags & FIND_CMD) && ctxt != VAR_CMD)
-	var = GNode_FindVar(VAR_CMD, name, nameHash);
+    if (var == NULL && (flags & FIND_CMD) && ctxt != VAR_CMDLINE)
+	var = GNode_FindVar(VAR_CMDLINE, name, nameHash);
 
     if (!opts.checkEnvFirst && var == NULL && (flags & FIND_GLOBAL) &&
 	ctxt != VAR_GLOBAL)
@@ -794,7 +794,7 @@ Var_Set_with_flags(const char *name, con
     }
 
     if (ctxt == VAR_GLOBAL) {
-	v = VarFind(name, VAR_CMD, 0);
+	v = VarFind(name, VAR_CMDLINE, 0);
 	if (v != NULL) {
 	    if (v->flags & VAR_FROM_CMD) {
 		VAR_DEBUG3("%s:%s = %s ignored!\n", ctxt->name, name, val);
@@ -811,7 +811,7 @@ Var_Set_with_flags(const char *name, con
      */
     v = VarFind(name, ctxt, 0);
     if (v == NULL) {
-	if (ctxt == VAR_CMD && !(flags & VAR_NO_EXPORT)) {
+	if (ctxt == VAR_CMDLINE && !(flags & VAR_NO_EXPORT)) {
 	    /*
 	     * This var would normally prevent the same name being added
 	     * to VAR_GLOBAL, so delete it from there if needed.
@@ -840,7 +840,7 @@ Var_Set_with_flags(const char *name, con
      * to the environment (as per POSIX standard)
      * Other than internals.
      */
-    if (ctxt == VAR_CMD && !(flags & VAR_NO_EXPORT) && name[0] != '.') {
+    if (ctxt == VAR_CMDLINE && !(flags & VAR_NO_EXPORT) && name[0] != '.') {
 	if (v == NULL) {
 	    /* we just added it */
 	    v = VarFind(name, ctxt, 0);
@@ -883,12 +883,12 @@ out:
  * Notes:
  *	The variable is searched for only in its context before being
  *	created in that context. I.e. if the context is VAR_GLOBAL,
- *	only VAR_GLOBAL->context is searched. Likewise if it is VAR_CMD, only
- *	VAR_CMD->context is searched. This is done to avoid the literally
- *	thousands of unnecessary strcmp's that used to be done to
+ *	only VAR_GLOBAL->context is searched. Likewise if it is VAR_CMDLINE,
+ *	only VAR_CMDLINE->context is searched. This is done to avoid the
+ *	literally thousands of unnecessary strcmp's that used to be done to
  *	set, say, $(@) or $(<).
  *	If the context is VAR_GLOBAL though, we check if the variable
- *	was set in VAR_CMD from the command line and skip it if so.
+ *	was set in VAR_CMDLINE from the command line and skip it if so.
  *-----------------------------------------------------------------------
  */
 void
@@ -946,7 +946,7 @@ Var_Append(const char *name, const char 
 
     if (v == NULL) {
 	Var_Set(name, val, ctxt);
-    } else if (ctxt == VAR_CMD || !(v->flags & VAR_FROM_CMD)) {
+    } else if (ctxt == VAR_CMDLINE || !(v->flags & VAR_FROM_CMD)) {
 	Buf_AddByte(&v->val, ' ');
 	Buf_AddStr(&v->val, val);
 
@@ -3328,7 +3328,7 @@ VarIsDynamic(GNode *ctxt, const char *va
 {
     if ((namelen == 1 ||
 	 (namelen == 2 && (varname[1] == 'F' || varname[1] == 'D'))) &&
-	(ctxt == VAR_CMD || ctxt == VAR_GLOBAL))
+	(ctxt == VAR_CMDLINE || ctxt == VAR_GLOBAL))
     {
 	/*
 	 * If substituting a local variable in a non-local context,
@@ -3350,7 +3350,7 @@ VarIsDynamic(GNode *ctxt, const char *va
     }
 
     if ((namelen == 7 || namelen == 8) && varname[0] == '.' &&
-	ch_isupper(varname[1]) && (ctxt == VAR_CMD || ctxt == VAR_GLOBAL))
+	ch_isupper(varname[1]) && (ctxt == VAR_CMDLINE || ctxt == VAR_GLOBAL))
     {
 	return strcmp(varname, ".TARGET") == 0 ||
 	       strcmp(varname, ".ARCHIVE") == 0 ||
@@ -3364,7 +3364,7 @@ VarIsDynamic(GNode *ctxt, const char *va
 static const char *
 UndefinedShortVarValue(char varname, const GNode *ctxt, VarEvalFlags eflags)
 {
-    if (ctxt == VAR_CMD || ctxt == VAR_GLOBAL) {
+    if (ctxt == VAR_CMDLINE || ctxt == VAR_GLOBAL) {
 	/*
 	 * If substituting a local variable in a non-local context,
 	 * assume it's for dynamic source stuff. We have to handle
@@ -3601,7 +3601,7 @@ Var_Parse(const char **pp, GNode *ctxt, 
 	 * Check also for bogus D and F forms of local variables since we're
 	 * in a local context and the name is the right length.
 	 */
-	if (v == NULL && ctxt != VAR_CMD && ctxt != VAR_GLOBAL &&
+	if (v == NULL && ctxt != VAR_CMDLINE && ctxt != VAR_GLOBAL &&
 	    namelen == 2 && (varname[1] == 'F' || varname[1] == 'D') &&
 	    strchr("@%?*!<>", varname[0]) != NULL)
 	{
@@ -3862,7 +3862,7 @@ Var_Init(void)
 {
     VAR_INTERNAL = Targ_NewGN("Internal");
     VAR_GLOBAL = Targ_NewGN("Global");
-    VAR_CMD = Targ_NewGN("Command");
+    VAR_CMDLINE = Targ_NewGN("Command");
 }
 
 /* Clean up the variables module. */

Reply via email to