mirror of
https://git.savannah.gnu.org/git/make.git
synced 2024-11-24 12:19:02 +00:00
Fix bs-nl handling, exit and Environment for VMS.
This fix required a complete rewrite of the command parser vmsjobs.c child_execute_job. The old parser had too many incorrect assumptions about DCL commands and could not be repaired to extended. The parser now more closely parses VMS commands and handles quoted commands and redirection. Command File mode has been improved, but can not fully support bs-nl syntax. VMS Unix shell simulation has been improved. * commands.c: vms_comma_separator is now a run-time setting. * function.c: vms_comma_separator is now a run-time setting. * function.c(func_basename_dir) now reports "[]" or "./" based on VMS crtl runtime setting. * job.c(start_job_command): VMS Handle empty commands propery. * main.c: Add VMS environment variables for run-time settings. * vms_legacy_behavior - Force older behavior. * vms_comma_separator - Commas or spaces for separators. * vms_unix_simulation - Enhanced Posix shell simulation features. * Detect if VMS CRTL is set to report Unix paths instead of VMS. * ':' and '>' are also MAP_DIRSEP on VMS. * makeint.h: Add VMS run-time option variables. * readme.vms: Update to current behavior. * variable.c(define_variable_in_set): Fix VMS Environment variable lookup. * variable.c(define_automatic_variables): Remove some VMS specific automatic variables and use the Unix ones instead. * vms_export_symbol.c: Set max symbol size correctly. * vmsjobs.c: child_execute_job() complete rewrite of VMS comand parsing. * vmsjobs.c(build_vms_cmd): VMS commmand building with shell simulation. Signed-off-by: Paul Smith <psmith@gnu.org>
This commit is contained in:
parent
1fae20a2b7
commit
e4ac28e830
9 changed files with 1319 additions and 616 deletions
190
README.VMS
190
README.VMS
|
@ -16,18 +16,72 @@ Overview: -*-text-mode-*-
|
|||
|
||||
The descriptions below are for running GNU make from DCL or equivalent.
|
||||
|
||||
|
||||
Recipe differences:
|
||||
-------------------
|
||||
|
||||
GNU Make for OpenVMS can not currently run native Unix make files because of
|
||||
differences in the implementation that it is not aware of the GNV packages.
|
||||
differences in the implementation.
|
||||
|
||||
I am trying to document the current behavior in this section. This is based
|
||||
on the information in the file NEWS. and running the test suite.
|
||||
TODO: More tests are needed to validate and demonstrate the OpenVMS
|
||||
expected behavior.
|
||||
|
||||
In some cases the older behavior of GNU Make when run from DCL is not
|
||||
compatible with standard makefile behavior.
|
||||
|
||||
This behavior can be changed when running GNU Make from DCL by setting
|
||||
either DCL symbols or logical names of the format GNV$. The settings
|
||||
are enabled with a string starting with one of '1', 'T', or 'E' for "1",
|
||||
"TRUE", or "ENABLE". They are disabled with a '0', 'F', or 'D' for "1",
|
||||
"FALSE", or "DISABLE". If they are not explicitly set to one of these
|
||||
values, then they will be set to their default values.
|
||||
|
||||
The value of the setting DECC$FILENAME_UNIX_REPORT or
|
||||
DECC$FILENAME_UNIX_ONLY will now cause the $(dir x) function to return
|
||||
'./' or '[]' as appropriate.
|
||||
|
||||
The name GNV$MAKE_OLD_VMS when enabled will cause GNU Make to behave as
|
||||
much as the older method as can be done with out disabling VMS features.
|
||||
When it is disabled GNU Make have the new behavior which more closely
|
||||
matches Unix Make behavior.
|
||||
|
||||
The default is currently the old behavior when running GNU Make from DCL.
|
||||
In the future this may change. When running make from GNV Bash the new
|
||||
behavior is the default.
|
||||
|
||||
This is a global setting that sets the default behavior for several other
|
||||
options that can be individually changed. Many of the individual settings
|
||||
are to make it so that the self tests for GNU Make need less VMS specific
|
||||
modifications.
|
||||
|
||||
The name GNV$MAKE_COMMA when enabled will cause GNU Make to expect a comma
|
||||
for a path separator and use a comma for the separator for a list of files.
|
||||
When disabled, it will cause GNU Make to use a colon for a path separator
|
||||
and a space for the separator for a list of files. The default is to be
|
||||
enabled if the GNU Make is set to the older behavior.
|
||||
|
||||
The name GNV$MAKE_SHELL_SIM when enabled will cause GNU Make to try to
|
||||
simulate a Posix shell more closely. The following behaviors occur:
|
||||
|
||||
* Single quotes are converted to double quotes and any double
|
||||
quotes inside of them are doubled. No environment variable expansion
|
||||
is simulated.
|
||||
* A exit command status will be converted to a Posix Exit
|
||||
where 0 is success and non-zero is failure.
|
||||
* The $ character will cause environment variable expansion.
|
||||
* Environent variables can be set on the command line before a command.
|
||||
|
||||
VMS generally uses logical name search lists instead of path variables
|
||||
where the resolution is handled by VMS independent of the program. Which
|
||||
means that it is likely that nothing will notice if the default path
|
||||
specifier is changed in the future.
|
||||
|
||||
Currently the built in VMS specific macros and recipes depend on the comma
|
||||
being used as a file list separator.
|
||||
TODO: Remove this dependency as other functions in GNU Make depend on a
|
||||
space being used as a separator.
|
||||
|
||||
The format for recipes are a combination of Unix macros, a subset of
|
||||
simulated UNIX commands, some shell emulation, and OpenVMS commands.
|
||||
This makes the resulting makefiles unique to the OpenVMS port of GNU make.
|
||||
|
@ -68,24 +122,45 @@ Recipe differences:
|
|||
Any macros marked as exported are temporarily created as DCL symbols
|
||||
for child images to use. DCL symbol substitution is not done with these
|
||||
commands.
|
||||
TODO: Add symbol substitution.
|
||||
Untested: Symbol substitution.
|
||||
|
||||
When a temporary DCL command file is used, DCL symbol substitution
|
||||
will work.
|
||||
|
||||
Command lines of excessive length are broken and written to a command file
|
||||
in sys$scratch:. There's no limit to the lengths of commands (and no need
|
||||
for .opt files :-) any more.
|
||||
For VMS 7.3-1 and earlier, command lines are limited to 255 characters
|
||||
or 1024 characters in a command file.
|
||||
For VMS 7.3-2 and later, command lines are limited to 4059 characters
|
||||
or 8192 characters in a command file.
|
||||
|
||||
The '<', '>' and '>>' redirection has been implemented by using
|
||||
temporary command files. These will be described later.
|
||||
VMS limits each token of a command line to 256 characters, and limits
|
||||
a command line to 127 tokens.
|
||||
|
||||
Command lines above the limit length are written to a command file
|
||||
in sys$scratch:.
|
||||
|
||||
In order to handle Unix style extensions to VMS DCL, GNU Make has
|
||||
parsed the recipe commands and them modified them as needed. The
|
||||
parser has been re-written to resolve numerous bugs in handling
|
||||
valid VMS syntax and potential buffer overruns.
|
||||
|
||||
The new parser may need whitespace characters where DCL does not require
|
||||
it, and also may require that quotes are matched were DCL forgives if
|
||||
they are not. There is a small chance that existing VMS specific makefiles
|
||||
will be affected.
|
||||
|
||||
The '<', '>' was previously implemented using command files. Now
|
||||
GNU Make will check to see if the is already a VMS "PIPE" command and
|
||||
if it is not, will convert the command to a VMS "PIPE" command.
|
||||
|
||||
The '>>' redirection has been implemented by using a temporary command file.
|
||||
This will be described later.
|
||||
|
||||
The DCL symbol or logical name GNV$MAKE_USE_CMD_FILE when set to a
|
||||
string starting with one of '1','T', or 'E' for "1", "TRUE", or "ENABLE",
|
||||
then temporary DCL command files are always used for running commands.
|
||||
In this case, the exported environment environment variables are
|
||||
created by command file. BUG: Environment variables that hold values
|
||||
with dollar signs in them are not exported correctly.
|
||||
|
||||
Some recipe strings with embedded new lines will not be handled correctly
|
||||
when a command file is used.
|
||||
|
||||
GNU Make generally does text comparisons for the targets and sources. The
|
||||
make program itself can handle either Unix or OpenVMS format filenames, but
|
||||
|
@ -106,6 +181,9 @@ Recipe differences:
|
|||
as it does on Unix.
|
||||
|
||||
The variables $^ and $@ separate files with commas instead of spaces.
|
||||
This is controlled by the name GNV$MAKE_COMMA as documented in the
|
||||
previous section.
|
||||
|
||||
While this may seem the natural thing to do with OpenVMS, it actually
|
||||
causes problems when trying to use other make functions that expect the
|
||||
files to be separated by spaces. If you run into this, you need the
|
||||
|
@ -248,43 +326,52 @@ Runtime issues:
|
|||
Unix compatibilty features:
|
||||
---------------------------
|
||||
|
||||
If the command 'echo' is seen, any single quotes on the line will be
|
||||
converted to double quotes.
|
||||
|
||||
The variable $(CD) is implemented as a built in Change Directory
|
||||
command. This invokes the 'builtin_cd' Executing a 'set default'
|
||||
recipe doesn't do the trick, since it only affects the subprocess
|
||||
spawned for that command.
|
||||
TODO: Need more info on how to use and side effects
|
||||
|
||||
The 'builtin_cd' is generally expected to be on its own line.
|
||||
The 'builtin_cd' either from the expansion of $(CD) or directly
|
||||
put in a recipe line will be executed before any other commands in
|
||||
that recipe line. DCL parameter substitution will not work for the
|
||||
'builtin_cd' command.
|
||||
|
||||
Putting a 'builtin_cd' in a pipeline or an IF-THEN line should not be
|
||||
done because the 'builtin_cd' is always executed
|
||||
and executed first. The directory change is persistent.
|
||||
|
||||
Unix shell style I/O redirection is supported. You can now write lines like:
|
||||
"<tab>mcr sys$disk:[]program.exe < input.txt > output.txt &> error.txt"
|
||||
BUG: This support is not handling built in make macros with "<" in them
|
||||
properly.
|
||||
|
||||
Posix shells have ":" as a null command. OpenVMS generates a DCL warning
|
||||
when this is encountered. It would probably be simpler to have OpenVMS just
|
||||
handle this instead of changing all the tests that use this feature.
|
||||
Posix shells have ":" as a null command. These are now handled.
|
||||
https://savannah.gnu.org/bugs/index.php?41761
|
||||
|
||||
A note on appending the redirected output. A simple mechanism is
|
||||
implemented to make ">>" work in action lines. In OpenVMS there is no simple
|
||||
feature like ">>" to have DCL command or program output redirected and
|
||||
appended to a file. GNU make for OpenVMS already implements the redirection
|
||||
of output. If such a redirection is detected, an ">" on the action line,
|
||||
GNU make creates a DCL command procedure to execute the action and to
|
||||
redirect its output. Based on that, now ">>" is also recognized and a
|
||||
similar but different command procedure is created to implement the
|
||||
append. The main idea here is to create a temporary file which collects
|
||||
the output and which is appended to the wanted output file. Then the
|
||||
temporary file is deleted. This is all done in the command procedure to
|
||||
keep changes in make small and simple. This obviously has some limitations
|
||||
but it seems good enough compared with the current ">" implementation.
|
||||
(And in my opinion, redirection is not really what GNU make has to do.)
|
||||
With this approach, it may happen that the temporary file is not yet
|
||||
appended and is left in SYS$SCRATCH.
|
||||
appended to a file. GNU make for OpenVMS implements the redirection
|
||||
of ">>" by using a command procedure.
|
||||
|
||||
The temporary file names look like "CMDxxxxx.". Any time the created
|
||||
The current algorithm creates the output file if it does not exist and
|
||||
then uses the DCL open/append to extend it. SYS$OUTPUT is then directed
|
||||
to that file.
|
||||
|
||||
The implementation supports only one redirected append output to a file
|
||||
and that redirection is done before any other commands in that line
|
||||
are executed, so it redirects all output for that command.
|
||||
|
||||
The older implementation wrote the output to a temporary file in
|
||||
in sys$scratch: and then attempted to append the file to the existing file.
|
||||
The temporary file names looked like "CMDxxxxx.". Any time the created
|
||||
command procedure can not complete, this happens. Pressing Ctrl+Y to
|
||||
abort make is one case. In case of Ctrl+Y the associated command
|
||||
procedure is left in SYS$SCRATCH as well. Its name is CMDxxxxx.COM.
|
||||
abort make is one case.
|
||||
|
||||
In case of Ctrl+Y the associated command procedure is left in SYS$SCRATCH:.
|
||||
The command procedures will be named gnv$make_cmd*.com.
|
||||
|
||||
The CtrlY handler now uses $delprc to delete all children. This way also
|
||||
actions with DCL commands will be stopped. As before the CtrlY handler
|
||||
|
@ -329,6 +416,11 @@ Unimplemented functionality:
|
|||
Self test failures and todos:
|
||||
-----------------------------
|
||||
|
||||
The test harness can not handle testing some of the VMS specific modes
|
||||
because of the features needed for to be set for the Perl to run.
|
||||
Need to find a way to set the VMS features before running make as a
|
||||
child.
|
||||
|
||||
GNU make was not currently translating the OpenVMS encoded POSIX values
|
||||
returned to it back to the Posix values. I have temporarily modified the
|
||||
Perl test script to compensate for it. This should be being handled
|
||||
|
@ -340,41 +432,9 @@ Self test failures and todos:
|
|||
GNU Make on VMS no longer claims it is implemented.
|
||||
TODO: Implement it.
|
||||
|
||||
The vpath feature may need the targets to be in OpenVMS format. To be
|
||||
consistent with other target processing, this restriction should be removed.
|
||||
TODO: Verify this after recent changes.
|
||||
|
||||
The features/vpathgpath test is failing. Reason has not yet been determined.
|
||||
|
||||
The misc/bs-nl test is failing. This is where a line is continued with a
|
||||
backslash.
|
||||
|
||||
The options/dash-e test is failing. Need to determine how to do overrides
|
||||
on VMS.
|
||||
|
||||
The options/dash-k test is failing. Test is not stopping when it should.
|
||||
|
||||
The options/dash-n test is failing. The "+" handling is not working.
|
||||
MAKEFLAG appears not to work.
|
||||
|
||||
Symlink support is not present. Symlinks are supported by OpenVMS 8.3 and
|
||||
later.
|
||||
|
||||
The targets/INTERMEDIATE and targets/SECONDARY tests are failing.
|
||||
When make deletes files, on posix platforms it writes out 'rm' and the list
|
||||
of files. On vms, only the files are writen out, one per line.
|
||||
|
||||
The variables/GNUMAKEFLAGS and variables/MAKE_RESTARTS are failing.
|
||||
|
||||
The variables/MAKEFILES test is failing. Reason not yet determined.
|
||||
|
||||
The variables/MAKEFLAGS test is failing. Looks like the child is failing.
|
||||
|
||||
The variables/automatic test is failing.
|
||||
The $^D, $^F, $+D, $+F cases are failing.
|
||||
|
||||
The variables/undefine test is failing. Undefine of multi-line define fails.
|
||||
|
||||
Error messages should be supressed with the "-" at the beginning of a line.
|
||||
On openVMS they were showing up. TODO: Is this still an issue?
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
|
|||
#endif
|
||||
|
||||
#if VMS
|
||||
# define FILE_LIST_SEPARATOR ','
|
||||
# define FILE_LIST_SEPARATOR (vms_comma_separator ? ',' : ' ')
|
||||
#else
|
||||
# define FILE_LIST_SEPARATOR ' '
|
||||
#endif
|
||||
|
|
28
function.c
28
function.c
|
@ -566,10 +566,12 @@ func_notdir_suffix (char *o, char **argv, const char *funcname)
|
|||
if (is_notdir || p >= p2)
|
||||
{
|
||||
#ifdef VMS
|
||||
o = variable_buffer_output (o, ",", 1);
|
||||
#else
|
||||
o = variable_buffer_output (o, " ", 1);
|
||||
if (vms_comma_separator)
|
||||
o = variable_buffer_output (o, ",", 1);
|
||||
else
|
||||
#endif
|
||||
o = variable_buffer_output (o, " ", 1);
|
||||
|
||||
doneany = 1;
|
||||
}
|
||||
}
|
||||
|
@ -596,7 +598,7 @@ func_basename_dir (char *o, char **argv, const char *funcname)
|
|||
int stop = MAP_DIRSEP | (is_basename ? MAP_DOT : 0) | MAP_NUL;
|
||||
#ifdef VMS
|
||||
/* As in func_notdir_suffix ... */
|
||||
char *vms_p3 = alloca(strlen(p3) + 1);
|
||||
char *vms_p3 = alloca (strlen(p3) + 1);
|
||||
int i;
|
||||
for (i = 0; p3[i]; i++)
|
||||
if (p3[i] == ',')
|
||||
|
@ -624,7 +626,12 @@ func_basename_dir (char *o, char **argv, const char *funcname)
|
|||
#endif
|
||||
else if (is_dir)
|
||||
#ifdef VMS
|
||||
o = variable_buffer_output (o, "[]", 2);
|
||||
{
|
||||
if (vms_report_unix_paths)
|
||||
o = variable_buffer_output (o, "./", 2);
|
||||
else
|
||||
o = variable_buffer_output (o, "[]", 2);
|
||||
}
|
||||
#else
|
||||
#ifndef _AMIGA
|
||||
o = variable_buffer_output (o, "./", 2);
|
||||
|
@ -637,10 +644,12 @@ func_basename_dir (char *o, char **argv, const char *funcname)
|
|||
o = variable_buffer_output (o, p2, len);
|
||||
|
||||
#ifdef VMS
|
||||
o = variable_buffer_output (o, ",", 1);
|
||||
#else
|
||||
o = variable_buffer_output (o, " ", 1);
|
||||
if (vms_comma_separator)
|
||||
o = variable_buffer_output (o, ",", 1);
|
||||
else
|
||||
#endif
|
||||
o = variable_buffer_output (o, " ", 1);
|
||||
|
||||
doneany = 1;
|
||||
}
|
||||
|
||||
|
@ -1440,12 +1449,9 @@ fold_newlines (char *buffer, unsigned int *length, int trim_newlines)
|
|||
*length = last_nonnl - buffer;
|
||||
}
|
||||
|
||||
|
||||
|
||||
pid_t shell_function_pid = 0;
|
||||
int shell_function_completed;
|
||||
|
||||
|
||||
#ifdef WINDOWS32
|
||||
/*untested*/
|
||||
|
||||
|
|
27
job.c
27
job.c
|
@ -1224,6 +1224,19 @@ start_job_command (struct child *child)
|
|||
{
|
||||
char *end = 0;
|
||||
#ifdef VMS
|
||||
/* Skip any leading whitespace */
|
||||
while (*p)
|
||||
{
|
||||
if (!isspace(*p))
|
||||
{
|
||||
if (*p != '\\')
|
||||
break;
|
||||
if ((p[1] != '\n') && (p[1] != 'n') && (p[1] != 't'))
|
||||
break;
|
||||
}
|
||||
p++;
|
||||
}
|
||||
|
||||
argv = p;
|
||||
/* Although construct_command_argv contains some code for VMS, it was/is
|
||||
not called/used. Please note, for VMS argv is a string (not an array
|
||||
|
@ -1273,9 +1286,17 @@ start_job_command (struct child *child)
|
|||
free (argv[0]);
|
||||
free (argv);
|
||||
#endif
|
||||
child->file->update_status = us_question;
|
||||
notice_finished_file (child->file);
|
||||
return;
|
||||
#ifdef VMS
|
||||
/* On VMS, argv[0] can be a null string here */
|
||||
if (argv[0] != 0)
|
||||
{
|
||||
#endif
|
||||
child->file->update_status = us_question;
|
||||
notice_finished_file (child->file);
|
||||
return;
|
||||
#ifdef VMS
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (touch_flag && !(flags & COMMANDS_RECURSE))
|
||||
|
|
126
main.c
126
main.c
|
@ -50,6 +50,37 @@ int __stack = 20000; /* Make sure we have 20K of stack space */
|
|||
#ifdef VMS
|
||||
int vms_use_mcr_command = 0;
|
||||
int vms_always_use_cmd_file = 0;
|
||||
int vms_gnv_shell = 0;
|
||||
int vms_legacy_behavior = 0;
|
||||
int vms_comma_separator = 0;
|
||||
int vms_unix_simulation = 0;
|
||||
int vms_report_unix_paths = 0;
|
||||
|
||||
/* Evaluates if a VMS environment option is set, only look at first character */
|
||||
static int
|
||||
get_vms_env_flag (const char *name, int default_value)
|
||||
{
|
||||
char * value;
|
||||
char x;
|
||||
|
||||
value = getenv (name);
|
||||
if (value == NULL)
|
||||
return default_value;
|
||||
|
||||
x = toupper (value[0]);
|
||||
switch (x)
|
||||
{
|
||||
case '1':
|
||||
case 'T':
|
||||
case 'E':
|
||||
return 1;
|
||||
break;
|
||||
case '0':
|
||||
case 'F':
|
||||
case 'D':
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void init_dir (void);
|
||||
|
@ -632,7 +663,9 @@ initialize_stopchar_map ()
|
|||
|
||||
stopchar_map[(int)'/'] = MAP_DIRSEP;
|
||||
#if defined(VMS)
|
||||
stopchar_map[(int)':'] = MAP_COLON | MAP_DIRSEP;
|
||||
stopchar_map[(int)']'] = MAP_DIRSEP;
|
||||
stopchar_map[(int)'>'] = MAP_DIRSEP;
|
||||
#elif defined(HAVE_DOS_PATHS)
|
||||
stopchar_map[(int)'\\'] = MAP_DIRSEP;
|
||||
#endif
|
||||
|
@ -1021,6 +1054,9 @@ msdos_return_to_initial_directory (void)
|
|||
}
|
||||
#endif /* __MSDOS__ */
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef _AMIGA
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
|
@ -1198,25 +1234,45 @@ main (int argc, char **argv, char **envp)
|
|||
set_program_name (argv[0]);
|
||||
program = program_name;
|
||||
{
|
||||
const char *value;
|
||||
value = getenv ("GNV$MAKE_USE_MCR");
|
||||
if (value != NULL)
|
||||
vms_use_mcr_command = 1;
|
||||
const char *shell;
|
||||
char pwdbuf[256];
|
||||
char *pwd;
|
||||
shell = getenv ("SHELL");
|
||||
if (shell != NULL)
|
||||
vms_gnv_shell = 1;
|
||||
|
||||
/* Need to know if CRTL set to report UNIX paths. Use getcwd as
|
||||
it works on all versions of VMS. */
|
||||
pwd = getcwd(pwdbuf, 256);
|
||||
if (pwd[0] == '/')
|
||||
vms_report_unix_paths = 1;
|
||||
|
||||
vms_use_mcr_command = get_vms_env_flag ("GNV$MAKE_USE_MCR", 0);
|
||||
|
||||
vms_always_use_cmd_file = get_vms_env_flag ("GNV$MAKE_USE_CMD_FILE", 0);
|
||||
|
||||
/* Legacy behavior is on VMS is older behavior that needed to be
|
||||
changed to be compatible with standard make behavior.
|
||||
For now only completely disable when running under a Bash shell.
|
||||
TODO: Update VMS built in recipes and macros to not need this
|
||||
behavior, at which time the default may change. */
|
||||
vms_legacy_behavior = get_vms_env_flag ("GNV$MAKE_OLD_VMS",
|
||||
!vms_gnv_shell);
|
||||
|
||||
/* VMS was changed to use a comma separator in the past, but that is
|
||||
incompatible with built in functions that expect space separated
|
||||
lists. Allow this to be selectively turned off. */
|
||||
vms_comma_separator = get_vms_env_flag ("GNV$MAKE_COMMA",
|
||||
vms_legacy_behavior);
|
||||
|
||||
/* Some Posix shell syntax options are incompatible with VMS syntax.
|
||||
VMS requires double quotes for strings and escapes quotes
|
||||
differently. When this option is active, VMS will try
|
||||
to simulate Posix shell simulations instead of using
|
||||
VMS DCL behavior. */
|
||||
vms_unix_simulation = get_vms_env_flag ("GNV$MAKE_SHELL_SIM",
|
||||
!vms_legacy_behavior);
|
||||
|
||||
value = getenv ("GNV$MAKE_USE_CMD_FILE");
|
||||
if (value != NULL)
|
||||
switch (value[0])
|
||||
{
|
||||
case '1':
|
||||
case 'T':
|
||||
case 't':
|
||||
case 'e':
|
||||
case 'E':
|
||||
vms_always_use_cmd_file = 1;
|
||||
break;
|
||||
default:
|
||||
vms_always_use_cmd_file = 0;
|
||||
}
|
||||
}
|
||||
if (need_vms_symbol () && !vms_use_mcr_command)
|
||||
create_foreign_command (program_name, argv[0]);
|
||||
|
@ -1683,6 +1739,9 @@ main (int argc, char **argv, char **envp)
|
|||
a reference to this hidden variable is written instead. */
|
||||
define_variable_cname ("MAKEOVERRIDES", "${-*-command-variables-*-}",
|
||||
o_env, 1);
|
||||
#ifdef VMS
|
||||
vms_export_dcl_symbol ("MAKEOVERRIDES", "${-*-command-variables-*-}");
|
||||
#endif
|
||||
}
|
||||
|
||||
/* If there were -C flags, move ourselves about. */
|
||||
|
@ -2401,9 +2460,6 @@ main (int argc, char **argv, char **envp)
|
|||
*p = alloca (40);
|
||||
sprintf (*p, "MAKE_RESTARTS=%s%u",
|
||||
OUTPUT_IS_TRACED () ? "-" : "", restarts);
|
||||
#ifdef VMS
|
||||
vms_putenv_symbol (*p);
|
||||
#endif
|
||||
restarts = 0;
|
||||
}
|
||||
}
|
||||
|
@ -2428,9 +2484,6 @@ main (int argc, char **argv, char **envp)
|
|||
sprintf (b, "MAKE_RESTARTS=%s%u",
|
||||
OUTPUT_IS_TRACED () ? "-" : "", restarts);
|
||||
putenv (b);
|
||||
#ifdef __VMS
|
||||
vms_putenv_symbol (b);
|
||||
#endif
|
||||
}
|
||||
|
||||
fflush (stdout);
|
||||
|
@ -2671,6 +2724,31 @@ handle_non_switch_argument (const char *arg, int env)
|
|||
/* Ignore plain '-' for compatibility. */
|
||||
return;
|
||||
|
||||
#ifdef VMS
|
||||
{
|
||||
/* VMS DCL quoting can result in foo="bar baz" showing up here.
|
||||
Need to remove the double quotes from the value. */
|
||||
char * eq_ptr;
|
||||
char * new_arg;
|
||||
eq_ptr = strchr (arg, '=');
|
||||
if ((eq_ptr != NULL) && (eq_ptr[1] == '"'))
|
||||
{
|
||||
int len;
|
||||
int seg1;
|
||||
int seg2;
|
||||
len = strlen(arg);
|
||||
new_arg = alloca(len);
|
||||
seg1 = eq_ptr - arg + 1;
|
||||
strncpy(new_arg, arg, (seg1));
|
||||
seg2 = len - seg1 - 1;
|
||||
strncpy(&new_arg[seg1], &eq_ptr[2], seg2);
|
||||
new_arg[seg1 + seg2] = 0;
|
||||
if (new_arg[seg1 + seg2 - 1] == '"')
|
||||
new_arg[seg1 + seg2 - 1] = 0;
|
||||
arg = new_arg;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
v = try_variable_definition (0, arg, o_command, 0);
|
||||
if (v != 0)
|
||||
{
|
||||
|
|
|
@ -213,6 +213,10 @@ unsigned int get_path_max (void);
|
|||
|
||||
extern int vms_use_mcr_command;
|
||||
extern int vms_always_use_cmd_file;
|
||||
extern int vms_gnv_shell;
|
||||
extern int vms_comma_separator;
|
||||
extern int vms_legacy_behavior;
|
||||
extern int vms_unix_simulation;
|
||||
#endif
|
||||
|
||||
#ifndef __attribute__
|
||||
|
@ -346,7 +350,7 @@ char *strsignal (int signum);
|
|||
# define PATH_SEPARATOR_CHAR ';'
|
||||
#elif !defined(PATH_SEPARATOR_CHAR)
|
||||
# if defined (VMS)
|
||||
# define PATH_SEPARATOR_CHAR ','
|
||||
# define PATH_SEPARATOR_CHAR (vms_comma_separator ? ',' : ':')
|
||||
# else
|
||||
# define PATH_SEPARATOR_CHAR ':'
|
||||
# endif
|
||||
|
|
44
variable.c
44
variable.c
|
@ -205,11 +205,39 @@ define_variable_in_set (const char *name, unsigned int length,
|
|||
var_key.name = (char *) name;
|
||||
var_key.length = length;
|
||||
var_slot = (struct variable **) hash_find_slot (&set->table, &var_key);
|
||||
v = *var_slot;
|
||||
|
||||
#ifdef VMS
|
||||
/* VMS does not populate envp[] with DCL symbols and logical names which
|
||||
historically are mapped to environent variables.
|
||||
If the variable is not yet defined, then we need to check if getenv()
|
||||
can find it. Do not do this for origin == o_env to avoid infinte
|
||||
recursion */
|
||||
if (HASH_VACANT (v) && (origin != o_env))
|
||||
{
|
||||
struct variable * vms_variable;
|
||||
char * vname = alloca (length + 1);
|
||||
char * vvalue;
|
||||
|
||||
strncpy (vname, name, length);
|
||||
vvalue = getenv(vname);
|
||||
|
||||
/* Values starting with '$' are probably foreign commands.
|
||||
We want to treat them as Shell aliases and not look them up here */
|
||||
if ((vvalue != NULL) && (vvalue[0] != '$'))
|
||||
{
|
||||
vms_variable = lookup_variable(name, length);
|
||||
/* Refresh the slot */
|
||||
var_slot = (struct variable **) hash_find_slot (&set->table,
|
||||
&var_key);
|
||||
v = *var_slot;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (env_overrides && origin == o_env)
|
||||
origin = o_env_override;
|
||||
|
||||
v = *var_slot;
|
||||
if (! HASH_VACANT (v))
|
||||
{
|
||||
if (env_overrides && v->origin == o_env)
|
||||
|
@ -450,8 +478,8 @@ lookup_variable (const char *name, unsigned int length)
|
|||
}
|
||||
|
||||
#ifdef VMS
|
||||
/* since we don't read envp[] on startup, try to get the
|
||||
variable via getenv() here. */
|
||||
/* VMS does not populate envp[] with DCL symbols and logical names which
|
||||
historically are mapped to enviroment varables and returned by getenv() */
|
||||
{
|
||||
char *vname = alloca (length + 1);
|
||||
char *value;
|
||||
|
@ -900,15 +928,7 @@ define_automatic_variables (void)
|
|||
/* Define the magic D and F variables in terms of
|
||||
the automatic variables they are variations of. */
|
||||
|
||||
#ifdef VMS
|
||||
define_variable_cname ("@D", "$(dir $@)", o_automatic, 1);
|
||||
define_variable_cname ("%D", "$(dir $%)", o_automatic, 1);
|
||||
define_variable_cname ("*D", "$(dir $*)", o_automatic, 1);
|
||||
define_variable_cname ("<D", "$(dir $<)", o_automatic, 1);
|
||||
define_variable_cname ("?D", "$(dir $?)", o_automatic, 1);
|
||||
define_variable_cname ("^D", "$(dir $^)", o_automatic, 1);
|
||||
define_variable_cname ("+D", "$(dir $+)", o_automatic, 1);
|
||||
#elif defined(__MSDOS__) || defined(WINDOWS32)
|
||||
#if defined(__MSDOS__) || defined(WINDOWS32)
|
||||
/* For consistency, remove the trailing backslash as well as slash. */
|
||||
define_variable_cname ("@D", "$(patsubst %/,%,$(patsubst %\\,%,$(dir $@)))",
|
||||
o_automatic, 1);
|
||||
|
|
|
@ -64,7 +64,11 @@ LIB$DELETE_SYMBOL (const struct dsc$descriptor_s * symbol,
|
|||
const unsigned long * table);
|
||||
|
||||
#define MAX_DCL_SYMBOL_LEN (255)
|
||||
#define MAX_DCL_SYMBOL_VALUE (1024)
|
||||
#if __CRTL_VER >= 70302000 && !defined(__VAX)
|
||||
# define MAX_DCL_SYMBOL_VALUE (8192)
|
||||
#else
|
||||
# define MAX_DCL_SYMBOL_VALUE (1024)
|
||||
#endif
|
||||
|
||||
struct dcl_symbol
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue