Skip to content

Commit

Permalink
inet_aton() -> inet_pton()
Browse files Browse the repository at this point in the history
  • Loading branch information
kein name committed Jul 25, 2023
1 parent f51443f commit 88a9724
Show file tree
Hide file tree
Showing 9 changed files with 7 additions and 253 deletions.
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ AX_TYPE_SOCKLEN_T
AX_CREATE_STDINT_H([eggint.h])

# Checks for functions and their arguments.
AC_CHECK_FUNCS([dprintf explicit_bzero explicit_memset getrandom inet_aton isascii memset_s random rand lrand48 snprintf strlcpy vsnprintf])
AC_CHECK_FUNCS([dprintf explicit_bzero explicit_memset getrandom isascii memset_s random rand lrand48 snprintf strlcpy vsnprintf])
AC_FUNC_SELECT_ARGTYPES
EGG_FUNC_B64_NTOP
AC_FUNC_MMAP
Expand Down
2 changes: 1 addition & 1 deletion src/compat/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ STRIP = @STRIP@
CFLAGS = @CFLAGS@ -I../.. -I$(top_srcdir) -I$(top_srcdir)/src @SSL_INCLUDES@ @DEFS@ $(CFLGS)
CPPFLAGS = @CPPFLAGS@

OBJS = base64.o explicit_bzero.o in6.o inet_aton.o snprintf.o strlcpy.o
OBJS = base64.o explicit_bzero.o in6.o snprintf.o strlcpy.o

doofus:
@echo ""
Expand Down
1 change: 0 additions & 1 deletion src/compat/compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#define _EGG_COMPAT_COMPAT_H

#include "base64.h"
#include "inet_aton.h"
#include "snprintf.h"
#include "explicit_bzero.h"
#include "strlcpy.h"
Expand Down
204 changes: 0 additions & 204 deletions src/compat/inet_aton.c

This file was deleted.

40 changes: 0 additions & 40 deletions src/compat/inet_aton.h

This file was deleted.

2 changes: 2 additions & 0 deletions src/eggdrop.h
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@ typedef uint32_t IP;

/* The following functions are for backward compatibility only */
#define egg_bzero(dest, len) memset(dest, 0, len)
#define egg_inet_aton(src, dst) inet_pton(AF_INET, src, dst)
#define egg_memcpy memcpy
#define egg_memset memset
#define egg_strcasecmp strcasecmp
Expand All @@ -340,6 +341,7 @@ typedef int (*IntFunc) ();

#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>

typedef struct {
int family;
Expand Down
2 changes: 1 addition & 1 deletion src/mod/dns.mod/dns.c
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ static char *dns_change(ClientData cdata, Tcl_Interp *irp,
} else
port = NAMESERVER_PORT; /* port 53 */
/* Ignore invalid addresses */
if (egg_inet_aton(list[i], &myres.nsaddr_list[myres.nscount].sin_addr)) {
if (inet_pton(AF_INET, list[i], &myres.nsaddr_list[myres.nscount].sin_addr)) {
myres.nsaddr_list[myres.nscount].sin_port = htons(port);
myres.nsaddr_list[myres.nscount].sin_family = AF_INET;
myres.nscount++;
Expand Down
5 changes: 1 addition & 4 deletions src/mod/module.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,6 @@
#undef Assert

/* Compatibility functions. */
#ifdef egg_inet_aton
# undef egg_inet_aton
#endif
#ifdef egg_vsnprintf
# undef egg_vsnprintf
#endif
Expand Down Expand Up @@ -430,7 +427,7 @@ typedef void (*chanout_butfunc)(int, int, const char *, ...) ATTRIBUTE_FORMAT(pr
#define sock_has_data ((int(*)(int, int))global[248])
#define bots_in_subtree ((int (*)(tand_t *))global[249])
#define users_in_subtree ((int (*)(tand_t *))global[250])
#define egg_inet_aton ((int (*)(const char *cp, struct in_addr *addr))global[251])
/* was egg_inet_aton -- use inet_pton() instead */
/* 252 - 255 */
#define egg_snprintf (global[252])
#define egg_vsnprintf ((int (*)(char *, size_t, const char *, va_list))global[253])
Expand Down
2 changes: 1 addition & 1 deletion src/modules.c
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ Function global_table[] = {
(Function) sock_has_data,
(Function) bots_in_subtree,
(Function) users_in_subtree,
(Function) egg_inet_aton,
(Function) 0, /* was egg_inet_aton -- use inet_pton() instead */
/* 252 - 255 */
(Function) egg_snprintf,
(Function) egg_vsnprintf,
Expand Down

0 comments on commit 88a9724

Please sign in to comment.