home *** CD-ROM | disk | FTP | other *** search
- /* Received from Brint Cooper
- last update 5 Jan 1996 by Carl Moore
- */
- #include <stdio.h>
- #include <ctype.h>
- /*
- areacode.c
- Translated from AREACODE.MAC.
- Ken Yap (ken@rochester.arpa, ..!rochester!ken).
-
- Compile: cc -O -o areacode areacode.c
- Run: areacode nnn nnn ...
-
- AREACODE.MAC Ver 1.3 as of November 20, 1984
- Ver. 1.3 added LA suburbs area code 818, added periods to
- messages (why not?), deleted double entry for area code 809,
- removed ungrammatical comma from ASCII string at MSG2: and
- added a space before the `$' in MSG2: so the first space in
- messages could be removed, providing an extra space for text
- without changing the SCAN3: routine's 58-character bias.
- This version provided for M80/L80 devotees courtesy of Irv
- Hoff's XLATE5.COM to prevent undue anxiety trying to find a
- copy of ASM.COM. It has not been tested, so bug fixes from
- Z80-land are more than welcome. - Bruce Morgen
-
- Ver. 1.2 added 718 area code for New York City, and fixed bug
- in area code 604-804 Harry Kaemmerer
-
- Ver. 1.1 update of area codes for new U.S. areas, Mexico, &
- Eastern Canada. Harvey G. Lord, Storrs, CT 06268
-
- Ver. 1.0 - January 2, 1981 by Kelly Smith
-
- AREACODE is used to display the region and state, specified
- by the user...very handy when someone leaves an area code
- number on a CBBS, but no city or state reference. Simple
- enough to use, just type AREACODE nnn<cr> (where 'nnn' is a
- three digit area code), and in return, you get a geographical
- region by city(s), and state. Sorry if your particular city
- is not represented, and feel free to add it as required...
-
- ** Entries must be in sorted order because binary search is used.
- */
-
- char *areacode[] = {
- "011the International Access Code",
- "201Hackensack, Morristown and Newark, New Jersey",
- "202Washington, District of Columbia",
- "203Bridgeport, New Haven and Stamford, Connecticut",
- "204all regions, Manitoba, CANADA",
- "205Birmingham and Huntsville, Alabama",
- "206Seattle and Tacoma, Washington",
- "207all regions, Maine",
- "208all regions, Idaho",
- "209Fresno and Stockton, California",
- "210San Antonio, Texas",
- "212New York City (Manhattan only), New York",
- "213Los Angeles, California",
- "214Dallas, Texas",
- "215Philadelphia and Quakertown, Pennsylvania",
- "216Cleveland, Ohio",
- "217Springfield and central Illinois",
- "218Duluth, Minnesota",
- "219Gary, Hammond, Michigan City and South Bend, Indiana",
- "242,as of 10-1996, Bahamas",
- "250,as of 10-1996, outside of Vancouver area, British Columbia, CANADA",
- "281an overlay on 713 area, Texas",
- "301Silver Spring and Frederick, Maryland",
- "302all regions, Delaware",
- "303Denver, Colorado",
- "304all regions, West Virginia",
- "305Key West and Miami, Florida",
- "306all regions, Saskatchewan, CANADA",
- "307all regions, Wyoming",
- "308North Platte and Scottsbluff, Nebraska",
- "309Bloomington, Normal and Peoria, Illinois",
- "310Beverly Hills, California",
- "312Chicago, Illinois (as of 10-1996, just downtown Chicago)",
- "313Detroit and Ann Arbor, Michigan",
- "314Saint Louis, Missouri",
- "315Syracuse and Utica, New York",
- "316Coffeyville, Dodge City and Wichita, Kansas",
- "317Indianapolis and Kokomo, Indiana",
- "318Lake Charles and Shreveport, Louisiana",
- "319Dubuque, Iowa",
- "320,as of 3-1996, St. Cloud, Minnesota",
- "330,as of 3-1996, Akron, Massillon and Youngstown, Ohio",
- "334Mobile and Montgomery, Alabama",
- "352Gainesville and Ocala, Florida",
- "360Bellingham, Olympia and Vancouver, Washington",
- "401all regions, Rhode Island",
- "402Lincoln and Omaha, Nebraska",
- "403Alberta, Yukon Territory and (Western) Northwest Territories, CANADA",
- "404Atlanta, Georgia",
- "405Oklahoma City, Oklahoma",
- "406all regions, Montana",
- "407Orlando, Florida",
- "408San Jose and Sunnyvale, California",
- "409Galveston, Texas",
- "410Baltimore and Annapolis, Maryland",
- "411the code used for local Directory Assistance in many areas",
- "412Pittsburgh, Indiana and Rochester, Pennsylvania",
- "413Springfield, Massachusetts",
- "414Green Bay, Milwaukee and Racine, Wisconsin",
- "415San Francisco, California",
- "416Toronto, Ontario, CANADA",
- "417Joplin and Springfield, Missouri",
- "418Quebec, Quebec, CANADA",
- "419Toledo, Ohio",
- "423Chattanooga, Knoxville and Kingsport, Tennessee",
- "441Bermuda",
- "456used for premium-rate calling (only used outside of +1)",
- "500used for Personal Number Service/AT&T, other carriers",
- "501all regions, Arkansas",
- "502Louisville, Paducah and Shelbyville, Kentucky",
- "503Portland, Oregon",
- "504Baton Rouge and New Orleans, Louisiana",
- "505all regions, New Mexico",
- "506all regions, New Brunswick, CANADA",
- "507Albert Lea and Rochester, Minnesota",
- "508Framingham and New Bedford, Massachusetts",
- "509Pullman, Spokane and Walla Walla, Washington",
- "510Oakland, California",
- "512Austin and Corpus Christi, Texas",
- "513Cincinnati and Dayton, Ohio",
- "514Montreal, CANADA",
- "515Des Moines and Mason City, Iowa",
- "516Hempstead, New York",
- "517Lansing and Saginaw, Michigan",
- "518Albany, Greenwich and Schenectady, New York",
- "519London, Ontario, CANADA",
- "520Flagstaff and Tucson, Arizona",
- "540Fredericksburg, Roanoke and Winchester, Virginia",
- "541Eugene, Oregon",
- "561to be used at a future time for West Palm Beach, Florida",
- "562as of 2-1997, Long Beach, California",
- "573Cape Girardeau and Jefferson City, Missouri",
- "601all regions, Mississippi",
- "602Phoenix, Arizona",
- "603all regions, New Hampshire",
- "604Vancouver, British Columbia, CANADA",
- "605all regions, South Dakota",
- "606Ashland and Winchester, Kentucky",
- "607Elmira, Ithaca and Stamford, New York",
- "608Beloit and Madison, Wisconsin",
- "609Atlantic City, Camden and Trenton, New Jersey",
- "610Allentown, Reading and Chester, Pennsylvania",
- "611the code used for telephone repair service in many areas",
- "612Minneapolis and Saint Paul, Minnesota",
- "613Ottawa, Ontario, CANADA",
- "614Columbus, Marietta and Newark, Ohio",
- "615Nashville, Tennessee",
- "616Battle Creek, Cadillac and Grand Rapids, Michigan",
- "617Boston, Massachusetts",
- "618Alton, Mount Vernon and Centralia, Illinois",
- "619San Diego, California",
- "626as of 1997(?), an overlay or split of 818 in California",
- "630as of 8-1996, Aurora, Oak Park (west suburbs of Chicago), Illinois",
- "700used for Value Added Special Services, per individual carrier",
- "701all regions, North Dakota",
- "702all regions, Nevada",
- "703Arlington and Manassas, Virginia",
- "704Charlotte and Salisbury, North Carolina",
- "705North Bay, Ontario, CANADA",
- "706Augusta, Columbus and Rome, Georgia",
- "707Eureka, Napa and Santa Rosa, California",
- "708as of 8-1996, Calumet City, Harvey (south suburbs of Chicago), Illinois",
- "709all regions, Newfoundland and Labrador, CANADA",
- "710Federal Government Special Services",
- "712Council Bluffs, Iowa",
- "713Houston, Texas",
- "714Orange and Anaheim, California",
- "715Eau Claire and Wausau, Wisconsin",
- "716Buffalo, Niagara Falls and Rochester, New York",
- "717Harrisburg, Scranton and Wilkes-Barre, Pennsylvania",
- "718New York City (Bronx, Brooklyn, Queens, Staten Island), New York",
- "719Colorado Springs, Colorado",
- "760as of 3-1997, Palm Springs and the Imperial Valley, California",
- "770Marietta, Georgia",
- "773as of 10-1996, Chicago, Illinois (except downtown area is 312)",
- "800used for In-WATS Toll Free Calling",
- "801all regions, Utah",
- "802all regions, Vermont",
- "803Charleston, Columbia and Florence, South Carolina",
- "804Charlottesville, Norfolk and Richmond, Virginia",
- "805Bakersfield, Ventura and Simi Valley, California",
- "806Amarillo, Texas",
- "807Thunder Bay, Ontario, CANADA",
- "808all regions, Hawaii",
- "809Puerto Rico, the Virgin Islands, etc.",
- "810Flint and Pontiac, Michigan",
- "812Evansville, Indiana",
- "813Clearwater, St. Petersburg and Tampa, Florida",
- "814Altoona, Erie and Punxsutawney, Pennsylvania",
- "815La Salle, Joliet and Rockford, Illinois",
- "816Kansas City and Saint Joseph, Missouri",
- "817Fort Worth, Temple and Waco, Texas",
- "818the suburban area north of Los Angeles, California",
- "819Hull and Sherbrooke, (Western) Quebec and (Eastern) NW Territories, CANADA",
- "847Evanston, Glenview, Skokie, Waukegan, (north suburbs of Chicago), Illinois",
- "860Hartford, Connecticut",
- "864Greenville and Spartanburg, South Carolina",
- "900used for Mass Calling Value Added Information Services",
- "901Memphis, Tennessee",
- "902all regions, Prince Edward Island and Nova Scotia, CANADA",
- "903Tyler and Texarkana, Texas",
- "904Jacksonville and Pensacola, Florida",
- "905Hamilton and Niagara Falls, Ontario, CANADA",
- "906Sault Ste. Marie, Michigan",
- "907all regions, Alaska",
- "908Elizabeth and New Brunswick, New Jersey",
- "909Riverside and San Bernardino, California",
- "910Winston-Salem, Greensboro and Fayetteville, North Carolina",
- "911the code used for Police/Fire emergencies in most areas",
- "912Waycross and Savannah, Georgia",
- "913Ottawa and Topeka, Kansas",
- "914Monroe, Mount Vernon and Poughkeepsie, New York",
- "915El Paso, Texas",
- "916Sacramento and South Tahoe, California",
- "917New York City (cellular/pager only overlaid on 212/718), New York",
- "918Muskogee and Tulsa, Oklahoma",
- "919Greenville, Raleigh and Williamston, North Carolina",
- "941Avon Park, Fort Myers and Winter Haven, Florida",
- "954Fort Lauderdale, Florida",
- "970Fort Collins, Grand Junction and Vail, Colorado",
- "972an overlay on 214 area, Texas"
- };
-
- char *where(code)
- char *code;
- {
- register int i, high, low, mid;
- int strncmp();
-
- low = 0; high = sizeof(areacode) / sizeof(areacode[0]);
- while (low <= high)
- {
- mid = (low + high) / 2;
- i = strncmp(code, areacode[mid], 3);
- if (i < 0)
- high = mid - 1;
- else if (i > 0)
- low = mid + 1;
- else
- return (areacode[mid] + 3);
- }
- return ("not a valid area code");
- }
-
- area(code)
- char *code;
- {
- char *where();
-
- if (!isdigit(code[0]) || !isdigit(code[1]) || !isdigit(code[2])
- || code[3] != '\0')
- printf("Area code %s is not a valid area code!\n", code);
- else
- printf("Area code %s is %s. \n", code, where(code));
- }
-
- main(argc, argv)
- int argc;
- char *argv[];
- {
- if (argc < 2)
- {
- printf("Usage: areacode nnn nnn ...\n");
- exit(1);
- }
-
- for (--argc, ++argv; argc > 0; --argc, ++argv)
- area(*argv);
- }
-
-