texlive[46978] Build/source/texk/web2c/lib/texmfmp.c: fix a w32 bug

commits+kakuto at tug.org commits+kakuto at tug.org
Fri Mar 16 13:12:54 CET 2018


Revision: 46978
          http://tug.org/svn/texlive?view=revision&revision=46978
Author:   kakuto
Date:     2018-03-16 13:12:53 +0100 (Fri, 16 Mar 2018)
Log Message:
-----------
fix a w32 bug in texmfmp.c (w32 only)

Modified Paths:
--------------
    trunk/Build/source/texk/web2c/lib/texmfmp.c

Modified: trunk/Build/source/texk/web2c/lib/texmfmp.c
===================================================================
--- trunk/Build/source/texk/web2c/lib/texmfmp.c	2018-03-16 08:40:47 UTC (rev 46977)
+++ trunk/Build/source/texk/web2c/lib/texmfmp.c	2018-03-16 12:12:53 UTC (rev 46978)
@@ -788,6 +788,9 @@
 #ifdef WIN32
   if (main_input_file == NULL) {
     string name;
+    boolean is_absolute;
+    char *strptr;
+
 #ifndef XeTeX
     boolean quoted;
 #endif
@@ -804,17 +807,24 @@
             *pp = '/';
         }
       }
+      name = normalize_quotes(argv[argc-1], "argument");
+      is_absolute = kpse_absolute_p(name, false);
 #ifdef XeTeX
-      name = normalize_quotes(argv[argc-1], "argument");
       main_input_file = kpse_find_file(argv[argc-1], INPUT_FORMAT, false);
       if (!srcspecialsp) {
         change_to_long_name (&main_input_file);
         if (main_input_file)
           name = normalize_quotes(main_input_file, "argument");
+        if (!is_absolute) {
+          strptr = strrchr (name, '/');
+          if (strptr) {
+            strptr++;
+            name = strptr;
+          }
+        }
       }
       argv[argc-1] = name;
 #else
-      name = normalize_quotes(argv[argc-1], "argument");
       quoted = (name[0] == '"');
       if (quoted) {
         /* Overwrite last quote and skip first quote. */
@@ -832,6 +842,13 @@
       if (!srcspecialsp) {
         if (main_input_file)
           name = normalize_quotes(main_input_file, "argument");
+        if (!is_absolute) {
+          strptr = strrchr (name, '/');
+          if (strptr) {
+            strptr++;
+            name = strptr;
+          }
+        }
       }
       argv[argc-1] = name;
 #endif
@@ -1551,6 +1568,10 @@
 string
 get_input_file_name (void)
 {
+#ifdef WIN32
+  boolean is_absolute;
+  char *strptr;
+#endif
   string input_file_name = NULL;
 
   if (argv[optind] && argv[optind][0] != '&' && argv[optind][0] != '\\') {
@@ -1574,6 +1595,9 @@
 #endif
 
     name = normalize_quotes(argv[optind], "argument");
+#ifdef WIN32
+    is_absolute = kpse_absolute_p(name, false);
+#endif
 #ifdef XeTeX
     input_file_name = kpse_find_file(argv[optind], INPUT_FORMAT, false);
 #ifdef WIN32
@@ -1602,6 +1626,13 @@
     if (!srcspecialsp) {
       if (input_file_name)
         name = normalize_quotes (input_file_name, "argument");
+      if (!is_absolute) {
+        strptr = strrchr (name, '/');
+        if (strptr) {
+          strptr++;
+          name = strptr;
+        }
+      }
     }
 #endif
     argv[optind] = name;



More information about the tex-live-commits mailing list