summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/weave.ch
diff options
context:
space:
mode:
authorAndreas Scherer <andreas_tex@freenet.de>2022-03-02 12:21:24 +0000
committerAndreas Scherer <andreas_tex@freenet.de>2022-03-02 12:21:24 +0000
commit7dadfea71b290543fa374fbd1f5e83ec7101f4d8 (patch)
tree45f91b6e17ef2707e721df15fec8a09c164e1cfa /Build/source/texk/web2c/weave.ch
parentbc2dcf1986356357fc6ea795ee5b7147b1286c2d (diff)
[WEB] Optional output file name.
The original WEB programs had fixed arguments on the commandline, i.e., you had to invoke TANGLE with four file name arguments and WEAVE with three (where '/dev/null' was permitted as an empty file). This change makes the WEB programs a little bit like the CWEB programs by allowing an optional third file name argument for the main output file (the name of the .pool file still is created from the .web file). And '-' is interpreted as an empty change file. git-svn-id: svn://tug.org/texlive/trunk@62337 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/weave.ch')
-rw-r--r--Build/source/texk/web2c/weave.ch14
1 files changed, 9 insertions, 5 deletions
diff --git a/Build/source/texk/web2c/weave.ch b/Build/source/texk/web2c/weave.ch
index 73acd401381..1bd733bcc55 100644
--- a/Build/source/texk/web2c/weave.ch
+++ b/Build/source/texk/web2c/weave.ch
@@ -440,19 +440,23 @@ begin
until getopt_return_val = -1;
{Now |optind| is the index of first non-option on the command line.}
- if (optind + 1 <> argc) and (optind + 2 <> argc) then begin
- write_ln (stderr, my_name, ': Need one or two file arguments.');
+ if (optind + 1 > argc) or (optind + 3 < argc) then begin
+ write_ln (stderr, my_name, ': Need one to three file arguments.');
usage (my_name);
end;
{Supply |".web"| and |".ch"| extensions if necessary.}
web_name := extend_filename (cmdline (optind), 'web');
- if optind + 2 = argc then begin
- chg_name := extend_filename (cmdline (optind + 1), 'ch');
+ if optind + 2 <= argc then begin
+ if strcmp(char_to_string('-'), cmdline (optind + 1)) <> 0 then
+ chg_name := extend_filename (cmdline (optind + 1), 'ch');
end;
{Change |".web"| to |".tex"| and use the current directory.}
- tex_name := basename_change_suffix (web_name, '.web', '.tex');
+ if optind + 3 = argc then
+ tex_name := extend_filename (cmdline (optind + 2), 'tex')
+ else
+ tex_name := basename_change_suffix (web_name, '.web', '.tex');
end;
@ Here are the options we allow. The first is one of the standard GNU options.