fixed for newer perl
[tridge/junkcode.git] / j.c
1        #include <sys/socket.h>
2        #include <netinet/in.h>
3        #include <arpa/inet.h>
4
5
6  int inet_xton(const char *cp, struct in_addr *inp)
7 {
8         if (strcmp(cp, "255.255.255.255") == 0) {
9                 inp->s_addr = (unsigned) -1;
10                 return 1;
11         }
12
13         inp->s_addr = inet_addr(cp);
14         if (inp->s_addr == (unsigned) -1) {
15                 return 0;
16         }
17         return 1;
18 }
19
20 main(int argc, char *argv[])
21 {
22         struct in_addr ip;
23         printf("%d\n", inet_xton(argv[1], &ip));
24 }