summaryrefslogtreecommitdiffstats
path: root/usr.bin/make
diff options
context:
space:
mode:
authorharti <harti@FreeBSD.org>2005-02-17 09:01:19 +0000
committerharti <harti@FreeBSD.org>2005-02-17 09:01:19 +0000
commita83cbf6327945f8d1f236ff20d376604c4f89376 (patch)
treef4969f2420e52a0d704b88a33f17815809228257 /usr.bin/make
parent13ffa2fe13caebc8b84b3960f5c00f6f26341b76 (diff)
downloadFreeBSD-src-a83cbf6327945f8d1f236ff20d376604c4f89376.zip
FreeBSD-src-a83cbf6327945f8d1f236ff20d376604c4f89376.tar.gz
Sort out the error case that a single '$' was passed a little bit
earlier instead of mixing its handling with other cases. Submitted by: Max Okumoto <okumoto@ucsd.edu>
Diffstat (limited to 'usr.bin/make')
-rw-r--r--usr.bin/make/var.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/usr.bin/make/var.c b/usr.bin/make/var.c
index 947a5ce..1e15c67 100644
--- a/usr.bin/make/var.c
+++ b/usr.bin/make/var.c
@@ -1065,6 +1065,14 @@ Var_Parse(char *str, GNode *ctxt, Boolean err, size_t *lengthPtr,
}
}
Buf_Destroy(buf, TRUE);
+
+ } else if (str[1] == '\0') {
+ /*
+ * Error - there is only a dollar sign!
+ */
+ *lengthPtr = 1;
+ return (err ? var_Error : varNoError);
+
} else {
/*
* If it's not bounded by braces of some sort, life is much simpler.
@@ -1073,16 +1081,13 @@ Var_Parse(char *str, GNode *ctxt, Boolean err, size_t *lengthPtr,
*/
char name[2];
+ *lengthPtr = 2;
+
name[0] = str[1];
name[1] = '\0';
v = VarFind(name, ctxt, FIND_ENV | FIND_GLOBAL | FIND_CMD);
- if (v == (Var *)NULL) {
- if (str[1] != '\0')
- *lengthPtr = 2;
- else
- *lengthPtr = 1;
-
+ if (v == NULL) {
if ((ctxt == VAR_CMD) || (ctxt == VAR_GLOBAL)) {
/*
* If substituting a local variable in a non-local context,
OpenPOWER on IntegriCloud