aboutsummaryrefslogtreecommitdiffstats
path: root/src/w32proc.c
diff options
context:
space:
mode:
authorGerd Moellmann2001-04-10 12:14:49 +0000
committerGerd Moellmann2001-04-10 12:14:49 +0000
commitdbb70029168d42bdb3b2fd5ba0f232469074e245 (patch)
treeae638a359f75c96606984c0e20fd6a1cac87a030 /src/w32proc.c
parent2261f14e70dc0f000fe24783f256a02036a46b90 (diff)
downloademacs-dbb70029168d42bdb3b2fd5ba0f232469074e245.tar.gz
emacs-dbb70029168d42bdb3b2fd5ba0f232469074e245.zip
(sys_spawnve): Quote more chars for Cygwin.
Diffstat (limited to 'src/w32proc.c')
-rw-r--r--src/w32proc.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/w32proc.c b/src/w32proc.c
index c358621f557..93dff1761bf 100644
--- a/src/w32proc.c
+++ b/src/w32proc.c
@@ -1,5 +1,5 @@
1/* Process support for GNU Emacs on the Microsoft W32 API. 1/* Process support for GNU Emacs on the Microsoft W32 API.
2 Copyright (C) 1992, 1995, 1999 Free Software Foundation, Inc. 2 Copyright (C) 1992, 1995, 1999, 2000, 2001 Free Software Foundation, Inc.
3 3
4This file is part of GNU Emacs. 4This file is part of GNU Emacs.
5 5
@@ -720,6 +720,7 @@ sys_spawnve (int mode, char *cmdname, char **argv, char **envp)
720 variable in their environment. */ 720 variable in their environment. */
721 char ppid_env_var_buffer[64]; 721 char ppid_env_var_buffer[64];
722 char *extra_env[] = {ppid_env_var_buffer, NULL}; 722 char *extra_env[] = {ppid_env_var_buffer, NULL};
723 char *sepchars = " \t";
723 724
724 /* We don't care about the other modes */ 725 /* We don't care about the other modes */
725 if (mode != _P_NOWAIT) 726 if (mode != _P_NOWAIT)
@@ -815,6 +816,10 @@ sys_spawnve (int mode, char *cmdname, char **argv, char **envp)
815 escape_char = is_cygnus_app ? '"' : '\\'; 816 escape_char = is_cygnus_app ? '"' : '\\';
816 } 817 }
817 818
819 /* Cygwin apps needs quoting a bit more often */
820 if (escape_char == '"')
821 sepchars = "\r\n\t\f '";
822
818 /* do argv... */ 823 /* do argv... */
819 arglen = 0; 824 arglen = 0;
820 targ = argv; 825 targ = argv;
@@ -828,7 +833,10 @@ sys_spawnve (int mode, char *cmdname, char **argv, char **envp)
828 need_quotes = 1; 833 need_quotes = 1;
829 for ( ; *p; p++) 834 for ( ; *p; p++)
830 { 835 {
831 if (*p == '"') 836 if (escape_char == '"' && *p == '\\')
837 /* If it's a Cygwin app, \ needs to be escaped. */
838 arglen++;
839 else if (*p == '"')
832 { 840 {
833 /* allow for embedded quotes to be escaped */ 841 /* allow for embedded quotes to be escaped */
834 arglen++; 842 arglen++;
@@ -842,7 +850,7 @@ sys_spawnve (int mode, char *cmdname, char **argv, char **envp)
842 arglen += escape_char_run; 850 arglen += escape_char_run;
843 } 851 }
844 } 852 }
845 else if (*p == ' ' || *p == '\t') 853 else if (strchr (sepchars, *p) != NULL)
846 { 854 {
847 need_quotes = 1; 855 need_quotes = 1;
848 } 856 }
@@ -876,7 +884,7 @@ sys_spawnve (int mode, char *cmdname, char **argv, char **envp)
876 if (do_quoting) 884 if (do_quoting)
877 { 885 {
878 for ( ; *p; p++) 886 for ( ; *p; p++)
879 if (*p == ' ' || *p == '\t' || *p == '"') 887 if ((strchr (sepchars, *p) != NULL) || *p == '"')
880 need_quotes = 1; 888 need_quotes = 1;
881 } 889 }
882 if (need_quotes) 890 if (need_quotes)
@@ -916,6 +924,8 @@ sys_spawnve (int mode, char *cmdname, char **argv, char **envp)
916 /* escape all quote chars, even at beginning or end */ 924 /* escape all quote chars, even at beginning or end */
917 *parg++ = escape_char; 925 *parg++ = escape_char;
918 } 926 }
927 else if (escape_char == '"' && *p == '\\')
928 *parg++ = '\\';
919 *parg++ = *p; 929 *parg++ = *p;
920 930
921 if (*p == escape_char && escape_char != '"') 931 if (*p == escape_char && escape_char != '"')