mirror of
https://salsa.debian.org/srivasta/make-dfsg.git
synced 2025-02-07 04:55:46 +00:00
* job.c: fix make action continuation lines.
* vmsjobs.c: fix writing DCL command files when trimming (white spaces and $ signs) especially after a split (command continuation).
This commit is contained in:
parent
bd716a1ec1
commit
b11bef0bea
2 changed files with 53 additions and 45 deletions
2
job.c
2
job.c
|
@ -1233,6 +1233,8 @@ start_job_command (struct child *child)
|
||||||
{
|
{
|
||||||
if (*s == '"')
|
if (*s == '"')
|
||||||
instring = !instring;
|
instring = !instring;
|
||||||
|
else if (*s == '\\' && !instring && *(s+1) != 0)
|
||||||
|
s++;
|
||||||
else if (*s == '\n' && !instring)
|
else if (*s == '\n' && !instring)
|
||||||
{
|
{
|
||||||
end = s;
|
end = s;
|
||||||
|
|
96
vmsjobs.c
96
vmsjobs.c
|
@ -714,68 +714,74 @@ child_execute_job (char *argv, struct child *child)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
fprintf (outfile, "$ %.*s_ = f$verify(%.*s_1)\n", tmpstrlen, tmpstr, tmpstrlen, tmpstr);
|
fprintf (outfile, "$ %.*s_ = f$verify(%.*s_1)\n", tmpstrlen, tmpstr, tmpstrlen, tmpstr);
|
||||||
|
|
||||||
|
/* TODO: give 78 a name! Whether 78 is a good number is another question.
|
||||||
|
Trim, split and write the command lines.
|
||||||
|
Splitting of a command is done after 78 output characters at an
|
||||||
|
appropriate place (after strings, after comma or space and
|
||||||
|
before slash): appending a hyphen indicates that the DCL command
|
||||||
|
is being continued.
|
||||||
|
Trimming is to skip any whitespace around - including - a
|
||||||
|
leading $ from the command to ensure writing exactly one "$ "
|
||||||
|
at the beginning of the line of the output file. Trimming is
|
||||||
|
done when a new command is seen, indicated by a '\n' (outside
|
||||||
|
of a string).
|
||||||
|
The buffer so far is written and reset, when a new command is
|
||||||
|
seen, when a split was done and at the end of the command.
|
||||||
|
Only for ONESHELL there will be several commands separated by
|
||||||
|
'\n'. But there can always be multiple continuation lines. */
|
||||||
p = sep = q = cmd;
|
p = sep = q = cmd;
|
||||||
for (c = '\n'; c; c = *q++)
|
for (c = '\n'; c; c = *q++)
|
||||||
{
|
{
|
||||||
switch (c)
|
switch (c)
|
||||||
{
|
{
|
||||||
case '\n':
|
case '\n':
|
||||||
/* At a newline, skip any whitespace around a leading $
|
if (q > p)
|
||||||
from the command and issue exactly one $ into the DCL. */
|
{
|
||||||
while (isspace ((unsigned char)*p))
|
fwrite(p, 1, q - p, outfile);
|
||||||
p++;
|
p = q;
|
||||||
if (*p == '$')
|
}
|
||||||
p++;
|
fputc('$', outfile);
|
||||||
while (isspace ((unsigned char)*p))
|
fputc(' ', outfile);
|
||||||
p++;
|
while (isspace((unsigned char) *p))
|
||||||
fwrite (p, 1, q - p, outfile);
|
p++;
|
||||||
fputc ('$', outfile);
|
if (*p == '$')
|
||||||
fputc (' ', outfile);
|
p++;
|
||||||
/* Reset variables. */
|
while (isspace((unsigned char) *p))
|
||||||
p = sep = q;
|
p++;
|
||||||
break;
|
q = sep = p;
|
||||||
|
break;
|
||||||
/* Nice places for line breaks are after strings, after
|
case '"':
|
||||||
comma or space and before slash. */
|
q = vms_handle_apos(q);
|
||||||
case '"':
|
sep = q;
|
||||||
q = vms_handle_apos (q);
|
break;
|
||||||
sep = q;
|
case ',':
|
||||||
break;
|
case ' ':
|
||||||
case ',':
|
sep = q;
|
||||||
case ' ':
|
break;
|
||||||
sep = q;
|
case '/':
|
||||||
break;
|
case '\0':
|
||||||
case '/':
|
sep = q - 1;
|
||||||
case '\0':
|
break;
|
||||||
sep = q - 1;
|
default:
|
||||||
break;
|
break;
|
||||||
default:
|
}
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (sep - p > 78)
|
if (sep - p > 78)
|
||||||
{
|
{
|
||||||
/* Enough stuff for a line. */
|
/* Enough stuff for a line. */
|
||||||
fwrite (p, 1, sep - p, outfile);
|
fwrite(p, 1, sep - p, outfile);
|
||||||
p = sep;
|
p = sep;
|
||||||
if (*sep)
|
if (*sep)
|
||||||
{
|
{
|
||||||
/* The command continues. */
|
/* The command continues. */
|
||||||
fputc ('-', outfile);
|
fputc('-', outfile);
|
||||||
}
|
}
|
||||||
fputc ('\n', outfile);
|
fputc('\n', outfile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*p)
|
if (*p)
|
||||||
{
|
{
|
||||||
/* At the end of the line, skip any whitespace around a leading $
|
|
||||||
from the command because one $ was already written into the DCL. */
|
|
||||||
while (isspace((unsigned char) *p))
|
|
||||||
p++;
|
|
||||||
if (*p == '$')
|
|
||||||
p++;
|
|
||||||
while (isspace((unsigned char) *p))
|
|
||||||
p++;
|
|
||||||
fwrite(p, 1, --q - p, outfile);
|
fwrite(p, 1, --q - p, outfile);
|
||||||
fputc('\n', outfile);
|
fputc('\n', outfile);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue