diff options
author | Zeev Suraski <zeev@php.net> | 1999-04-21 19:01:38 +0000 |
---|---|---|
committer | Zeev Suraski <zeev@php.net> | 1999-04-21 19:01:38 +0000 |
commit | 751709a469d4b878edb714a158affa8ca6d6abc0 (patch) | |
tree | b101ee2de589eab1a94de38c38ab96063890e512 | |
parent | 065636be85aae0602a6255642e031ab62966dd90 (diff) | |
download | php-git-751709a469d4b878edb714a158affa8ca6d6abc0.tar.gz |
* Rename php_compat.[ch] to flock_compat.[ch] and move it to ext/standard
* Fix Win32 compilation
-rw-r--r-- | Makefile.in | 4 | ||||
-rw-r--r-- | ext/standard/Makefile.am | 2 | ||||
-rw-r--r-- | ext/standard/file.c | 4 | ||||
-rw-r--r-- | ext/standard/flock_compat.c (renamed from php_compat.c) | 7 | ||||
-rw-r--r-- | ext/standard/flock_compat.h | 21 | ||||
-rw-r--r-- | ext/standard/string.c | 2 | ||||
-rw-r--r-- | main/config.w32.h | 2 | ||||
-rw-r--r-- | main/php.h | 2 | ||||
-rw-r--r-- | main/php_compat.h | 39 | ||||
-rw-r--r-- | php4.dsp | 8 |
10 files changed, 40 insertions, 51 deletions
diff --git a/Makefile.in b/Makefile.in index 90185c5956..876fc4d446 100644 --- a/Makefile.in +++ b/Makefile.in @@ -62,11 +62,11 @@ WARNING_LEVEL = @WARNING_LEVEL@ SOURCE = main.c internal_functions.c snprintf.c php3_sprintf.c \ configuration-parser.c configuration-scanner.c request_info.c \ safe_mode.c fopen-wrappers.c php3_realpath.c alloca.c output.c \ - php_ini.c php_compat.c + php_ini.c OBJS = main.o internal_functions.o snprintf.o php3_sprintf.o \ configuration-parser.o configuration-scanner.o request_info.o \ safe_mode.o fopen-wrappers.o php3_realpath.o alloca.o output.o \ - php_ini.o php_compat.o + php_ini.o FUNCTIONS_SOURCE = functions/apache.c functions/fhttpd.c \ functions/crypt.c functions/db.c functions/dl.c functions/filepro.c \ diff --git a/ext/standard/Makefile.am b/ext/standard/Makefile.am index 0a7617147b..5de911d484 100644 --- a/ext/standard/Makefile.am +++ b/ext/standard/Makefile.am @@ -7,5 +7,5 @@ libphpext_standard_a_SOURCES=\ html.c image.c info.c link.c mail.c math.c md5.c microtime.c \ pack.c pageinfo.c rand.c reg.c soundex.c string.c \ syslog.c type.c uniqid.c url.c iptc.c var.c quot_print.c \ - cyr_convert.c + cyr_convert.c flock_compat.c diff --git a/ext/standard/file.c b/ext/standard/file.c index 066c69420b..8886db2669 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -13,7 +13,7 @@ | | | B) the PHP License as published by the PHP Development Team and | | included in the distribution in the file: LICENSE | - | | + | | | This program is distributed in the hope that it will be useful, | | but WITHOUT ANY WARRANTY; without even the implied warranty of | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | @@ -32,6 +32,7 @@ #endif #include "php.h" #include "php_globals.h" +#include "ext/standard/flock_compat.h" #include <stdio.h> #include <stdlib.h> @@ -211,6 +212,7 @@ php3_module_entry php3_file_module_entry = { "PHP_file", php3_file_functions, php3_minit_file, NULL, NULL, NULL, NULL, STANDARD_MODULE_PROPERTIES }; + static int flock_values[] = { LOCK_SH, LOCK_EX, LOCK_UN }; /* {{{ proto bool flock(int fp, int operation) diff --git a/php_compat.c b/ext/standard/flock_compat.c index 736180ac6b..2d809a718f 100644 --- a/php_compat.c +++ b/ext/standard/flock_compat.c @@ -32,7 +32,7 @@ #include <php.h> #include <errno.h> -#include "php_compat.h" +#include "ext/standard/flock_compat.h" #if HAVE_STRUCT_FLOCK #include <unistd.h> @@ -45,7 +45,7 @@ #endif #if !HAVE_FLOCK -PHPAPI int flock(int fd, int operation) +int flock(int fd, int operation) #if HAVE_STRUCT_FLOCK { struct flock flck; @@ -173,8 +173,7 @@ PHPAPI int flock(int fd, int operation) * cannot distinguish between failure and a local broadcast address. */ -PHPAPI int -inet_aton(const char *cp, struct in_addr *ap) +int inet_aton(const char *cp, struct in_addr *ap) { int dots = 0; register unsigned long acc = 0, addr = 0; diff --git a/ext/standard/flock_compat.h b/ext/standard/flock_compat.h new file mode 100644 index 0000000000..9478fef776 --- /dev/null +++ b/ext/standard/flock_compat.h @@ -0,0 +1,21 @@ +#ifndef _FLOCK_COMPAT_H +#define _FLOCK_COMPAT_H + +#if !HAVE_FLOCK +# define LOCK_SH 1 +# define LOCK_EX 2 +# define LOCK_NB 4 +# define LOCK_UN 8 +int flock(int fd, int operation); +#endif + +#if WIN32|WINNT +# define fsync _commit +# define ftruncate chsize +#endif /* WIN32|WINNT */ + +#if !HAVE_INET_ATON +extern int inet_aton(const char *, struct in_addr *); +#endif + +#endif /* _FLOCK_COMPAT_H */ diff --git a/ext/standard/string.c b/ext/standard/string.c index b9db2614b9..43457ba44a 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -1297,7 +1297,7 @@ static char *_php3_memstr(char *s, char *c, size_t n, size_t m) { char *p; - for(p = s; (p - s) < n; p++) + for(p = s; ((size_t) (p - s)) < n; p++) if(memcmp(p, c, m) == 0) return p; return NULL; diff --git a/main/config.w32.h b/main/config.w32.h index 141287ae55..b3e4173a7b 100644 --- a/main/config.w32.h +++ b/main/config.w32.h @@ -108,7 +108,7 @@ #define HAVE_TZSET 1 /* Define if you have the flock function. */ -#define HAVE_FLOCK 1 +#define HAVE_FLOCK 0 /* Define if using alloca.c. */ /* #undef C_ALLOCA */ diff --git a/main/php.h b/main/php.h index 72434c7292..305724ff24 100644 --- a/main/php.h +++ b/main/php.h @@ -510,8 +510,6 @@ extern void phprestart(FILE *input_file); #define XtOffsetOf(s_type,field) XtOffset(s_type*,field) #endif -#include "php_compat.h" - #endif /* diff --git a/main/php_compat.h b/main/php_compat.h deleted file mode 100644 index 2c4aa3e0bf..0000000000 --- a/main/php_compat.h +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef PHP_COMPAT_H -#define PHP_COMPAT_H - -#if (WIN32|WINNT) & HAVE_BINDLIB -#ifndef WINNT -#define WINNT 1 -#endif -#include "arpa/inet.h" -#include "netdb.h" -#include "arpa/nameser.h" -#include "resolv.h" -#endif - -#if !HAVE_FLOCK - -#define LOCK_SH 1 -#define LOCK_EX 2 -#define LOCK_NB 4 -#define LOCK_UN 8 - -extern PHPAPI int flock(int fd, int operation); - -#endif - -#if WIN32|WINNT - -/* These were in win32/flock.h, dunno if they are really needed - (or maybe break something) */ - -#define fsync _commit -#define ftruncate chsize - -#endif /* WIN32|WINNT */ - -#if !HAVE_INET_ATON -extern PHPAPI int inet_aton(const char *, struct in_addr *); -#endif - -#endif @@ -281,6 +281,10 @@ SOURCE=.\ext\standard\filestat.c # End Source File # Begin Source File +SOURCE=.\ext\standard\flock_compat.c +# End Source File +# Begin Source File + SOURCE=.\ext\standard\formatted_print.c # End Source File # Begin Source File @@ -421,6 +425,10 @@ SOURCE=.\ext\standard\file.h # End Source File # Begin Source File +SOURCE=.\ext\standard\flock_compat.h +# End Source File +# Begin Source File + SOURCE=.\ext\standard\fsock.h # End Source File # Begin Source File |