texlive[48841] Build/source/texk/dviout-util: dviout-util: prioritize
commits+hironobu at tug.org
commits+hironobu at tug.org
Sat Oct 6 15:26:55 CEST 2018
Revision: 48841
http://tug.org/svn/texlive?view=revision&revision=48841
Author: hironobu
Date: 2018-10-06 15:26:55 +0200 (Sat, 06 Oct 2018)
Log Message:
-----------
dviout-util: prioritize filename arguments (tests still not working?)
Modified Paths:
--------------
trunk/Build/source/texk/dviout-util/ChangeLog
trunk/Build/source/texk/dviout-util/dvispc.c
Modified: trunk/Build/source/texk/dviout-util/ChangeLog
===================================================================
--- trunk/Build/source/texk/dviout-util/ChangeLog 2018-10-06 11:38:38 UTC (rev 48840)
+++ trunk/Build/source/texk/dviout-util/ChangeLog 2018-10-06 13:26:55 UTC (rev 48841)
@@ -1,7 +1,8 @@
2018-10-06 Hironobu Yamashita <h.y.acetaminophen at gmail.com>
* dvispc.c: Change option handling for future extensions.
- Make sure binary with trace does not fail tests.
+ Make sure binary with trace does not fail tests by
+ prioritizing outfile as an explicit argument.
* chkdvifont.man, dvispc.man: New man pages.
* Makefile.am: Adjusted.
* configure.ac: Version 20181006.
Modified: trunk/Build/source/texk/dviout-util/dvispc.c
===================================================================
--- trunk/Build/source/texk/dviout-util/dvispc.c 2018-10-06 11:38:38 UTC (rev 48840)
+++ trunk/Build/source/texk/dviout-util/dvispc.c 2018-10-06 13:26:55 UTC (rev 48841)
@@ -635,11 +635,14 @@
error("Too long filename");
}
- switch(argc - i){
+ switch(argc - i){ /* number of non-optional arguments */
case 0:
if(fp_in == NULL)
+ /* infile not given, empty stdin; nothing I can do */
usage(1);
if(fp_out == NULL){
+ /* outfile not given, free stdout;
+ binary cannot be written, text is fine */
if((f_mode & EXE2INDEP) || f_mode == EXE2DVI)
usage(1);
fp_out = stdout;
@@ -647,26 +650,35 @@
break;
case 1:
- if(fnum == 2)
+ if(fnum == 2) /* non-empty stdin, redirected stdout */
+ /* [TODO] ??? */
usage(1);
- if(!fnum){
+ if(!fnum){ /* empty stdin, free stdout */
+ /* if EXE2DVI, the only argument might be outfile,
+ but no input available; nothing I can do */
+ if(f_mode == EXE2DVI)
+ usage(1);
+ /* otherwise, the only argument should be infile */
strcpy(infile, argv[argc-1]);
+ /* outfile not given;
+ nonetheless binary should be written to a file,
+ text is fine with free stdout */
if((f_mode & EXE2INDEP))
strcpy(outfile, argv[argc-1]);
- else if(f_mode == EXE2DVI)
- usage(1);
else
fp_out = stdout;
- }else
+ }else /* if fp_out == NULL, free stdout; otherwise empty stdin */
+ /* [TODO] ??? */
strcpy((fp_out == NULL)?outfile:infile, argv[argc-1]);
break;
case 2:
if(fp_in == NULL){
+ /* prioritize filename arguments */
strcpy(infile, argv[argc-2]);
strcpy(outfile, argv[argc-1]);
break;
- }
+ } /* else non-empty stdin already given, confused! */
default:
usage(1);
}
@@ -683,6 +695,8 @@
}
/* -x : text -> DVI */
if(f_mode == EXE2DVI){
+ /* use infile if given, otherwise use existing fp_in (= non-empty stdin)
+ note that fp_in and infile are exclusive (already checked above) */
if(fp_in == NULL){
fp_in = fopen(infile, READ_TEXT);
if(fp_in == NULL){
@@ -690,7 +704,8 @@
exit(1);
}
}
- if(fp_out == NULL){
+ /* [TODO] I'd like to use outfile if given */
+ if(fp_out == NULL || outfile){
len = strlen(outfile);
if(len < 4 || StrCmp(outfile + len - 4, ".dvi"))
strcat(outfile, ".dvi");
More information about the tex-live-commits
mailing list