On Mon, Jul 03, 2006 at 11:28:19PM +0200, Jean-Marc Lasgouttes wrote:
> >>>>> "Bo" == Bo Peng <[EMAIL PROTECTED]> writes:
> 
> >> The solution would be to have some temp file which does \input{"a
> >> b"} (is that what we are checking?), just like we do for the cygwin
> >> check.
> 
> Bo> Can we just restore to -interaction=nonstopmode for now? Actually,
> Bo> if this option works, I do not see a reason to try a wrapper file.
> 
> Do that if you prefer. I suspect all TeX implementations implement
> that today, but there is no reason for them to do that. So using this
> command is wrong formally, but I am not going to fight against that.

The attached patches for 1.4.x and 1.5.x work for me. Please test.

Joost, dvipost on windows needs the attached patch. You should apply
it whether or not the patches to configure.py are accepted as it correctly
escapes double quotes on the command line.

-- 
Enrico
Index: lib/configure.py
===================================================================
--- lib/configure.py    (revision 14333)
+++ lib/configure.py    (working copy)
@@ -636,8 +636,12 @@
   tex_allows_spaces = 'false'
   if lyx_check_config:
     print "Checking whether TeX allows spaces in file names... ",
-    writeToFile('a b.tex', r'\nonstopmode\message{working^^J}' )
-    if ''.join(cmdOutput(LATEX + ' "a b"')).find('working') != -1:
+    writeToFile('a b.tex', r'\message{working^^J}' )
+    if os.name == 'nt':
+      latex_out = ''.join(cmdOutput(LATEX + ' "\\nonstopmode\\input{\\"a 
b\\"}"'))
+    else:
+      latex_out = ''.join(cmdOutput(LATEX + ' \'\\nonstopmode\input{"a b"}\''))
+    if latex_out.find('working') != -1:
       print 'yes'
       tex_allows_spaces = 'true'
     else:
Index: lib/configure.py
===================================================================
--- lib/configure.py    (revision 14333)
+++ lib/configure.py    (working copy)
@@ -640,8 +640,12 @@
     tex_allows_spaces = 'false'
     if lyx_check_config:
         print "Checking whether TeX allows spaces in file names... ",
-        writeToFile('a b.tex', r'\nonstopmode\message{working^^J}' )
-        if ''.join(cmdOutput(LATEX + ' "a b"')).find('working') != -1:
+        writeToFile('a b.tex', r'\message{working^^J}' )
+       if os.name == 'nt':
+            latex_out = ''.join(cmdOutput(LATEX + ' "\\nonstopmode\\input{\\"a 
b\\"}"'))
+        else:
+            latex_out = ''.join(cmdOutput(LATEX + ' \'\\nonstopmode\input{"a 
b"}\''))
+        if latex_out.find('working') != -1:
             print 'yes'
             tex_allows_spaces = 'true'
         else:
--- main.c.old  2006-07-04 01:20:22.000000000 +0200
+++ main.c      2006-07-04 01:46:32.000000000 +0200
@@ -276,6 +276,7 @@ int main (int argc, char **argv)
        int i, n;
 #ifdef _WIN32
        char *cmd;
+       char *qch;
 #else
        int status;
        pid_t pid;
@@ -380,18 +381,30 @@ int main (int argc, char **argv)
 
        time(&stamp);
 #ifdef _WIN32
-       for (i=0, n=0; i < tex_argc; ++i)
+       for (i=0, n=0; i < tex_argc; ++i) {
            n += strlen(tex_argv[i]);
+           qch = tex_argv[i];
+           while ((qch = strchr(qch, '"'))) {
+               ++qch;
+               ++n;
+           }
+       }
 
        cmd = xalloc(1 + n + 3*(tex_argc-1));
        strcpy(cmd, tex_argv[0]);
 
-       for (i=1; i < tex_argc; ++i)
+       for (i=1, n=strlen(cmd); i < tex_argc; ++i)
        {
-           strcat(cmd, " \"");
-           strcat(cmd, tex_argv[i]);
-           strcat(cmd, "\"");
+           cmd[n++] = ' ';
+           cmd[n++] = '"';
+           for (qch=tex_argv[i]; *qch; ++qch) {
+               if (*qch == '"')
+                   cmd[n++] = '\\';
+               cmd[n++] = *qch;
+           }
+           cmd[n++] = '"';
        }
+       cmd[n] = '\0';
        system(cmd);
        xfree(cmd);
 #else

Reply via email to