Add files from parent branch HEAD:
[pkgsrcv2.git] / net / ipw / patches / patch-ab
1 $NetBSD$
2
3 --- ipw.c.orig  1999-03-30 08:04:12.000000000 +0100
4 +++ ipw.c       2006-06-30 19:22:53.000000000 +0100
5 @@ -257,7 +257,7 @@
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 */
12  
13  #define        BADCH   (int)'?'
14 @@ -275,9 +275,9 @@
15    static char *place = EMSG;   /* option letter processing */
16    register char *oli = NULL;   /* option letter list index */
17  
18 -  if (optreset || ! *place)
19 +  if (my_optreset || ! *place)
20      {                          /* update scanning pointer */
21 -      optreset = 0;
22 +      my_optreset = 0;
23        if (my_optind >= nargc || *(place = nargv[my_optind]) != '-')
24         {
25           place = EMSG;
26 @@ -782,7 +782,7 @@
27    if (!p)
28      return NULL;
29  
30 -  for (q = p + rwhois_prefix_len; *q && !isspace (*q); q++)
31 +  for (q = p + rwhois_prefix_len; *q && !isspace (*q) && *q != ':'; q++)
32      continue;
33    srvr_len = q - p;
34    server = (char *) xmalloc (srvr_len + 1);
35 @@ -1745,14 +1745,14 @@
36      {
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];
45  
46  try_next_addr:
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))
54         {
55           register char const *rwhois_data;
56 +         char const *orgname = strstr (whois_data, "OrgName:");
57  
58 -          if (!strncmp (whois_data, ripe1, sizeof ripe1 - 1))
59 +         if (orgname)
60 +           {
61 +             orgname += sizeof "OrgName:";
62 +             while (isspace (*orgname))
63 +               orgname++;
64 +           }
65 +          if (orgname && !strncmp (orgname, ripe1, sizeof ripe1 - 1))
66             {
67                if (try_ripe (dotted_quad))
68                  break;
69 @@ -1769,7 +1776,7 @@
70                  return 0;
71             }
72  
73 -          if (!strncmp (whois_data, ripe2, sizeof ripe2 - 1))
74 +          if (orgname && !strncmp (orgname, ripe2, sizeof ripe2 - 1))
75             {
76                if (try_ripe (dotted_quad))
77                  break;
78 @@ -1777,7 +1784,7 @@
79                  return 0;
80             }
81  
82 -          if (!strncmp (whois_data, apnic, sizeof apnic - 1))
83 +          if (orgname && !strncmp (orgname, apnic, sizeof apnic - 1))
84             {
85                if (try_apnic (dotted_quad))
86                  break;
87 @@ -1802,6 +1809,7 @@
88               goto try_next_addr;
89             }
90  
91 +#if 0  /* needs fixing */
92            if (!substr (whois_data, updated))
93              {
94                /* Handle a special case.  ARIN has returned to us a list of
95 @@ -1813,6 +1821,7 @@
96                if ((whois_data = arin_grunge (whois_data, addr)) == NULL)
97                 return 1;
98              }
99 +#endif
100           if ((rwhois_data = fetch_rwhois_data (whois_data, dotted_quad)))
101             return present_rwhois_style_results (rwhois_data, whois_data);
102           else