httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From p.@sweng.stortek.com
Subject [PATCH] OS/390 vs. CGI revisited.
Date Thu, 25 Nov 1999 02:32:31 GMT
In a recent note, Martin Kraemer said:

> Date: Wed, 24 Nov 1999 22:56:37 +0100
> 
> Look for the #define NEED_HASHBANG_EMUL in ap_config.h! It improves (what
> 
I persisted.  Yow!  to compile hashbang emulation on OS/390, I had to
do all the casting below.  Am I even on the right track?

But it does work.

Thanks,
gil
-- 
StorageTek
INFORMATION made POWERFUL
=========================================================================
diff -bru orig/apache_1.3.9/src/ap/ap_execve.c apache_1.3.9/src/ap/ap_execve.c
--- orig/apache_1.3.9/src/ap/ap_execve.c	Sun Mar  7 06:51:19 1999
+++ apache_1.3.9/src/ap/ap_execve.c	Wed Nov 24 18:52:05 1999
@@ -99,7 +99,7 @@
 #undef execle
 #undef execve
 
-static const char **hashbang(const char *filename, char **argv);
+static const char **hashbang(const char *filename, char * const *argv);
 
 
 /* Historically, a list of arguments on the stack was often treated as
@@ -133,7 +133,7 @@
 
     /* Pass two --- copy the argument strings into the result space */
     va_start(adummy, argv0);
-    argv[0] = argv0;
+    argv[0] = (char *)argv0;
     for (argc = 1; (argv[argc] = va_arg(adummy, char *)) != NULL; ++argc) {
 	continue;
     }
@@ -149,7 +149,7 @@
 /* Count number of entries in vector "args", including the trailing NULL entry
  */
 static int
-count_args(const char **args)
+count_args(char * const *args)
 {
     int i;
     for (i = 0; args[i] != NULL; ++i) {
@@ -163,14 +163,14 @@
  * We have to fiddle with the argv array to make it work on platforms
  * which don't support the "hashbang" interpreter line by default.
  */
-int ap_execve(const char *filename, const char *argv[],
-	      const char *envp[])
+int ap_execve(const char *filename, char * const argv[],
+	      char * const envp[])
 {
-    const char **script_argv;
+    char **script_argv;
     extern char **environ;
 
     if (envp == NULL) {
-	envp = (const char **) environ;
+	envp = (char * const *)environ;
     }
 
     /* Try to execute the file directly first: */
@@ -201,7 +201,7 @@
 	 * Interpret the line following the #! as a command line
 	 * in shell style.
 	 */
-	if ((script_argv = hashbang(filename, argv)) != NULL) {
+	if ((script_argv = (char **)hashbang(filename, argv)) != NULL) {
 
 	    /* new filename is the interpreter to call */
 	    filename = script_argv[0];
@@ -257,7 +257,7 @@
  */
 #define HACKBUFSZ 1024		/* Max chars in #! vector */
 #define HACKVECSZ 128		/* Max words in #! vector */
-static const char **hashbang(const char *filename, char **argv)
+static const char **hashbang(const char *filename, char * const *argv)
 {
     char lbuf[HACKBUFSZ];
     char *sargv[HACKVECSZ];
@@ -347,7 +347,7 @@
 	    }
 	    ++i;
 
-	    newargv = (char **) malloc((p - lbuf + 1)
+	    newargv = (const char **) malloc((p - lbuf + 1)
                       + (i + sargc + 1) * sizeof(*newargv));
 	    if (newargv == NULL) {
 		fprintf(stderr, "Ouch!  Out of memory in hashbang()!\n");
diff -bru orig/apache_1.3.9/src/include/ap.h apache_1.3.9/src/include/ap.h
--- orig/apache_1.3.9/src/include/ap.h	Thu Aug 12 12:06:20 1999
+++ apache_1.3.9/src/include/ap.h	Wed Nov 24 16:02:51 1999
@@ -68,7 +68,6 @@
 API_EXPORT(char *) ap_cpystrn(char *, const char *, size_t);
 int ap_slack(int, int);
 int ap_execle(const char *, const char *, ...);
-int ap_execve(const char *, const char *argv[], const char *envp[]);
 API_EXPORT(int) ap_getpass(const char *prompt, char *pwbuf, size_t bufsiz);
 
 /* small utility macros to make things easier to read */
diff -bru orig/apache_1.3.9/src/include/ap_config.h apache_1.3.9/src/include/ap_config.h
--- orig/apache_1.3.9/src/include/ap_config.h	Mon Aug  9 01:38:45 1999
+++ apache_1.3.9/src/include/ap_config.h	Wed Nov 24 18:26:12 1999
@@ -1227,8 +1235,8 @@
  */
 #ifdef NEED_HASHBANG_EMUL
 extern int ap_execle(const char *filename, const char *arg,...);
-extern int ap_execve(const char *filename, const char *argv[],
-                     const char *envp[]);
+extern int ap_execve(const char *filename, char * const argv[],
+                     char * const envp[]);
 /* ap_execle() is a wrapper function around ap_execve(). */
 #define execle  ap_execle
 #define execve(path,argv,envp)  ap_execve(path,argv,envp)

Mime
View raw message