summaryrefslogtreecommitdiff
path: root/src/common/socket.c
diff options
context:
space:
mode:
authorultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-04-07 12:06:25 +0000
committerultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-04-07 12:06:25 +0000
commit8c1bb7b498aae6203289dd9295e187b05c8b7014 (patch)
treebaabad310c3bef2983e12c33ff3bb417f5230a8d /src/common/socket.c
parentba13e8d6612aaddebe640d0538f9bb859b600ba2 (diff)
downloadhercules-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/socket.c')
-rw-r--r--src/common/socket.c7
1 files changed, 7 insertions, 0 deletions
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));
+}