diff options
author | Dmitry Stogov <dmitry@php.net> | 2006-11-10 09:56:16 +0000 |
---|---|---|
committer | Dmitry Stogov <dmitry@php.net> | 2006-11-10 09:56:16 +0000 |
commit | 9fd2b6deb43c276e8c5421c04a6be5eb85390ace (patch) | |
tree | 3624c51221582bee178812416c19047e97e23e21 /win32 | |
parent | 126be8ec7c13258a3361d2ebc2f3e609831213d2 (diff) | |
download | php-git-9fd2b6deb43c276e8c5421c04a6be5eb85390ace.tar.gz |
Simplify the code base as this getpwd() was used only once
Diffstat (limited to 'win32')
-rw-r--r-- | win32/build/config.w32 | 2 | ||||
-rw-r--r-- | win32/build/config.w32.h.in | 2 | ||||
-rw-r--r-- | win32/glob.c | 8 | ||||
-rwxr-xr-x | win32/globals.c | 2 | ||||
-rw-r--r-- | win32/php5dll.dsp | 8 | ||||
-rw-r--r-- | win32/php5dllts.dsp | 8 | ||||
-rwxr-xr-x | win32/php_win32_globals.h | 8 | ||||
-rw-r--r-- | win32/pwd.c | 66 | ||||
-rw-r--r-- | win32/pwd.h | 38 |
9 files changed, 8 insertions, 134 deletions
diff --git a/win32/build/config.w32 b/win32/build/config.w32 index ef0c3fb2e6..3c37f9b722 100644 --- a/win32/build/config.w32 +++ b/win32/build/config.w32 @@ -264,7 +264,7 @@ ADD_SOURCES("main", "main.c snprintf.c spprintf.c safe_mode.c fopen_wrappers.c \ ADD_SOURCES("main/streams", "streams.c cast.c memory.c filter.c plain_wrapper.c \ userspace.c transports.c xp_socket.c mmap.c"); -ADD_SOURCES("win32", "crypt_win32.c flock.c glob.c md5crypt.c pwd.c readdir.c \ +ADD_SOURCES("win32", "crypt_win32.c flock.c glob.c md5crypt.c readdir.c \ registry.c select.c sendmail.c time.c wfile.c winutil.c wsyslog.c globals.c"); ADD_SOURCES("regex", "regcomp.c regerror.c regexec.c regfree.c"); diff --git a/win32/build/config.w32.h.in b/win32/build/config.w32.h.in index 512afe9177..8e472f65d2 100644 --- a/win32/build/config.w32.h.in +++ b/win32/build/config.w32.h.in @@ -100,7 +100,7 @@ #define HAVE_ASSERT_H 1 #define HAVE_FCNTL_H 1 #define HAVE_GRP_H 0 -#define HAVE_PWD_H 1 +#undef HAVE_PWD_H #define HAVE_STRING_H 1 #undef HAVE_SYS_FILE_H #undef HAVE_SYS_SOCKET_H diff --git a/win32/glob.c b/win32/glob.c index a8c2cd83e2..b369362c19 100644 --- a/win32/glob.c +++ b/win32/glob.c @@ -81,8 +81,6 @@ #include <dirent.h> #include <pwd.h> #include <unistd.h> -#else -#include "win32/pwd.h" #endif #include <errno.h> #include "glob.h" @@ -359,7 +357,9 @@ globtilde(pattern, patbuf, patbuf_len, pglob) size_t patbuf_len; glob_t *pglob; { +#ifndef PHP_WIN32 struct passwd *pwd; +#endif char *h; const Char *p; Char *b, *eb; @@ -399,10 +399,14 @@ globtilde(pattern, patbuf, patbuf_len, pglob) /* * Expand a ~user */ +#ifndef PHP_WIN32 if ((pwd = getpwnam((char*) patbuf)) == NULL) return pattern; else h = pwd->pw_dir; +#else + return pattern; +#endif } /* Copy the home directory */ diff --git a/win32/globals.c b/win32/globals.c index eee53cb5a9..ae9120095c 100755 --- a/win32/globals.c +++ b/win32/globals.c @@ -43,8 +43,6 @@ PHP_RSHUTDOWN_FUNCTION(win32_core_globals) #endif ; - STR_FREE(wg->login_name); - memset(wg, 0, sizeof(*wg)); return SUCCESS; } diff --git a/win32/php5dll.dsp b/win32/php5dll.dsp index 891a0438f0..24e4227a04 100644 --- a/win32/php5dll.dsp +++ b/win32/php5dll.dsp @@ -1552,10 +1552,6 @@ SOURCE=..\ext\com\conversion.c # End Source File
# Begin Source File
-SOURCE=..\win32\pwd.c
-# End Source File
-# Begin Source File
-
SOURCE=..\win32\readdir.c
# End Source File
# Begin Source File
@@ -1628,10 +1624,6 @@ SOURCE=..\ext\com\php_versioning.h # End Source File
# Begin Source File
-SOURCE=..\win32\pwd.h
-# End Source File
-# Begin Source File
-
SOURCE=..\win32\readdir.h
# End Source File
# Begin Source File
diff --git a/win32/php5dllts.dsp b/win32/php5dllts.dsp index 3a2c194c6f..d9bf1882a1 100644 --- a/win32/php5dllts.dsp +++ b/win32/php5dllts.dsp @@ -2391,10 +2391,6 @@ SOURCE=.\md5crypt.c # End Source File
# Begin Source File
-SOURCE=..\win32\pwd.c
-# End Source File
-# Begin Source File
-
SOURCE=..\win32\readdir.c
# End Source File
# Begin Source File
@@ -2480,10 +2476,6 @@ SOURCE=..\win32\php_registry.h # End Source File
# Begin Source File
-SOURCE=..\win32\pwd.h
-# End Source File
-# Begin Source File
-
SOURCE=..\win32\readdir.h
# End Source File
# Begin Source File
diff --git a/win32/php_win32_globals.h b/win32/php_win32_globals.h index 89caed1a37..c130d5bc50 100755 --- a/win32/php_win32_globals.h +++ b/win32/php_win32_globals.h @@ -23,8 +23,6 @@ /* misc globals for thread-safety under win32 */ -#include "pwd.h" - typedef struct _php_win32_core_globals php_win32_core_globals; #ifdef ZTS @@ -40,12 +38,6 @@ struct _php_win32_core_globals { char *log_header; HANDLE log_source; - /* getpwuid */ - struct passwd pwd; - - /* getlogin */ - char *login_name; - /* time */ struct timeval starttime; __int64 lasttime, freq; diff --git a/win32/pwd.c b/win32/pwd.c deleted file mode 100644 index 092740e249..0000000000 --- a/win32/pwd.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP Version 5 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-2006 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 3.01 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available through the world-wide-web at the following url: | - | http://www.php.net/license/3_01.txt | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Author: Sterling Hughes <sterling@php.net> | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#include "php.h" /*php specific */ -#include <lmaccess.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <lmapibuf.h> -#include "pwd.h" -#include "grp.h" -#include "php_win32_globals.h" - -static char *home_dir = "."; -static char *login_shell = "not command.com!"; - -struct passwd * -getpwnam(char *name) -{ - return (struct passwd *) 0; -} - - -char * -getlogin() -{ - char name[256]; - DWORD max_len = 256; - TSRMLS_FETCH(); - - STR_FREE(PW32G(login_name)); - GetUserName(name, &max_len); - name[max_len] = '\0'; - PW32G(login_name) = estrdup(name); - return PW32G(login_name); -} - -struct passwd * -getpwuid(int user_id) -{ - TSRMLS_FETCH(); - PW32G(pwd).pw_name = getlogin(); - PW32G(pwd).pw_dir = home_dir; - PW32G(pwd).pw_shell = login_shell; - PW32G(pwd).pw_uid = 0; - - return &PW32G(pwd); -} - diff --git a/win32/pwd.h b/win32/pwd.h deleted file mode 100644 index 597f60c48c..0000000000 --- a/win32/pwd.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP Version 5 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-2006 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 3.01 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available through the world-wide-web at the following url: | - | http://www.php.net/license/3_01.txt | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Author: Sterling Hughes <sterling@php.net> | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -#ifndef PWD_H -#define PWD_H - -struct passwd { - char *pw_name; - char *pw_passwd; - int pw_uid; - int pw_gid; - char *pw_comment; - char *pw_gecos; - char *pw_dir; - char *pw_shell; -}; - -extern struct passwd *getpwuid(int); -extern struct passwd *getpwnam(char *name); -extern char *getlogin(void); -#endif |