diff options
Diffstat (limited to 'Build')
-rw-r--r-- | Build/source/texk/dvipdfm-x/ChangeLog | 6 | ||||
-rw-r--r-- | Build/source/texk/dvipdfm-x/dvi.c | 29 |
2 files changed, 22 insertions, 13 deletions
diff --git a/Build/source/texk/dvipdfm-x/ChangeLog b/Build/source/texk/dvipdfm-x/ChangeLog index a0b54543836..94519ddff63 100644 --- a/Build/source/texk/dvipdfm-x/ChangeLog +++ b/Build/source/texk/dvipdfm-x/ChangeLog @@ -1,3 +1,9 @@ +2018-05-23 Akira Kakuto <kakuto@fuk.kindai.ac.jp> + + * dvi.c: First search for an input file with a suffix .xdv + or .dvi. Report from Andreas Scherer: + http://tug.org/pipermail/tex-k/2018-May/002882.html. + 2018-05-16 Akira Kakuto <kakuto@fuk.kindai.ac.jp> * pdfparse.c: Revert. The changes on 2018-05-14 must be diff --git a/Build/source/texk/dvipdfm-x/dvi.c b/Build/source/texk/dvipdfm-x/dvi.c index 3d7d94f42ed..c5607bce672 100644 --- a/Build/source/texk/dvipdfm-x/dvi.c +++ b/Build/source/texk/dvipdfm-x/dvi.c @@ -1,6 +1,6 @@ /* This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks. - Copyright (C) 2002-2017 by Jin-Hwan Cho and Shunsaku Hirata, + Copyright (C) 2002-2018 by Jin-Hwan Cho and Shunsaku Hirata, the dvipdfmx project team. Copyright (C) 2012-2015 by Khaled Hosny <khaledhosny@eglug.org> @@ -1999,21 +1999,24 @@ dvi_init (char *dvi_filename, double mag) else ungetc(ch, dvi_file); } else { - dvi_file = MFOPEN(dvi_filename, FOPEN_RBIN_MODE); - if (!dvi_file) { - char *p; - p = strrchr(dvi_filename, '.'); - if (p == NULL || (!FILESTRCASEEQ(p, ".dvi") && - !FILESTRCASEEQ(p, ".xdv"))) { - strcat(dvi_filename, ".xdv"); + char *p, *saved_orig_name; + dvi_file = NULL; + saved_orig_name = xstrdup(dvi_filename); + p = strrchr(dvi_filename, '.'); + if (p == NULL || (!FILESTRCASEEQ(p, ".dvi") && + !FILESTRCASEEQ(p, ".xdv"))) { + strcat(dvi_filename, ".xdv"); + dvi_file = MFOPEN(dvi_filename, FOPEN_RBIN_MODE); + if (!dvi_file) { + dvi_filename[strlen(dvi_filename) - 4] = '\0'; + strcat(dvi_filename, ".dvi"); dvi_file = MFOPEN(dvi_filename, FOPEN_RBIN_MODE); - if (!dvi_file) { - dvi_filename[strlen(dvi_filename) - 4] = '\0'; - strcat(dvi_filename, ".dvi"); - dvi_file = MFOPEN(dvi_filename, FOPEN_RBIN_MODE); - } } } + if (!dvi_file) + dvi_file = MFOPEN(saved_orig_name, FOPEN_RBIN_MODE); + free(saved_orig_name); + if (!dvi_file) { ERROR("Could not open specified DVI (or XDV) file: %s", dvi_filename); |