diff options
author | ultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2007-04-07 12:06:25 +0000 |
---|---|---|
committer | ultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2007-04-07 12:06:25 +0000 |
commit | 8c1bb7b498aae6203289dd9295e187b05c8b7014 (patch) | |
tree | baabad310c3bef2983e12c33ff3bb417f5230a8d /src/common | |
parent | ba13e8d6612aaddebe640d0538f9bb859b600ba2 (diff) | |
download | hercules-8c1bb7b498aae6203289dd9295e187b05c8b7014.tar.gz hercules-8c1bb7b498aae6203289dd9295e187b05c8b7014.tar.bz2 hercules-8c1bb7b498aae6203289dd9295e187b05c8b7014.tar.xz hercules-8c1bb7b498aae6203289dd9295e187b05c8b7014.zip |
- Added function str2ip() to do platform-safe conversions
- Removed a bunch of unused stuff
- Moved SIGILL to unix-only defines since tests and docs show that Windows doesn't issue SIGILL
- Fixed several annoying compilation warnings
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@10177 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/core.c | 21 | ||||
-rw-r--r-- | src/common/core.h | 1 | ||||
-rw-r--r-- | src/common/mmo.h | 2 | ||||
-rw-r--r-- | src/common/socket.c | 7 | ||||
-rw-r--r-- | src/common/socket.h | 1 | ||||
-rw-r--r-- | src/common/utils.h | 4 |
6 files changed, 13 insertions, 23 deletions
diff --git a/src/common/core.c b/src/common/core.c index d38f1597a..33b855d87 100644 --- a/src/common/core.c +++ b/src/common/core.c @@ -32,18 +32,9 @@ char **arg_v = NULL; char *SERVER_NAME = NULL; char SERVER_TYPE = ATHENA_SERVER_NONE; -static void (*term_func)(void) = NULL; #ifndef SVNVERSION static char eA_svn_version[10]; #endif -/*====================================== - * CORE : Set function - *-------------------------------------- - */ -void set_termfunc(void (*termfunc)(void)) -{ - term_func = termfunc; -} #ifndef MINICORE // minimalist Core // Added by Gabuzomeu @@ -120,9 +111,8 @@ void signals_init (void) compat_signal(SIGSEGV, sig_proc); compat_signal(SIGFPE, sig_proc); #endif - // Signal to create coredumps by system when necessary (crash) - compat_signal(SIGILL, SIG_DFL); #ifndef _WIN32 + compat_signal(SIGILL, SIG_DFL); compat_signal(SIGXFSZ, sig_proc); compat_signal(SIGPIPE, sig_proc); compat_signal(SIGBUS, SIG_DFL); @@ -189,10 +179,8 @@ const char* get_svn_revision(void) */ static void display_title(void) { - //The clearscreeen is usually more of an annoyance than anything else... [Skotlex] -// ClearScreen(); // clear screen and go up/left (0, 0 position in text) - //ShowMessage("\n"); //A blank message?? - printf("\n"); + //ClearScreen(); // clear screen and go up/left (0, 0 position in text) + ShowMessage("\n"); ShowMessage(""CL_WTBL" (=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=)"CL_CLL""CL_NORMAL"\n"); // white writing (37) on blue background (44), \033[K clean until end of file ShowMessage(""CL_XXBL" ("CL_BT_YELLOW" (c)2005 eAthena Development Team presents "CL_XXBL")"CL_CLL""CL_NORMAL"\n"); // yellow writing (33) ShowMessage(""CL_XXBL" ("CL_BOLD" ______ __ __ "CL_XXBL")"CL_CLL""CL_NORMAL"\n"); // 1: bold char, 0: normal char @@ -213,7 +201,8 @@ static void display_title(void) } // Warning if logged in as superuser (root) -void usercheck(void){ +void usercheck(void) +{ #ifndef _WIN32 if ((getuid() == 0) && (getgid() == 0)) { ShowWarning ("You are running eAthena as the root superuser.\n"); diff --git a/src/common/core.h b/src/common/core.h index f59a87e3e..7784a95bb 100644 --- a/src/common/core.h +++ b/src/common/core.h @@ -17,7 +17,6 @@ extern int parse_console(char* buf); extern const char *get_svn_revision(void); extern int do_init(int,char**); extern void set_server_type(void); -extern void set_termfunc(void (*termfunc)(void)); extern void do_abort(void); extern void do_final(void); diff --git a/src/common/mmo.h b/src/common/mmo.h index 8d5071cc2..75b741697 100644 --- a/src/common/mmo.h +++ b/src/common/mmo.h @@ -503,8 +503,6 @@ enum { #define strnicmp strncasecmp #endif #else - #define snprintf _snprintf - #define vsnprintf _vsnprintf #ifndef strncmpi #define strncmpi strnicmp #endif diff --git a/src/common/socket.c b/src/common/socket.c index b2c9810b4..6d89b26e6 100644 --- a/src/common/socket.c +++ b/src/common/socket.c @@ -57,6 +57,7 @@ #include "../common/timer.h" #include "../common/malloc.h" #include "../common/showmsg.h" +#include "../common/strlib.h" fd_set readfds; int fd_max; @@ -1110,3 +1111,9 @@ const char* ip2str(uint32 ip, char ip_str[16]) addr.s_addr = htonl(ip); return (ip_str == NULL) ? inet_ntoa(addr) : strncpy(ip_str, inet_ntoa(addr), 16); } + +// Converts a dot-formatted ip string into a numeric ip. +uint32 str2ip(const char* ip_str) +{ + return ntohl(inet_addr(ip_str)); +} diff --git a/src/common/socket.h b/src/common/socket.h index ba984eb3a..eae9baf72 100644 --- a/src/common/socket.h +++ b/src/common/socket.h @@ -128,6 +128,7 @@ void set_defaultparse(ParseFunc defaultparse); // hostname/ip conversion functions uint32 host2ip(const char* hostname); const char* ip2str(uint32 ip, char ip_str[16]); +uint32 str2ip(const char* ip_str); #define CONVIP(ip) (ip>>24)&0xFF,(ip>>16)&0xFF,(ip>>8)&0xFF,(ip>>0)&0xFF int socket_getips(uint32* ips, int max); diff --git a/src/common/utils.h b/src/common/utils.h index 496cbdde3..3fd0aeacc 100644 --- a/src/common/utils.h +++ b/src/common/utils.h @@ -6,10 +6,6 @@ #include <stdarg.h> -#ifndef NULL -#define NULL (void *)0 -#endif - void dump(unsigned char *buffer, int num); struct StringBuf { |