[tex4ht-commits] [SCM] tex4ht updated: r67 - trunk/lit

karl at gnu.org.ua karl at gnu.org.ua
Tue Dec 14 18:28:47 CET 2010


Author: karl
Date: 2010-12-14 19:28:47 +0200 (Tue, 14 Dec 2010)
New Revision: 67

Modified:
   trunk/lit/ChangeLog
   trunk/lit/tex4ht-c.tex
   trunk/lit/tex4ht-htcmd.tex
   trunk/lit/tex4ht-t4ht.tex
Log:
resplit argv for Windows; from Akira

Modified: trunk/lit/ChangeLog
===================================================================
--- trunk/lit/ChangeLog	2010-12-02 19:47:02 UTC (rev 66)
+++ trunk/lit/ChangeLog	2010-12-14 17:28:47 UTC (rev 67)
@@ -1,3 +1,11 @@
+2010-12-14  Karl Berry  <karl at gnu.org>
+
+	* tex4ht-c.tex,
+	* tex4ht-t4ht.tex (resplit argv for windows): new section, from Akira
+	Kakuto.
+	
+	* tex4ht-htcmd.tex: document that this not used.
+
 2010-11-17  Karl Berry  <karl at gnu.org>
 
 	* all files: switch to ranges in copyright notices.

Modified: trunk/lit/tex4ht-c.tex
===================================================================
--- trunk/lit/tex4ht-c.tex	2010-12-02 19:47:02 UTC (rev 66)
+++ trunk/lit/tex4ht-c.tex	2010-12-14 17:28:47 UTC (rev 67)
@@ -445,7 +445,7 @@
 >>>
 
 
-Here are the promise patch. However I have not yet tested it very
+Here are the promised patch. However I have not yet tested it very
 much. It is unlikely that I test it with non-kpathsea setting. At
 least the patch compiles in both kpathsea and non-kpathsea setting.
  The following patch is very similar
@@ -1059,9 +1059,63 @@
 \EndVerbatim
 
 
+\<resplit argv for windows\><<<
+#ifdef WIN32
+  /* The idea here is to split options apart at spaces: a single argument
+     "-foo -bar" becomes the two options "-foo" and "-bar".  We need to
+     do this for Windows because mk4ht passes this sort of combined
+     option in one string to scripts like htlatex.{unix,bat}.  In the
+     Unix case, the shell resplits words when calling t4ht and tex4ht,
+     so the program see two options.  But this does not happen with the
+     .bat; %4, for instance, remains "-foo -bar".  So we fix it here.  */
+  if (argc > 2) {
+    int  i, nargc;
+    char **nargv, **pnargv, **pargv;
 
+    nargv = (char **) xmalloc (2 * argc * sizeof (char *));
+    pnargv = nargv;
+    pargv = argv;
+    *pnargv++ = xstrdup (*pargv++);
+    *pnargv++ = xstrdup (*pargv++);
+    nargc = 2;
 
+    for (i=2; i < argc; i++) {
+      char *p, *q, *r;
+      p = q = *pargv++;
+      while (*p == ' ' || *p == '\t') {
+        p++;
+        q++;
+      }
+      while (*p != ' ' && *p != '\t' && *p) {
+        p++;
+        if (*p == '\0') {
+          *pnargv++ = xstrdup(q);
+          nargc++;
+        } else if (*p == ' ' || *p == '\t') {
+          r = p;
+          while (*p == ' ' || *p == '\t')
+            p++;
+          if (*p == '-' || *p == '\0') {
+            *r = '\0';
+            *pnargv++ = xstrdup(q);
+            nargc++;
+            q = p;
+          }
+        }
+      }
+    }
 
+    for (i=0; i < argc; i++)
+      free (argv[i]);
+    free (argv);
+    nargv[nargc] = NULL;
+    argv = nargv;
+    argc = nargc;
+  }
+#endif
+>>>
+
+
 \SubSection{Signals}
 
 \<h-include\><<<
@@ -1267,6 +1321,7 @@
        int  argc`;  
        U_CHAR **argv
 ;{  `<main's vars`> 
+   `<resplit argv for windows`>
    `<set signals`>
    `<program signature`>
    `<init traces`>
@@ -5907,7 +5962,6 @@
 }
 >>>
 
-
 \<vars\><<<
 static FILE*  log_file;
 >>>

Modified: trunk/lit/tex4ht-htcmd.tex
===================================================================
--- trunk/lit/tex4ht-htcmd.tex	2010-12-02 19:47:02 UTC (rev 66)
+++ trunk/lit/tex4ht-htcmd.tex	2010-12-14 17:28:47 UTC (rev 67)
@@ -2,7 +2,12 @@
 %       tex tex4ht-htcmd
 % or ht tex tex4ht-htcmd
 %
-% htcmd is not used for anything, but this .tex file is preserved for history.
+% htcmd is apparently not used for anything, but this .tex file is
+% preserved for history.
+% 
+% htcmd OPTFLAG CMDLINE  passed CMDLINE to system(), translating each
+% forward slash into a single or double backslash for OPTFLAG set to
+% -slash or -dslash respectively.
 %
 % Copyright (C) 2009-2010 TeX Users Group
 % Copyright (C) 1996-2009 Eitan M. Gurari

Modified: trunk/lit/tex4ht-t4ht.tex
===================================================================
--- trunk/lit/tex4ht-t4ht.tex	2010-12-02 19:47:02 UTC (rev 66)
+++ trunk/lit/tex4ht-t4ht.tex	2010-12-14 17:28:47 UTC (rev 67)
@@ -158,6 +158,7 @@
        int  argc`;  
        Q_CHAR **argv
 ;{ `<main's vars`> 
+   `<resplit argv for windows`>
    `<set signals`>
    `<program signature`>
    `<main's init`> 
@@ -1448,7 +1449,6 @@
 *q = '\0';
 >>>
 
-
 The argument `\Verb=%%~=' is replaced with the value of
 \Verb=${SELFAUTOPARENT}= under KPATHSEA.  If such a value 
 is not available, the character `\Verb=~=' is used.   The variable
@@ -3915,10 +3915,58 @@
 static const C_CHAR *warn_err_mssg[]={ `<warn and err messages`> "" };
 >>>
 
+\<resplit argv for windows\><<<
+#ifdef WIN32
+  /* See comments in tex4ht */
+  if (argc > 2) {
+    int  i, nargc;
+    char **nargv, **pnargv, **pargv;
 
+    nargv = (char **) xmalloc (2 * argc * sizeof (char *));
+    pnargv = nargv;
+    pargv = argv;
+    *pnargv++ = xstrdup (*pargv++);
+    *pnargv++ = xstrdup (*pargv++);
+    nargc = 2;
 
+    for (i=2; i < argc; i++) {
+      char *p, *q, *r;
+      p = q = *pargv++;
+      while (*p == ' ' || *p == '\t') {
+        p++;
+        q++;
+      }
+      while (*p != ' ' && *p != '\t' && *p) {
+        p++;
+        if (*p == '\0') {
+          *pnargv++ = xstrdup(q);
+          nargc++;
+        } else if (*p == ' ' || *p == '\t') {
+          r = p;
+          while (*p == ' ' || *p == '\t')
+            p++;
+          if (*p == '-' || *p == '\0') {
+            *r = '\0';
+            *pnargv++ = xstrdup(q);
+            nargc++;
+            q = p;
+          }
+        }
+      }
+    }
+ 
+    for (i=0; i < argc; i++)
+      free (argv[i]);
+    free (argv);
+    nargv[nargc] = NULL;
+    argv = nargv;
+    argc = nargc;
+  }
+#endif
 
 
+
+
 \SubSection{Signals}
 
 \<h-include\><<<



More information about the tex4ht-commits mailing list