I recently noticed that the graphics viewers were not working from
lynx when the DJGPP port was run under bash. The problem was that
local file paths were given in DOS form (with backslashes), as might
be required by outside utilities, but the bash shell was stripping the
backslashes. This patch should escape the backslashes when a unix-type
shell is in the SHELL environment variable. As far as I can tell, with
this patch the DJGPP port works fine whether run under command.com or
under bash. Note that the behavior of system() under DJGPP depends on
the value of the SHELL variable, not on the actual shell that is
running.

Remember that I am not a programmer, so please check the code.
                              Doug


--- lynx2-8-5/src/LYMain.c.orig 2003-06-01 17:16:28.000000000 -0800
+++ lynx2-8-5/src/LYMain.c      2003-06-12 21:04:50.000000000 -0800
@@ -77,6 +77,7 @@
 
 #ifdef __DJGPP__
 char init_ctrl_break[1];
+char *djshell;
 #endif /* __DJGPP__ */
 
 #if USE_VMS_MAILER
@@ -294,6 +295,7 @@
 
 #ifdef __DJGPP__
 PUBLIC BOOLEAN watt_debug = FALSE;     /* WATT-32 debugging */
+PUBLIC BOOLEAN dj_is_bash = FALSE;  /* Check for bash shell under DJGPP */
 #endif /* __DJGPP__ */
 
 #ifdef WIN_EX
@@ -955,6 +957,9 @@
     __djgpp_set_sigquit_key(0x082D); /* Bind ALT-X to SIGQUIT */
     signal(SIGQUIT, cleanup_sig);
     atexit(reset_break);
+
+       if (((djshell=getenv("SHELL")) != NULL) && (strstr(djshell, "sh") != NULL))
+                       dj_is_bash = TRUE;
 #endif /* __DJGPP__ */
 
     /*
--- lynx2-8-5/src/LYUtils.c.orig        2003-06-01 17:16:28.000000000 -0800
+++ lynx2-8-5/src/LYUtils.c     2003-06-12 21:49:36.000000000 -0800
@@ -21,6 +21,7 @@
 #ifdef __DJGPP__
 #include <go32.h>
 #include <sys/exceptn.h>
+extern BOOLEAN dj_is_bash;
 #endif /* __DJGPP__ */
 
 #ifndef NO_GROUPS
@@ -7042,6 +7043,29 @@
     }
 #endif
 
+#ifdef __DJGPP__
+       if (dj_is_bash)
+       {
+       char cmd[LY_MAXPATH];   
+       char *p, *q;
+       memset(cmd, 0, LY_MAXPATH);
+       p = command;
+       q = cmd;
+       for (;*p != '\0'; p++)
+       {
+                       *q = *p;
+                       if (*p == '\\')
+                       {
+                                       *(q+1) = '\\';
+                                       q++;
+                       }
+                       q++;
+       }
+       *q++ = '\0';
+       strcpy(command, cmd);
+       }
+#endif /* __DJGPP__ */
+
 #ifdef _WIN_CC
     code = exec_command(command, TRUE);        /* Wait exec */
 #else /* !_WIN_CC */

-- 
Doug Kaufman
Internet: [EMAIL PROTECTED]



; To UNSUBSCRIBE: Send "unsubscribe lynx-dev" to [EMAIL PROTECTED]

Reply via email to