Add a warning message if an environment variable is not found.

Instead of silently skipping the substitution we now print a warning
message if an environment variable substitution is not found.
This commit is contained in:
Cary R 2009-10-28 18:26:08 -07:00 committed by Stephen Williams
parent 4cb39f584d
commit 83aa1363ea
1 changed files with 6 additions and 1 deletions

View File

@ -19,6 +19,7 @@
# include <string.h>
# include <stdlib.h>
# include <stdio.h>
#ifdef HAVE_MALLOC_H
# include <malloc.h>
#endif
@ -48,9 +49,13 @@ char* substitutions(const char*str)
str = ep + 1;
value = getenv(name);
free(name);
if (value == 0)
fprintf(stderr, "Warning: environment variable "
"\"%s\" not found during command file "
"processing.\n", name);
free(name);
continue;
free(name);
if (strlen(value) >= (nbuf - (cp-buf))) {
size_t old_size = cp - buf;