From 3324e62bae6f04e4f16f113b2e3352fae242f405 Mon Sep 17 00:00:00 2001 From: "Robin Burchell w00t@inspircd.org" Date: Tue, 7 Oct 2008 23:38:25 +0000 Subject: Merge branch 'anopeng' into anopeng-config git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@1428 5417fbe8-f217-4b02-8779-1006273d7864 --- include/extern.h | 14 -------------- include/services.h | 6 ------ include/sysconf.h.in | 41 ----------------------------------------- include/sysconf.h.win32 | 4 ---- include/version.sh.c | 24 ++++++++++++++++-------- 5 files changed, 16 insertions(+), 73 deletions(-) (limited to 'include') diff --git a/include/extern.h b/include/extern.h index fa421edae..7135f7229 100644 --- a/include/extern.h +++ b/include/extern.h @@ -213,14 +213,6 @@ E char *get_mlock_modes(ChannelInfo * ci, int complete); /**** compat.c ****/ -#if !HAVE_SNPRINTF -# if BAD_SNPRINTF -# define snprintf my_snprintf -# endif -# define vsnprintf my_vsnprintf -E int vsnprintf(char *buf, size_t size, const char *fmt, va_list args); -E int snprintf(char *buf, size_t size, const char *fmt, ...); -#endif #if !HAVE_STRICMP && !HAVE_STRCASECMP E int stricmp(const char *s1, const char *s2); E int strnicmp(const char *s1, const char *s2, size_t len); @@ -231,12 +223,6 @@ E char *strdup(const char *s); #if !HAVE_STRSPN E size_t strspn(const char *s, const char *accept); #endif -#if !HAVE_STRERROR -E char *strerror(int errnum); -#endif -#if !HAVE_STRSIGNAL -char *strsignal(int signum); -#endif #ifdef _WIN32 char *sockstrerror(int error); #endif diff --git a/include/services.h b/include/services.h index 1160fb5c5..aafbb3ddc 100644 --- a/include/services.h +++ b/include/services.h @@ -23,12 +23,6 @@ #define MAX_CMD_HASH 1024 #endif -/* Some Linux boxes (or maybe glibc includes) require this for the - * prototype of strsignal(). */ -#ifndef _GNU_SOURCE -#define _GNU_SOURCE -#endif - /* Some SUN fixs */ #ifdef __sun /* Solaris specific code, types that do not exist in Solaris' diff --git a/include/sysconf.h.in b/include/sysconf.h.in index 3086d4250..f4b3f99e7 100644 --- a/include/sysconf.h.in +++ b/include/sysconf.h.in @@ -33,9 +33,6 @@ /* Define to 1 if you have the `setgrent' function. */ #undef HAVE_SETGRENT -/* Define to 1 if you have the `snprintf' function. */ -#undef HAVE_SNPRINTF - /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H @@ -48,9 +45,6 @@ /* Define to 1 if you have the `strdup' function. */ #undef HAVE_STRDUP -/* Define to 1 if you have the `strerror' function. */ -#undef HAVE_STRERROR - /* Define to 1 if you have the `stricmp' function. */ #undef HAVE_STRICMP @@ -66,15 +60,9 @@ /* Define to 1 if you have the `strlcpy' function. */ #undef HAVE_STRLCPY -/* Define to 1 if you have the `strsignal' function. */ -#undef HAVE_STRSIGNAL - /* Define to 1 if you have the `strspn' function. */ #undef HAVE_STRSPN -/* Define to 1 if you have the `sys_errlist' function. */ -#undef HAVE_SYS_ERRLIST - /* "" */ #undef HAVE_SYS_SELECT_H @@ -185,35 +173,6 @@ #ifdef __STRICT_ANSI__ #include #include - -/* We KNOW these are not ansi, we are defining them here to suppress the warning - * * s messages on a "make strict" compile */ -#ifndef snprintf -int snprintf(char *str, size_t size, const char *format, ...); -#endif -#ifndef vprintf -int vprintf(const char *format, va_list ap); -#endif -#ifndef vfprintf -int vfprintf(FILE *stream, const char *format, va_list ap); -#endif -#ifndef vsprintf -int vsprintf(char *str, const char *format, va_list ap); -#endif -#ifndef vsnprintf -int vsnprintf(char *str, size_t size, const char *format, va_list ap); -#endif - -FILE *popen(const char *command, const char *type); -int pclose(FILE *stream); -FILE *fdopen(int fildes, const char *mode); - -int ftruncate(int fd, off_t length); - -#ifdef HAVE_STRSIGNAL -char *strsignal(int sig); -#endif - #endif diff --git a/include/sysconf.h.win32 b/include/sysconf.h.win32 index a11694469..fb6d5a6e9 100644 --- a/include/sysconf.h.win32 +++ b/include/sysconf.h.win32 @@ -16,10 +16,6 @@ typedef unsigned __int8 u_int8_t; #define HAVE_SYS_SELECT_H 0 #define HAVE_SYS_SYSPROTO_H 0 -#define HAVE_STRERROR 1 -#define HAVE_SYS_ERRLIST 0 -#define HAVE_SNPRINTF 1 -#define BAD_SNPRINTF 0 #define HAVE_STRICMP 1 #define HAVE_STRCASECMP 0 #define HAVE_STRDUP 1 diff --git a/include/version.sh.c b/include/version.sh.c index f69fe8992..a3d0ba7e4 100644 --- a/include/version.sh.c +++ b/include/version.sh.c @@ -16,6 +16,8 @@ #include #include +#include +#include #define CTRL "version.log" @@ -46,10 +48,10 @@ int main() load_ctrl(fd); fclose(fd); - _snprintf(version, 1024, "%d.%d.%d%s (%d)", version_major, version_minor, + _snprintf(version, 1024, "%ld.%ld.%ld%s (%ld)", version_major, version_minor, version_patch, (version_extra ? version_extra : ""), version_build); - _snprintf(version_dotted, 1024, "%d.%d.%d%s.%d", version_major, version_minor, + _snprintf(version_dotted, 1024, "%ld.%ld.%ld%s.%ld", version_major, version_minor, version_patch, (version_extra ? version_extra : ""), version_build); fd = fopen("version.h", "r"); @@ -106,7 +108,11 @@ char *strip(char *str) long get_value(char *string) { - return atol(get_value_str(string)); + // XXX : if the fields in version.log are empty strtok returns a double quote, dont try to atol it then + if (*string != '"') + return atol(get_value_str(string)); + else + return 0; } char *get_value_str(char *string) @@ -165,10 +171,12 @@ void write_version(FILE * fd) strip(buf); if (until_eof) + { if (!strcmp(buf, "EOF")) break; else parse_line(fd, buf); + } if (!strcmp(buf, "cat >version.h <