diff options
author | Jan Dubois <jand@activestate.com> | 1998-10-20 23:57:35 +0200 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 1998-10-25 06:48:19 +0000 |
commit | e200fe592a4997f548ebec319b6bc13065a09d24 (patch) | |
tree | 442c69a0bdac710abd5edc24b34928d44226e491 /win32 | |
parent | 45ce3e5a8f0207ff3a834a617577ffdb6db5c9d6 (diff) | |
download | perl-e200fe592a4997f548ebec319b6bc13065a09d24.tar.gz |
recognize '%' as a shell metachar for win32
Message-ID: <3636ea31.49170453@smtp1.ibm.net>
Subject: [PATCH 5.005_02, Win32] Re: %ENV% not expanded in backquotes?
p4raw-id: //depot/perl@2066
Diffstat (limited to 'win32')
-rw-r--r-- | win32/win32.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/win32/win32.c b/win32/win32.c index 8497b676b4..5f7d4873be 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -91,7 +91,7 @@ static DWORD os_id(void); static void get_shell(void); static long tokenize(char *str, char **dest, char ***destv); int do_spawn2(char *cmd, int exectype); -static BOOL has_redirection(char *ptr); +static BOOL has_shell_metachars(char *ptr); static long filetime_to_clock(PFILETIME ft); static BOOL filetime_from_time(PFILETIME ft, time_t t); static char * get_emd_part(char *leading, char *trailing, ...); @@ -289,17 +289,20 @@ win32_get_sitelib(char *pl) static BOOL -has_redirection(char *ptr) +has_shell_metachars(char *ptr) { int inquote = 0; char quote = '\0'; /* * Scan string looking for redirection (< or >) or pipe - * characters (|) that are not in a quoted string + * characters (|) that are not in a quoted string. + * Shell variable interpolation (%VAR%) can also happen inside strings. */ while (*ptr) { switch(*ptr) { + case '%': + return TRUE; case '\'': case '\"': if (inquote) { @@ -521,7 +524,7 @@ do_spawn2(char *cmd, int exectype) /* Save an extra exec if possible. See if there are shell * metacharacters in it */ - if (!has_redirection(cmd)) { + if (!has_shell_metachars(cmd)) { New(1301,argv, strlen(cmd) / 2 + 2, char*); New(1302,cmd2, strlen(cmd) + 1, char); strcpy(cmd2, cmd); |