summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstoddard <stoddard@13f79535-47bb-0310-9956-ffa450edef68>2000-03-03 06:06:58 +0000
committerstoddard <stoddard@13f79535-47bb-0310-9956-ffa450edef68>2000-03-03 06:06:58 +0000
commit9feb2ff157bd28a2096fc845c0765a691719d780 (patch)
treef96370e7826a4a5d160346dd48f95598739e28f0
parentf018487e4a0fe5a9e6ef517b1013d3c1d31f4544 (diff)
downloadlibapr-9feb2ff157bd28a2096fc845c0765a691719d780.tar.gz
Win32: Use the COMSPEC envar to set the shell name.
Submitted by: Bill Rowe <wrowe@Ind.com> Reviewed by: Bill Stoddard <stoddard@apache.org> git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@59679 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--include/arch/win32/threadproc.h2
-rw-r--r--threadproc/win32/proc.c26
-rw-r--r--threadproc/win32/threadproc.h2
3 files changed, 8 insertions, 22 deletions
diff --git a/include/arch/win32/threadproc.h b/include/arch/win32/threadproc.h
index 91504662b..fb8520a26 100644
--- a/include/arch/win32/threadproc.h
+++ b/include/arch/win32/threadproc.h
@@ -60,7 +60,7 @@
#ifndef THREAD_PROC_H
#define THREAD_PROC_H
-#define SHELL_PATH "/bin/sh"
+#define SHELL_PATH "cmd.exe"
struct thread_t {
ap_context_t *cntxt;
diff --git a/threadproc/win32/proc.c b/threadproc/win32/proc.c
index e82a7139a..77490eb03 100644
--- a/threadproc/win32/proc.c
+++ b/threadproc/win32/proc.c
@@ -228,7 +228,7 @@ ap_status_t ap_create_process(struct proc_t **new, const char *progname,
}
if (attr->cmdtype == APR_PROGRAM) {
- char *ptr = progname;
+ const char *ptr = progname;
if (*ptr =='"') {
ptr++;
@@ -251,25 +251,11 @@ ap_status_t ap_create_process(struct proc_t **new, const char *progname,
}
}
else {
- char * shell_cmd;
- OSVERSIONINFO osver;
- osver.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
-
- /*
- * Use CMD.EXE for NT, COMMAND.COM for WIN95
- */
- if (GetVersionEx(&osver)) {
- if (osver.dwPlatformId != VER_PLATFORM_WIN32_NT) {
- shell_cmd = ap_pstrdup(cont, "COMMAND.COM /C ");
- }
- else {
- shell_cmd = ap_pstrdup(cont, "CMD.EXE /C ");
- }
- }
- else {
- shell_cmd = ap_pstrdup(cont, "CMD.EXE /C ");
- }
- cmdline = ap_pstrcat(cont, shell_cmd, progname, NULL);
+ char * shell_cmd = getenv("COMSPEC");
+ if (!shell_cmd)
+ shell_cmd = SHELL_PATH;
+ shell_cmd = ap_pstrdup(cont, shell_cmd);
+ cmdline = ap_pstrcat(cont, shell_cmd, " /C ", progname, NULL);
}
i = 1;
diff --git a/threadproc/win32/threadproc.h b/threadproc/win32/threadproc.h
index 91504662b..fb8520a26 100644
--- a/threadproc/win32/threadproc.h
+++ b/threadproc/win32/threadproc.h
@@ -60,7 +60,7 @@
#ifndef THREAD_PROC_H
#define THREAD_PROC_H
-#define SHELL_PATH "/bin/sh"
+#define SHELL_PATH "cmd.exe"
struct thread_t {
ap_context_t *cntxt;