3 --- ipw.c.orig 1999-03-30 08:04:12.000000000 +0100
4 +++ ipw.c 2006-06-30 19:22:53.000000000 +0100
6 static int my_opterr = 1; /* if error message should be printed */
7 static int my_optind = 1; /* index into parent argv vector */
8 static int my_optopt; /* character checked for validity */
9 -static int optreset; /* reset getopt */
10 +static int my_optreset; /* reset getopt */
11 static char *my_optarg; /* argument associated with option */
13 #define BADCH (int)'?'
15 static char *place = EMSG; /* option letter processing */
16 register char *oli = NULL; /* option letter list index */
18 - if (optreset || ! *place)
19 + if (my_optreset || ! *place)
20 { /* update scanning pointer */
23 if (my_optind >= nargc || *(place = nargv[my_optind]) != '-')
30 - for (q = p + rwhois_prefix_len; *q && !isspace (*q); q++)
31 + for (q = p + rwhois_prefix_len; *q && !isspace (*q) && *q != ':'; q++)
34 server = (char *) xmalloc (srvr_len + 1);
35 @@ -1745,14 +1745,14 @@
37 static char const ripe1[] = "European Regional Internet Registry/RIPE";
38 static char const ripe2[] = "RIPE NCC (NET-RIPE-NCC-";
39 - static char const apnic[] = "Asia Pacific Network Information Center";
40 + static char const apnic[] = "Asia Pacific Network Information Centre";
41 static char const nomatch[] = "No match";
42 static char const updated[] = "Record last updated on ";
43 static char const hostname[] = "Hostname:";
44 auto char arin_query[200];
47 - strcpy (arin_query, "net ");
48 + strcpy (arin_query, "n ");
49 strcat (arin_query, dotted_blockname);
50 whois_data = whois (arin_server, arin_query);
51 if (whois_data == NULL) /* Server must be down! */
52 @@ -1760,8 +1760,15 @@
53 if (strncmp (whois_data, nomatch, sizeof nomatch -1))
55 register char const *rwhois_data;
56 + char const *orgname = strstr (whois_data, "OrgName:");
58 - if (!strncmp (whois_data, ripe1, sizeof ripe1 - 1))
61 + orgname += sizeof "OrgName:";
62 + while (isspace (*orgname))
65 + if (orgname && !strncmp (orgname, ripe1, sizeof ripe1 - 1))
67 if (try_ripe (dotted_quad))
73 - if (!strncmp (whois_data, ripe2, sizeof ripe2 - 1))
74 + if (orgname && !strncmp (orgname, ripe2, sizeof ripe2 - 1))
76 if (try_ripe (dotted_quad))
82 - if (!strncmp (whois_data, apnic, sizeof apnic - 1))
83 + if (orgname && !strncmp (orgname, apnic, sizeof apnic - 1))
85 if (try_apnic (dotted_quad))
91 +#if 0 /* needs fixing */
92 if (!substr (whois_data, updated))
94 /* Handle a special case. ARIN has returned to us a list of
96 if ((whois_data = arin_grunge (whois_data, addr)) == NULL)
100 if ((rwhois_data = fetch_rwhois_data (whois_data, dotted_quad)))
101 return present_rwhois_style_results (rwhois_data, whois_data);