diff options
author | Hartmut Becker <becker.ismaning@freenet.de> | 2014-09-03 23:39:25 +0200 |
---|---|---|
committer | Paul Smith <psmith@gnu.org> | 2014-09-07 18:10:11 -0400 |
commit | dcca1b5b0ef4d84460e1dfb583f1085cc1ce5b9c (patch) | |
tree | 636485ffeb8222a8316b46a83584948baef4b1c1 /vmsjobs.c | |
parent | 9cad73ad8289b5cac45cc0f3ddb07977dbdb0f14 (diff) | |
download | gunmake-dcca1b5b0ef4d84460e1dfb583f1085cc1ce5b9c.tar.gz |
Enhance VMS exporting make environment variables.
* config.h-vms.template: add feature macro USE_DCL_COM_FILE to always
write a DCL command file, enabled by default.
* vmsjobs.c: with USE_DCL_COM_FILE enabled write make variables as DCL
symbol assignments into the command file. This enables printing
directory and make level info for recursive use of make. This also
enables forced DCL symbol substitution in the actions.
Diffstat (limited to 'vmsjobs.c')
-rw-r--r-- | vmsjobs.c | 29 |
1 files changed, 28 insertions, 1 deletions
@@ -613,14 +613,24 @@ child_execute_job (char *argv, struct child *child) cmd = tmp_cmd; } + +#ifdef USE_DCL_COM_FILE + /* Enforce the creation of a command file. + Then all the make environment variables are written as DCL symbol + assignments into the command file as well, so that they are visible + in the sub-process but do not affect the current process. + Further, this way DCL reads the input stream and therefore does + 'forced' symbol substitution, which it doesn't do for one-liners when + they are 'lib$spawn'ed. */ +#else /* Create a *.com file if either the command is too long for lib$spawn, or the command contains a newline, or if redirection is desired. Forcing commands with newlines into DCLs allows to store search lists on user mode logicals. */ - if (strlen (cmd) > MAXCMDLEN || (have_redirection != 0) || (have_newline != 0)) +#endif { FILE *outfile; char c; @@ -686,6 +696,23 @@ child_execute_job (char *argv, struct child *child) DB (DB_JOBS, (_("Redirected output to %s\n"), ofile)); ofiledsc.dsc$w_length = 0; } +#ifdef USE_DCL_COM_FILE + /* Export the child environment into DCL symbols */ + if (child->environment != 0) + { + char **ep = child->environment; + char *valstr; + while (*ep != 0) + { + valstr = strchr(*ep, '='); + if (valstr == NULL) + continue; + fprintf(outfile, "$ %.*s=\"%s\"\n", valstr - *ep, *ep, + valstr + 1); + ep++; + } + } +#endif fprintf (outfile, "$ %.*s_ = f$verify(%.*s_1)\n", tmpstrlen, tmpstr, tmpstrlen, tmpstr); p = sep = q = cmd; for (c = '\n'; c; c = *q++) |