/* ani.c Translated from AREACODE.MAC. AREACODE.MAC Ver 1.3 as of November 20, 1984 Ken Yap (ken@rochester.arpa, ..!rochester!ken). Compile: gcc ani.c -o ain Run: ani NPA NPA ... ** Entries must be in sorted order because binary search is used. */ #include #include char *ani[] = { "201958 Hackensack/Jersey City/Newark/Paterson, NJ", "202811 District of Columbia", "203970 CT", "204644-4444 Manitoba", "205Alabama: 300-222-2222 Birmingham, 300-555-5555, 300-648-1111 Dora, 300-765-4321 Bessemer, 300-798-1111 Birmingham, 557-2311 Birmingham, 811 Pell/Lincoln, 841-1111 Tarrant, 908-222-2222 Birmingham", "206411 WA (Not US West)", "207ME: 200-222-2222, 958 ME", "209211-9779, 830-2121 Stockton, CA", "210830, 951 Brownsville/Laredo/San Antonio, TX", "212958 Manhattan, NY", "213Los Angeles, CA: 114 (GTE 2EAX, DMS100, GTD-5), 1223 (1AESS, 5ESS), 211-2345 (English response), 211-2346 (DTMF response), 760-2??? (DMS switches), 61056", "214Dallas, TX: 570, 790 (GTE), 970 (GTE), 970-222-2222 (SWB), 970-x11-1111 (SWB)", "215Philadelphia, PA: 410-xxxx, 511, 958", "216Akron/Canton/Cleveland/Lorain/Youngstown, OH: 200-xxxx, 331, 959-9892", "217200-xxx-xxxx Champaign-Urbana/Springfield, IL", "219Gary/Hammond/Michigan City/Southbend, IN: 550, 559", "301Hagerstown/Rockville, MD: 2002006969, 958-9968", "303958 Aspen/Boulder/Denver/Durango/Grand Junction, CO", "305Key West/Miami, FL: 200-555-1212, 200200200200200, 780-2411", "306115 Saskatchewan", "310Long Beach, CA: 114 (GTE switches), 1223 (1AESS switches), 211-2345 (English), 211-2346 (DTMF response)", "312Chicago, IL: 200, 290, 1-200-8825 (last four change freq), 1-200-555-1212", "313Ann Arbor/Dearborn/Detroit, MI: 200-200-2002, 200-222-2222, 200-xxx-xxxx, 200200200200200, 958-1111 (GTE)", "314410-xxxx# Columbia/Jefferson City/St.Louis, MO", "315Syracuse/Utica, NY: 953, 958, 998", "317310-222-2222, 559-222-2222, 743-1218 Indianapolis/Kokomo, IN", "3345572411, 572311 Montgomery, AL", "401200-200-4444, 222-2222, 2002006969 RI", "402311 Lincoln, NE", "403311, 908-222-2222, 999 Alberta, Yukon and N.W. Territory", "404311, 780-2311, 940-xxx-xxxx,990 Atlanta, GA **** 404.988.9664 (nationwide - must use AT&T Carrier Access)", "405897, 890-7777777 Enid/Oklahoma City, OK", "407200-222-2222, 520-3111 Orlando/West Palm Beach, FL (Bell South)", "408760, 940, 300-xxx-xxxx San Jose, CA", "409951, 970-xxxx Beaumont/Galveston, TX", "410200-6969, 200-200-6969, 200-555-1212, 811 Annapolis/Baltimore, MD", "412711-6633, 711-4411, 999-xxxx Pittsburgh, PA", "413200-555-5555, 958 Pittsfield/Springfield, MA", "414330-2234 Fond du Lac/Green Bay/Milwaukee/Racine, WI", "415San Francisco, CA: 200-555-1212, 211-2111, 2222, 640, 760-2878, 600-2222", "416997-xxxx (Toronto), 997-1699 (Down Town/Riverdale), 997-8123 (Scarborough) Toronto, Ontario", "419311 Toledo, OH", "423200-200-200 Chatanooga, Johnson City, Knoxville , TN", "501511, 721-xxx-xxxx AR", "5022002222222, 997-555-1212 Frankfort/Louisville/Paducah/Shelbyville, KY", "503611, 999 Portland, OR", "504Baton Rouge/New Orleans, LA: 99882233, 201-269-1111, 998, 99851-0000000000", "5061-555-1313 New Brunswick", "508Fall River/New Bedford/Worchester, MA: 958, 200-222-1234, 200-222-2222, 26011", "509560 Spokane/Walla Walla/Yakima, WA", "510760-1111 (dead) Oakland, CA", "512830, 970-xxxx Austin/Corpus Christi, TX", "513380-55555555 Cincinnati/Dayton, OH", "514320-xxxx, 320-1232, 320-1223, 320-1233 Montreal, Quebec", "5155463, 811 Des Moines, IA", "516958, 968 Hempstead/Long Island, NY", "517Bay City/Jackson/lansing, MI: 200-222-2222, 200200200200200, 958-1111 (GTE)", "518511, 997, 998 Albany/Schenectady/Troy, NY", "519320-xxxx London, Ontario", "540211, 311 Roanoke, VA (GTE)", "541200 Bend, OR", "601200-222-2222 MS", "602958-3474 Phoenix, AZ", "603200-2222, 200-222-2222 NH", "6041116, 1211, 211 British Columbia", "606997-555-1212, 711 Ashland/Winchester, KY", "607993 Binghamton/Elmira, NY", "609958 Atlantic City/Camden/Trenton/Vineland, NJ", "610958, 958-4100 Allentown/Reading, PA", "612511 Minneapolis/St.Paul, MN", "613320-2232 (Ottawa), 320-5123/5124/9123/4567 (Kingston/Belleville/Southeast) Ottawa, Ontario", "614200, 571 Columbus/Steubenville, OH", "615200200200200200, 200-222-2222 Chatanooga/Knoxville/Nashville, TN", "615830 Nashville, TN", "616200-222-2222, 958-1111 Battle Creek/Grand Rapids/Kalamazoo, MI", "617200-222-1234, 220-2622, 200-222-2222, 200-444-4444, 958 Boston, MA", "618200-xxx-xxxx, 930 Alton/Cairo/Mt.Vernon, IL", "619211-2001, 211-2121 San Diego, CA", "659220-2622 Newmarket, NH", "703Virginia: 211, 511-3636 (Culpeper/Orange/Fredericksburg), 811 (Alexandria/Arlington/Roanoke)", "704311 Asheville/Charlotte, NC", "705320-4567 North Bay/Saulte Ste. Marie, Ontario", "706940-xxxx Augusta, GA", "707211-2222 (Eureka, CA), 611 (Crescent City, CA)", "708Chicago/Elgin, IL: 1-200-555-1212, 1-200-8825 (last four change freq), 200-6153, 724-9951", "713TX: 380 (houston), 970-xxxx (houston), 380-5555-5555 (houston), 380-5555-5555 (houston), 811 (Humble)", "714Anaheim, CA: 114 (GTE), 211-2121 (PacBell), 211-2222 (PacBell), 211-7777 (PacBell)", "716511, 990 Buffalo/Niagara Falls/Rochester, NY (Rochester Tel)", "717958 Harrisburg/Scranton/Wilkes-Barre, PA", "718958 Bronx/Brooklyn/Queens/Staten Island, NY", "770780-2311, 940-xxx-xxxx Marietta/Norcross, GA", "800No. No 800 ANI's given out. They die too quickly.", "802Vermont: 2-222-222-2222, 200-222-2222, 1-700-222-2222, 111-2222", "804211 (Richmond), 990 (Virginia Beach)", "805Bakersfield/Santa Barbara, CA: 114 (GTE), 211-1101, 211-2345 (voice), 211-2346 (DTMF), 830", "806970-xxxx Amarillo/Lubbock, TX", "810200200200200200, 311, 958-1111 (GTE) Flint/Pontiac/Southfield/Troy, MI", "812410-555-1212 Evansville, IN", "813311 Ft. Meyers/St. Petersburg/Tampa, FL", "815200-3374, 270-3374, 770-3374 Crystal Lake, IL", "815200-xxx-xxxx, 290 La Salle/Rockford, IL", "817211, 973-222-11111, 970-611-1111 (SWB) Ft. Worth/Waco, TX", "818Pasadena, CA: 114 (GTE), 1223 (1AESS), 211-2345 (english), 211-2346 (DTMF)", "819320-1112 Quebec", "860970 CT", "901899-?555 Memphis, TN", "903970-611-1111 Tyler, TX", "904200-222-222, 311, 780-2311 Jackonsville/Pensacola/Tallahasee, FL", "9061-200-222-2222, 958-1111 Marquette/Sault Ste. Marie, MI", "907811 Anchorage, AK", "908958 New Brunswick, NJ", "909111, 114 Riverside/San Bernardino, CA (GTE)", "910200, 311, 988 Fayetteville/Greensboro/Raleigh/Winston-Salem, NC", "912711, 780-2311 Albany/Savannah, GA", "914990-1111 Peekskill/Poughkeepsie/White Plains/Yonkers, NY", "915970-xxxx Abilene/El Paso, TX", "916211-0007 (PacBell), 461 (Roseville Telephone)", "919200, 711, 780-2411 Durham, NC", "954200-555-1212, 200200200200200, 780-2411 Ft. Lauderdale, FL", }; char *where(code) char *code; { register int i, high, low, mid; int strncmp(); low = 0; high = sizeof(ani) / sizeof(ani[0]); while (low <= high) { mid = (low + high) / 2; i = strncmp(code, ani[mid], 3); if (i < 0) high = mid - 1; else if (i > 0) low = mid + 1; else return (ani[mid] + 3); } return ("non-existant (or i don't know about it)"); } area(code) char *code; { char *where(); if (!isdigit(code[0]) || !isdigit(code[1]) || !isdigit(code[2]) || code[3] != '\0') printf("ANI for %s is not valid!\n", code); else printf("ANI for %s is %s. \n", code, where(code)); } main(argc, argv) int argc; char *argv[]; { int count; if (argc < 2) { printf("Usage: ani [npa] [npa] ...\n"); exit(1); } for (count = 1; count != argc + 1; count++) { if (count >= 3) { printf ("Error: I cannot accept that many values!\n"); exit (-1); } } for (--argc, ++argv; argc > 0; --argc, ++argv) area(*argv); }