mirror of
https://salsa.debian.org/srivasta/make-dfsg.git
synced 2025-02-07 13:03:08 +00:00
Enhance/fix VMS multi-line support.
* job.c: split the command line at a newline. * default.c, vmsjobs.c: change ECHO variable to a pseudo builtin, which ensures that the VMS/DCL ECHO ("write sys$output") is used and is correctly quoted. * vmsjobs.c: remove unused builtin 'rm'.
This commit is contained in:
parent
579ee85941
commit
f970315766
3 changed files with 55 additions and 30 deletions
|
@ -333,7 +333,7 @@ static const char *default_variables[] =
|
||||||
#endif
|
#endif
|
||||||
"CD", "builtin_cd",
|
"CD", "builtin_cd",
|
||||||
"MAKE", "make",
|
"MAKE", "make",
|
||||||
"ECHO", "write sys$$output \"",
|
"ECHO", "builtin_echo",
|
||||||
#ifdef GCC_IS_NATIVE
|
#ifdef GCC_IS_NATIVE
|
||||||
"C++", "gcc/plus",
|
"C++", "gcc/plus",
|
||||||
"CXX", "gcc/plus",
|
"CXX", "gcc/plus",
|
||||||
|
|
23
job.c
23
job.c
|
@ -1,5 +1,5 @@
|
||||||
/* Job execution and handling for GNU Make.
|
/* Job execution and handling for GNU Make.
|
||||||
Copyright (C) 1988-2013 Free Software Foundation, Inc.
|
Copyright (C) 1988-2014 Free Software Foundation, Inc.
|
||||||
This file is part of GNU Make.
|
This file is part of GNU Make.
|
||||||
|
|
||||||
GNU Make is free software; you can redistribute it and/or modify it under the
|
GNU Make is free software; you can redistribute it and/or modify it under the
|
||||||
|
@ -1214,6 +1214,27 @@ start_job_command (struct child *child)
|
||||||
char *end = 0;
|
char *end = 0;
|
||||||
#ifdef VMS
|
#ifdef VMS
|
||||||
argv = 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
|
||||||
|
of strings) which contains the complete command line, which for
|
||||||
|
multi-line variables still includes the newlines. So detect newlines
|
||||||
|
and set 'end' (which is used for child->command_ptr) instead of
|
||||||
|
(re-)writing construct_command_argv */
|
||||||
|
{
|
||||||
|
char *s = p;
|
||||||
|
int instring = 0;
|
||||||
|
while (*s)
|
||||||
|
{
|
||||||
|
if (*s == '"')
|
||||||
|
instring = !instring;
|
||||||
|
else if (*s == '\n' && !instring)
|
||||||
|
{
|
||||||
|
end = s;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
++s;
|
||||||
|
}
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
argv = construct_command_argv (p, &end, child->file,
|
argv = construct_command_argv (p, &end, child->file,
|
||||||
child->file->cmds->lines_flags[child->command_line - 1],
|
child->file->cmds->lines_flags[child->command_line - 1],
|
||||||
|
|
60
vmsjobs.c
60
vmsjobs.c
|
@ -1,7 +1,7 @@
|
||||||
/* --------------- Moved here from job.c ---------------
|
/* --------------- Moved here from job.c ---------------
|
||||||
This file must be #included in job.c, as it accesses static functions.
|
This file must be #included in job.c, as it accesses static functions.
|
||||||
|
|
||||||
Copyright (C) 1996-2013 Free Software Foundation, Inc.
|
Copyright (C) 1996-2014 Free Software Foundation, Inc.
|
||||||
This file is part of GNU Make.
|
This file is part of GNU Make.
|
||||||
|
|
||||||
GNU Make is free software; you can redistribute it and/or modify it under the
|
GNU Make is free software; you can redistribute it and/or modify it under the
|
||||||
|
@ -431,36 +431,40 @@ child_execute_job (char *argv, struct child *child)
|
||||||
else
|
else
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else if ((*(p) == 'r')
|
else if ((*(p) == 'e')
|
||||||
&& (*(p+1) == 'm')
|
&& (*(p+1) == 'c')
|
||||||
&& ((*(p+2) == ' ') || (*(p+2) == '\t')))
|
&& (*(p+2) == 'h')
|
||||||
|
&& (*(p+3) == 'o')
|
||||||
|
&& ((*(p+4) == ' ') || (*(p+4) == '\t') || (*(p+4) == '\0')))
|
||||||
{
|
{
|
||||||
int in_arg;
|
/* This is not a real builtin, it is a built in pre-processing
|
||||||
|
for the VMS/DCL echo (write sys$output) to ensure the to be echoed
|
||||||
/* rm */
|
string is correctly quoted (with the DCL quote character '"'). */
|
||||||
p += 3;
|
#define VMS_EMPTY_ECHO "$ write sys$output \"\""
|
||||||
while ((*p == ' ') || (*p == '\t'))
|
char *vms_echo;
|
||||||
p++;
|
p += 4;
|
||||||
in_arg = 1;
|
if (*p == '\0')
|
||||||
|
|
||||||
DB (DB_JOBS, (_("BUILTIN RM %s\n"), p));
|
|
||||||
while (*p)
|
|
||||||
{
|
{
|
||||||
switch (*p)
|
cmd = VMS_EMPTY_ECHO;
|
||||||
{
|
|
||||||
case ' ':
|
|
||||||
case '\t':
|
|
||||||
if (in_arg)
|
|
||||||
{
|
|
||||||
*p++ = ';';
|
|
||||||
in_arg = 0;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
p++;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
p++;
|
||||||
|
while ((*p == ' ') || (*p == '\t'))
|
||||||
|
p++;
|
||||||
|
if (*p == '\0')
|
||||||
|
cmd = VMS_EMPTY_ECHO;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
vms_echo = alloca(strlen(p) + sizeof VMS_EMPTY_ECHO);
|
||||||
|
strcpy(vms_echo, VMS_EMPTY_ECHO);
|
||||||
|
vms_echo[sizeof VMS_EMPTY_ECHO - 2] = '\0';
|
||||||
|
strcat(vms_echo, p);
|
||||||
|
strcat(vms_echo, "\"");
|
||||||
|
cmd = vms_echo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
DB(DB_JOBS, (_("BUILTIN ECHO %s\n"), p));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue