1 # $NetBSD: nanpa.awk,v 1.2 2003/03/13 02:55:01 jhawk Exp $
4 # parse "http://docs.nanpa.com/cgi-bin/npa_reports/nanpa?
5 # function=list_npa_introduced" to produce parenthetical
6 # notes about what area codes are overlayed by others
9 function parse
(file
, ispipe
, isplanning
, i
, planinit
, t
)
12 while((ispipe?
(file
| getline):(getline < file
)) > 0) {
14 if (length($
0)==
0) continue;
17 if (!planinit
&& f
[2]==
"NEW NPA") {
21 } else if (planinit
&& length(f
[fnames
["NEW NPA"]])>1) {
22 t = f
[fnames
["LOCATION"]] FS;
23 if (f
[fnames
["OVERLAY?"]]==
"Yes")
24 t = t
"Overlay of " f
[fnames
["OLD NPA"]];
25 else if (f
[fnames
["OLD NPA"]])
26 t = t
"Split of " f
[fnames
["OLD NPA"]];
27 if (f
[fnames
["STATUS"]])
28 t = t
" (" f
[fnames
["STATUS"]] ")";
29 if (length(f
[fnames
["IN SERVICE DATE"]]) > 1)
31 f
[fnames
["IN SERVICE DATE"]];
32 data
[f
[fnames
["NEW NPA"]] "*"] = t
;
37 if (RSTART==
0) continue;
39 data
[substr($
0, 1, i
-1)]=
substr($
0,i
+1);
47 print "# $""NetBSD: $";
48 print "# Generated from http://www.nanpa.com/area_codes/index.html";
49 print "# (with local exceptions)";
52 print "# Area Code : Description : Detail : State/Province Abbrev.";
53 print "# (3rd and 4th fields optional)";
54 print "# A * in the Area Code field indicates a future area code."
57 "http://docs.nanpa.com/cgi-bin/npa_reports/nanpa\\?" \
58 "function=list_npa_geo_number | sed -f nanpa.sed", 1, 0);
60 "http://docs.nanpa.com/cgi-bin/npa_reports/nanpa\\?" \
61 "function=list_npa_non_geo | sed -f nanpa.sed", 1, 0);
63 "http://docs.nanpa.com/cgi-bin/npa_reports/nanpa\\?" \
64 "function=list_npa_not_in_service | sed -f nanpa.sed", 1, 1);
65 parse
("na.phone.add", 0, 0);
68 print i
FS data
[i
] | sort