brian 97/01/10 01:34:49
Modified: src Configure conf.h http_log.c mod_log_agent.c mod_log_config.c mod_log_referer.c mod_rewrite.c util_script.c Log: Reviewed by: Brian Behlendorf Submitted by: Garey Smiley <[EMAIL PROTECTED]> OS/2 compatibility fixes. Revision Changes Path 1.67 +2 -1 apache/src/Configure Index: Configure =================================================================== RCS file: /export/home/cvs/apache/src/Configure,v retrieving revision 1.66 retrieving revision 1.67 diff -C3 -r1.66 -r1.67 *** Configure 1997/01/08 13:04:45 1.66 --- Configure 1997/01/10 09:34:40 1.67 *************** *** 179,185 **** DEF_WANTHSREGEX=yes OS='EMX OS/2' CFLAGS="$CFLAGS -Zbsd-signals -Zbin-files -DTCPIPV4 -g" ! LIBS="$LIBS -lsocket -llibufc -lgdbm -lbsd" ;; *-hp-hpux10.*) OS='HP-UX 10' --- 179,186 ---- DEF_WANTHSREGEX=yes OS='EMX OS/2' CFLAGS="$CFLAGS -Zbsd-signals -Zbin-files -DTCPIPV4 -g" ! LIBS="$LIBS -lsocket -llibufc -lbsd" ! DBM_LIB="-lgdbm" ;; *-hp-hpux10.*) OS='HP-UX 10' 1.67 +3 -1 apache/src/conf.h Index: conf.h =================================================================== RCS file: /export/home/cvs/apache/src/conf.h,v retrieving revision 1.66 retrieving revision 1.67 diff -C3 -r1.66 -r1.67 *** conf.h 1997/01/08 13:04:45 1.66 --- conf.h 1997/01/10 09:34:41 1.67 *************** *** 409,415 **** #define chdir _chdir2 #include <sys/time.h> #define MAXSOCKETS 4096 - #define ARG_MAX _POSIX_ARG_MAX #define HAVE_MMAP #elif defined(__MACHTEN__) --- 409,414 ---- *************** *** 552,558 **** --- 551,560 ---- #endif #ifndef S_ISLNK + #ifndef __EMX__ + /* Don't define this for OS/2 */ #define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) + #endif #endif #ifndef INADDR_NONE 1.12 +5 -0 apache/src/http_log.c Index: http_log.c =================================================================== RCS file: /export/home/cvs/apache/src/http_log.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C3 -r1.11 -r1.12 *** http_log.c 1997/01/01 18:10:18 1.11 --- http_log.c 1997/01/10 09:34:41 1.12 *************** *** 74,80 **** --- 74,85 ---- cleanup_for_exec(); signal (SIGHUP, SIG_IGN); + #ifdef __EMX__ + /* For OS/2 we need to use a '/' */ + execl (SHELL_PATH, SHELL_PATH, "/c", (char *)cmd, NULL); + #else execl (SHELL_PATH, SHELL_PATH, "-c", (char *)cmd, NULL); + #endif exit (1); } 1.8 +5 -0 apache/src/mod_log_agent.c Index: mod_log_agent.c =================================================================== RCS file: /export/home/cvs/apache/src/mod_log_agent.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C3 -r1.7 -r1.8 *** mod_log_agent.c 1997/01/01 18:10:36 1.7 --- mod_log_agent.c 1997/01/10 09:34:42 1.8 *************** *** 105,111 **** --- 105,116 ---- cleanup_for_exec(); signal (SIGHUP, SIG_IGN); + #ifdef __EMX__ + /* For OS/2 we need to use a '/' */ + execl (SHELL_PATH, SHELL_PATH, "/c", (char *)cmd, NULL); + #else execl (SHELL_PATH, SHELL_PATH, "-c", (char *)cmd, NULL); + #endif exit (1); } 1.20 +5 -0 apache/src/mod_log_config.c Index: mod_log_config.c =================================================================== RCS file: /export/home/cvs/apache/src/mod_log_config.c,v retrieving revision 1.19 retrieving revision 1.20 diff -C3 -r1.19 -r1.20 *** mod_log_config.c 1997/01/01 18:10:36 1.19 --- mod_log_config.c 1997/01/10 09:34:42 1.20 *************** *** 673,679 **** --- 673,684 ---- cleanup_for_exec(); signal (SIGHUP, SIG_IGN); + #ifdef __EMX__ + /* For OS/2 we need to use a '/' */ + execl (SHELL_PATH, SHELL_PATH, "/c", (char *)cmd, NULL); + #else execl (SHELL_PATH, SHELL_PATH, "-c", (char *)cmd, NULL); + #endif fprintf (stderr, "Exec of shell for logging failed!!!\n"); exit (1); } 1.9 +5 -0 apache/src/mod_log_referer.c Index: mod_log_referer.c =================================================================== RCS file: /export/home/cvs/apache/src/mod_log_referer.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C3 -r1.8 -r1.9 *** mod_log_referer.c 1997/01/01 18:10:37 1.8 --- mod_log_referer.c 1997/01/10 09:34:43 1.9 *************** *** 119,125 **** --- 119,130 ---- cleanup_for_exec(); signal (SIGHUP, SIG_IGN); + #ifdef __EMX__ + /* For OS/2 we need to use a '/' */ + execl (SHELL_PATH, SHELL_PATH, "/c", (char *)cmd, NULL); + #else execl (SHELL_PATH, SHELL_PATH, "-c", (char *)cmd, NULL); + #endif fprintf (stderr, "Exec of shell for logging failed!!!\n"); exit (1); } 1.13 +15 -0 apache/src/mod_rewrite.c Index: mod_rewrite.c =================================================================== RCS file: /export/home/cvs/apache/src/mod_rewrite.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C3 -r1.12 -r1.13 *** mod_rewrite.c 1997/01/01 18:10:39 1.12 --- mod_rewrite.c 1997/01/10 09:34:44 1.13 *************** *** 110,115 **** --- 110,120 ---- /* now our own stuff ... */ #include "mod_rewrite.h" + #ifdef __EMX__ + /* OS/2 dosen't support links. */ + #define S_ISLNK + #endif + *************** *** 2162,2168 **** --- 2167,2178 ---- { cleanup_for_exec(); signal(SIGHUP, SIG_IGN); + #ifdef __EMX__ + /* For OS/2 we need to use a '/' */ + execl(SHELL_PATH, SHELL_PATH, "/c", (char *)cmd, NULL); + #else execl(SHELL_PATH, SHELL_PATH, "-c", (char *)cmd, NULL); + #endif exit(1); } *************** *** 2301,2307 **** --- 2311,2322 ---- { cleanup_for_exec(); signal(SIGHUP, SIG_IGN); + #ifdef __EMX__ + /* For OS/2 we need to use a '/' */ + execl(SHELL_PATH, SHELL_PATH, "/c", (char *)cmd, NULL); + #else execl(SHELL_PATH, SHELL_PATH, "-c", (char *)cmd, NULL); + #endif exit(1); } 1.38 +30 -0 apache/src/util_script.c Index: util_script.c =================================================================== RCS file: /export/home/cvs/apache/src/util_script.c,v retrieving revision 1.37 retrieving revision 1.38 diff -C3 -r1.37 -r1.38 *** util_script.c 1997/01/03 09:30:20 1.37 --- util_script.c 1997/01/10 09:34:44 1.38 *************** *** 462,467 **** --- 462,490 ---- #endif #ifdef __EMX__ + { + /* Additions by Alec Kloss, to allow exec'ing of scripts under OS/2 */ + int is_script; + char interpreter[2048]; /* hope this is large enough for the interpreter path */ + FILE * program; + program = fopen (r->filename, "r"); + if (!program) { + char err_string[HUGE_STRING_LEN]; + sprintf(err_string, "open of %s failed, errno is %d\n", r->filename, errno); + /* write(2, err_string, strlen(err_string)); */ + /* exit(0); */ + log_unixerr("fopen", NULL, err_string, r->server); + return; + } + fgets (interpreter, 2048, program); + fclose (program); + if (!strncmp (interpreter, "#!", 2)) { + is_script = 1; + interpreter[strlen(interpreter)-1] = '\0'; + } else { + is_script = 0; + } + if ((!r->args) || (!r->args[0]) || (ind(r->args,'=') >= 0)) { int emxloop; char *emxtemp; *************** *** 472,477 **** --- 495,506 ---- for (emxloop=0; ((emxtemp = env[emxloop]) != NULL); emxloop++) putenv(emxtemp); + /* Additions by Alec Kloss, to allow exec'ing of scripts under OS/2 */ + if (is_script) { + /* here's the stuff to run the interpreter */ + execl (interpreter+2, interpreter+2, r->filename, NULL); + } else + if (strstr(strupr(r->filename), ".CMD") > 0) { /* Special case to allow use of REXX commands as scripts. */ os2pathname(r->filename); *************** *** 498,503 **** --- 527,533 ---- } else execv(r->filename, create_argv(r, argv0, r->args, NULL)); + } } #else if ( suexec_enabled &&