texlive[48844] Build/source/texk/dviout-util: dvispc.c: ignore stdin
commits+hironobu at tug.org
commits+hironobu at tug.org
Sat Oct 6 20:32:44 CEST 2018
Revision: 48844
http://tug.org/svn/texlive?view=revision&revision=48844
Author: hironobu
Date: 2018-10-06 20:32:44 +0200 (Sat, 06 Oct 2018)
Log Message:
-----------
dvispc.c: ignore stdin if infile is given
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 14:50:30 UTC (rev 48843)
+++ trunk/Build/source/texk/dviout-util/ChangeLog 2018-10-06 18:32:44 UTC (rev 48844)
@@ -2,7 +2,7 @@
* dvispc.c: Change option handling for future extensions.
Make sure binary with trace does not fail tests by
- prioritizing outfile as an explicit argument.
+ prioritizing infile and outfile as explicit arguments.
* 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 14:50:30 UTC (rev 48843)
+++ trunk/Build/source/texk/dviout-util/dvispc.c 2018-10-06 18:32:44 UTC (rev 48844)
@@ -652,9 +652,8 @@
break;
case 1:
- if(fnum == 2) /* non-empty stdin, redirected stdout */
- /* [TODO] ??? */
- usage(1);
+ /* if(fnum == 2)
+ usage(1); */
if(!fnum){ /* empty stdin, free stdout */
/* if EXE2DVI, the only argument might be outfile,
but no input available; nothing I can do */
@@ -669,22 +668,24 @@
strcpy(outfile, argv[argc-1]);
else
fp_out = stdout;
- }else /* if fp_out == NULL, free stdout; otherwise empty stdin */
- /* [TODO] to be confirmed
- if non-empty stdin, the only argument = outfile
- (input is taken from stdin)
- if redirected stdout, the only argument = infile
- (output goes to stdout for EXE2DVI, overwrite for EXE2INDEP) */
+ }else
+ /* if fp_out == NULL, non-empty stdin and free stdout
+ -> the only argument = outfile (input from stdin)
+ otherwise, redirected stdout
+ -> the only argument = infile
+ if fnum == 2, non-empty stdin will be discarded but don't care!
+ (output to overwrite for EXE2INDEP, stdout for others) */
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! */
+ /* if(fp_in == NULL){ */
+ /* prioritize filename arguments;
+ if fp_in != NULL, non-empty stdin will be discarded but don't care! */
+ strcpy(infile, argv[argc-2]);
+ strcpy(outfile, argv[argc-1]);
+ break;
+ /* } */
default:
usage(1);
}
@@ -692,7 +693,7 @@
if(fp_out && (f_mode == EXE2DVI || (f_mode & EXE2INDEP)))
setmode( fileno( stdout ), O_BINARY);
#endif
- if(fp_in && f_mode != EXE2DVI){
+ if(fp_in && !infile && f_mode != EXE2DVI){
fprintf(stderr, "*** stdin is a DVI file. ***\n"
"*** Random Access may not be supported! ***\n");
#ifndef UNIX
@@ -703,7 +704,7 @@
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){
+ if(fp_in == NULL || infile){
fp_in = fopen(infile, READ_TEXT);
if(fp_in == NULL){
fprintf(stderr, "Cannot open %s\n", infile);
@@ -771,7 +772,7 @@
#endif
goto same;
}
- if(fp_in){
+ if(fp_in && !infile){
dvi_info.file_ptr = fp_in;
dvi_info.file_name = "stdin";
}else if ((dvi_info.file_ptr = fopen(dvi_info.file_name, READ_BINARY)) == NULL){
More information about the tex-live-commits
mailing list