httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben Laurie <...@hyperreal.org>
Subject cvs commit: apachen/src/os/win32 passwd.c passwd.h ApacheModuleRewrite.dsp ApacheModuleRewrite.mak
Date Sun, 31 Aug 1997 16:43:20 GMT
ben         97/08/31 09:43:19

  Modified:    src      Makefile.nt
               src/modules/standard mod_rewrite.c mod_rewrite.h
               src/os/win32 ApacheModuleRewrite.dsp ApacheModuleRewrite.mak
  Added:       src/os/win32 passwd.c passwd.h
  Log:
  Make mod_rewrite compile on Win32.
  
  Revision  Changes    Path
  1.14      +2 -0      apachen/src/Makefile.nt
  
  Index: Makefile.nt
  ===================================================================
  RCS file: /export/home/cvs/apachen/src/Makefile.nt,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- Makefile.nt	1997/08/17 12:57:00	1.13
  +++ Makefile.nt	1997/08/31 16:43:13	1.14
  @@ -20,6 +20,7 @@
   	cd os\win32 & set CFG=ApacheModuleExpires - Win32 Release& nmake /nologo -f ApacheModuleExpires.mak
   	cd os\win32 & set CFG=ApacheModuleHeaders - Win32 Release& nmake /nologo -f ApacheModuleHeaders.mak
   	cd os\win32 & set CFG=ApacheModuleUserTrack - Win32 Release& nmake /nologo -f
ApacheModuleUserTrack.mak
  +	cd os\win32 & set CFG=ApacheModuleRewrite - Win32 Release& nmake /nologo -f ApacheModuleRewrite.mak
   	cd modules\proxy & set CFG=ApacheModuleProxy - Win32 Release& nmake /nologo -f
ApacheModuleProxy.mak
   
   _apached:
  @@ -34,6 +35,7 @@
   	cd os\win32 & set CFG=ApacheModuleExpires - Win32 Debug& nmake /nologo -f ApacheModuleExpires.mak
   	cd os\win32 & set CFG=ApacheModuleHeaders - Win32 Debug& nmake /nologo -f ApacheModuleHeaders.mak
   	cd os\win32 & set CFG=ApacheModuleUserTrack - Win32 Debug& nmake /nologo -f ApacheModuleUserTrack.mak
  +	cd os\win32 & set CFG=ApacheModuleRewrite - Win32 Debug& nmake /nologo -f ApacheModuleRewrite.mak
   	cd modules\proxy & set CFG=ApacheModuleProxy - Win32 Debug& nmake /nologo -f ApacheModuleProxy.mak
   
   installr: _apacher
  
  
  
  1.49      +35 -4     apachen/src/modules/standard/mod_rewrite.c
  
  Index: mod_rewrite.c
  ===================================================================
  RCS file: /export/home/cvs/apachen/src/modules/standard/mod_rewrite.c,v
  retrieving revision 1.48
  retrieving revision 1.49
  diff -u -r1.48 -r1.49
  --- mod_rewrite.c	1997/08/18 13:12:17	1.48
  +++ mod_rewrite.c	1997/08/31 16:43:15	1.49
  @@ -95,7 +95,9 @@
   #include <errno.h>
   #include <sys/types.h>
   #include <sys/stat.h>
  -#ifndef WIN32
  +#ifdef WIN32
  +#include "../../os/win32/passwd.h"
  +#else
   #include <netinet/in.h>
   #endif
   
  @@ -109,7 +111,9 @@
       /* now our own stuff ... */
   #include "mod_rewrite.h"
   
  - 
  +#ifdef USE_LOCKING
  +#include <sys/locking.h>
  +#endif 
   
   
   /*
  @@ -2353,7 +2357,11 @@
       char *fname;
       FILE *fp;
       int    rewritelog_flags = ( O_WRONLY|O_APPEND|O_CREAT );
  +#ifdef WIN32
  +    mode_t rewritelog_mode=_S_IREAD|_S_IWRITE;
  +#else
       mode_t rewritelog_mode  = ( S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH );
  +#endif
     
       conf = get_module_config(s->module_config, &rewrite_module);
       
  @@ -2391,9 +2399,11 @@
       int child_pid = 1;
   
       cleanup_for_exec();
  +#ifdef SIGHUP
       signal(SIGHUP, SIG_IGN);
  +#endif
   #if defined(WIN32)
  -    child_pid = spawnl(SHELL_PATH, SHELL_PATH, "/c", (char *)cmd, NULL);
  +    child_pid = spawnl(_P_NOWAIT, SHELL_PATH, SHELL_PATH, "/c", (char *)cmd, NULL);
   #elif defined(__EMX__)
       /* OS/2 needs a '/' */
       execl(SHELL_PATH, SHELL_PATH, "/c", (char *)cmd, NULL);
  @@ -2551,9 +2561,11 @@
       int child_pid = 1;
       
       cleanup_for_exec();
  +#ifdef SIGHUP
       signal(SIGHUP, SIG_IGN);
  +#endif
   #if defined(WIN32)
  -    child_pid = spawnl(SHELL_PATH, SHELL_PATH, "/c", (char *)cmd, NULL);
  +    child_pid = spawnl(_P_NOWAIT, SHELL_PATH, SHELL_PATH, "/c", (char *)cmd, NULL);
   #elif defined(__EMX__)
       /* OS/2 needs a '/' */
       execl(SHELL_PATH, SHELL_PATH, "/c", (char *)cmd, NULL);
  @@ -2628,9 +2640,11 @@
       time_t tc;
       struct tm *tm;
       request_rec *rsub;
  +#ifndef WIN32
       struct passwd *pw;
       struct group *gr;
       struct stat finfo;
  +#endif
   
       result = NULL;
   
  @@ -2812,6 +2826,9 @@
           LOOKAHEAD(sub_req_lookup_file)
       }
   
  +#ifndef WIN32
  +    /* Win32 has a rather different view of file ownerships. For now, just forget it */
  +
       /* file stuff */
       else if (strcasecmp(var, "SCRIPT_USER") == 0) {
           result = pstrdup(r->pool, "<unknown>");
  @@ -2844,6 +2861,8 @@
           }
       }
   
  +#endif /* ndef WIN32 */
  +
       if (result == NULL)
           return pstrdup(r->pool, "");
       else
  @@ -3337,6 +3356,13 @@
              && (errno == EINTR)               )
           continue;
   #endif
  +#ifdef USE_LOCKING
  +    /* Lock the first byte, always, assume we want to append and seek to
  +    the end afterwards */
  +    lseek(fd,0,SEEK_SET);
  +    rc=_locking(fd, _LK_LOCK, 1);
  +    lseek(fd,0,SEEK_END);
  +#endif
   
       if (rc < 0) {
   #ifdef USE_FLOCK
  @@ -3366,6 +3392,11 @@
   #ifdef USE_FLOCK 
       rc = flock(fd, LOCK_UN);
   #endif 
  +#ifdef USE_LOCKING
  +    lseek(fd,0,SEEK_SET);
  +    rc=_locking(fd,_LK_UNLCK,1);
  +    lseek(fd,0,SEEK_END);
  +#endif
   
       if (rc < 0) {
   #ifdef USE_FLOCK
  
  
  
  1.31      +5 -0      apachen/src/modules/standard/mod_rewrite.h
  
  Index: mod_rewrite.h
  ===================================================================
  RCS file: /export/home/cvs/apachen/src/modules/standard/mod_rewrite.h,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- mod_rewrite.h	1997/08/05 10:49:41	1.30
  +++ mod_rewrite.h	1997/08/31 16:43:16	1.31
  @@ -132,6 +132,11 @@
   #define USE_FCNTL 1
   #include <fcntl.h>
   #endif
  +#ifdef WIN32
  +#undef USE_FCNTL
  +#define USE_LOCKING
  +#endif
  +
   
       /* The locking support for the RewriteMap programs:
          Locking a pipe to the child works fine under most
  
  
  
  1.4       +5 -1      apachen/src/os/win32/ApacheModuleRewrite.dsp
  
  Index: ApacheModuleRewrite.dsp
  ===================================================================
  RCS file: /export/home/cvs/apachen/src/os/win32/ApacheModuleRewrite.dsp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ApacheModuleRewrite.dsp	1997/08/23 14:12:47	1.3
  +++ ApacheModuleRewrite.dsp	1997/08/31 16:43:17	1.4
  @@ -55,7 +55,7 @@
   # ADD BSC32 /nologo
   LINK32=link.exe
   # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib
shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows
/dll /machine:I386
  -# ADD LINK32 ..\..\CoreR\ApacheCore.lib kernel32.lib user32.lib gdi32.lib winspool.lib
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib
/nologo /subsystem:windows /dll /machine:I386
  +# ADD LINK32 ..\..\CoreR\ApacheCore.lib kernel32.lib user32.lib gdi32.lib winspool.lib
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib
 wsock32.lib /nologo /subsystem:windows /dll /machine:I386
   
   !ELSEIF  "$(CFG)" == "ApacheModuleRewrite - Win32 Debug"
   
  @@ -95,6 +95,10 @@
   # Begin Source File
   
   SOURCE=..\..\modules\standard\mod_rewrite.c
  +# End Source File
  +# Begin Source File
  +
  +SOURCE=.\passwd.c
   # End Source File
   # End Group
   # Begin Group "Header Files"
  
  
  
  1.4       +40 -3     apachen/src/os/win32/ApacheModuleRewrite.mak
  
  Index: ApacheModuleRewrite.mak
  ===================================================================
  RCS file: /export/home/cvs/apachen/src/os/win32/ApacheModuleRewrite.mak,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ApacheModuleRewrite.mak	1997/08/23 14:12:47	1.3
  +++ ApacheModuleRewrite.mak	1997/08/31 16:43:17	1.4
  @@ -54,6 +54,7 @@
   
   CLEAN :
   	-@erase "$(INTDIR)\mod_rewrite.obj"
  +	-@erase "$(INTDIR)\passwd.obj"
   	-@erase "$(INTDIR)\vc50.idb"
   	-@erase "$(OUTDIR)\ApacheModuleRewrite.dll"
   	-@erase "$(OUTDIR)\ApacheModuleRewrite.exp"
  @@ -75,12 +76,13 @@
   LINK32=link.exe
   LINK32_FLAGS=..\..\CoreR\ApacheCore.lib kernel32.lib user32.lib gdi32.lib\
    winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib\
  - uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll\
  + uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /subsystem:windows /dll\
    /incremental:no /pdb:"$(OUTDIR)\ApacheModuleRewrite.pdb" /machine:I386\
    /out:"$(OUTDIR)\ApacheModuleRewrite.dll"\
    /implib:"$(OUTDIR)\ApacheModuleRewrite.lib" 
   LINK32_OBJS= \
  -	"$(INTDIR)\mod_rewrite.obj"
  +	"$(INTDIR)\mod_rewrite.obj" \
  +	"$(INTDIR)\passwd.obj"
   
   "$(OUTDIR)\ApacheModuleRewrite.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
       $(LINK32) @<<
  @@ -107,6 +109,7 @@
   
   CLEAN :
   	-@erase "$(INTDIR)\mod_rewrite.obj"
  +	-@erase "$(INTDIR)\passwd.obj"
   	-@erase "$(INTDIR)\vc50.idb"
   	-@erase "$(INTDIR)\vc50.pdb"
   	-@erase "$(OUTDIR)\ApacheModuleRewrite.dll"
  @@ -136,7 +139,8 @@
    /out:"$(OUTDIR)\ApacheModuleRewrite.dll"\
    /implib:"$(OUTDIR)\ApacheModuleRewrite.lib" 
   LINK32_OBJS= \
  -	"$(INTDIR)\mod_rewrite.obj"
  +	"$(INTDIR)\mod_rewrite.obj" \
  +	"$(INTDIR)\passwd.obj"
   
   "$(OUTDIR)\ApacheModuleRewrite.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
       $(LINK32) @<<
  @@ -179,6 +183,16 @@
   !IF "$(CFG)" == "ApacheModuleRewrite - Win32 Release" || "$(CFG)" ==\
    "ApacheModuleRewrite - Win32 Debug"
   SOURCE=..\..\modules\standard\mod_rewrite.c
  +
  +!IF  "$(CFG)" == "ApacheModuleRewrite - Win32 Release"
  +
  +
  +"$(INTDIR)\mod_rewrite.obj" : $(SOURCE) "$(INTDIR)"
  +	$(CPP) $(CPP_PROJ) $(SOURCE)
  +
  +
  +!ELSEIF  "$(CFG)" == "ApacheModuleRewrite - Win32 Debug"
  +
   DEP_CPP_MOD_R=\
   	"..\..\main\alloc.h"\
   	"..\..\main\buff.h"\
  @@ -190,7 +204,9 @@
   	"..\..\main\httpd.h"\
   	"..\..\modules\standard\mod_rewrite.h"\
   	"..\..\regex\regex.h"\
  +	".\passwd.h"\
   	".\readdir.h"\
  +	{$(INCLUDE)}"sys\locking.h"\
   	{$(INCLUDE)}"sys\stat.h"\
   	{$(INCLUDE)}"sys\types.h"\
   	
  @@ -201,6 +217,27 @@
   "$(INTDIR)\mod_rewrite.obj" : $(SOURCE) $(DEP_CPP_MOD_R) "$(INTDIR)"
   	$(CPP) $(CPP_PROJ) $(SOURCE)
   
  +
  +!ENDIF 
  +
  +SOURCE=.\passwd.c
  +
  +!IF  "$(CFG)" == "ApacheModuleRewrite - Win32 Release"
  +
  +
  +"$(INTDIR)\passwd.obj" : $(SOURCE) "$(INTDIR)"
  +
  +
  +!ELSEIF  "$(CFG)" == "ApacheModuleRewrite - Win32 Debug"
  +
  +DEP_CPP_PASSW=\
  +	".\passwd.h"\
  +	
  +
  +"$(INTDIR)\passwd.obj" : $(SOURCE) $(DEP_CPP_PASSW) "$(INTDIR)"
  +
  +
  +!ENDIF 
   
   
   !ENDIF 
  
  
  
  1.1                  apachen/src/os/win32/passwd.c
  
  Index: passwd.c
  ===================================================================
  #include <stdio.h>
  #include "passwd.h"
  
  /* Very tacky implementation */
  
  struct passwd *getpwnam(const char *szUser)
  {
      static struct passwd pw;
  
      if(strlen(szUser) > _MAX_PATH-10)
  	return NULL;
  
      sprintf(pw.pw_dir,"c:/users/%s",szUser);
  
      return &pw;
  }
  
  
  
  1.1                  apachen/src/os/win32/passwd.h
  
  Index: passwd.h
  ===================================================================
  #include <stdlib.h>
  
  struct passwd
  {
      char pw_dir[_MAX_PATH];
  };
  
  struct passwd *getpwnam(const char *szUser);
  
  
  

Mime
View raw message