Category : Databases and related files
Archive   : AREA3TC.ZIP
Filename : AREA3.C

 
Output of file : AREA3.C contained in archive : AREA3TC.ZIP
/* area.c 6/2/84
Telephone area code search program
(c) 1984 Martin Smith
Compuserve 72155,1214
310 Cinnamon Oak Lane (713) 661-1241 [Office]
Houston, Texas 77079 (713) 464-6737 [Home]

Find area codes by entering an area code or state name on the
command line. Multiple codes, names arepermitted up to 20,
the limit set forth for the C86 Computer Innovations(tm) compiler,
although your compiler may be different.
Program written for IBM-PC with PC-DOS 2.0, but no machine specific
code is involved, other than the GETTIME routine.

This code has been modified on 2/1/85 by the Device Driver to
(1) speed it up, (2) allow multiple names to be found, (3) add time
zones, (4) add foreign countries, (5) add new area codes.

Modified yet again on 11/30/85 to treat foreign codes as foreign and
not just as ordinary areacodes. Considerable data also added
and program adjusted to accept area codes of length 1 to 4 as required
for foreign codes. Program also slightly modified to accomadate version
2.20 of C86 compiler. (Gene Cohler)

The table is near the top of this file to make it easier to maintain.
Area codes don't change much, but just this year in Houston our
area code was broken off from the surrounding area.
The format of the table is simple, so adding cities to the city list
or even new states or regions won't upset the program if a few easy
rules are followed:

1) The table format is one array of string pointers.
2) A state name consists of a two character postal abbreviation,
like ca for California, and then the actual name,
a) All data on this line is lowercase. A multiple word name,
like New Jersey, would be entered as "njnew*jersey" , .
This prevents argv from making two arguments out of the name.
3) An area code is the three digit code, followed by whatever text.
a) As many area codes, cities as you want are ok.
b) Note the program depends on a state name not beginning with
a number. When a numeric code is searched and found, the
program goes back to the first non-numeric for the state name.
4) All entries need to be enclosed in quotes (") and followed by a
comma.
5) Countries are similar to states.
a) In place of 2 letter code there must be "--". This is used
by the program to distinguish countries from states.
b) The first entry (city code) following the country name
should be the country code for that country.
c) For foreign codes, always pad codes to 3 with blanks, but codes
may be up to four digits long.
6) Time zone follow the state name as (+n) for n hours after Eastern,
(-n) for n hours before Eastern, and (\t..) to add an extra 1/2
hour.

2/15/90 Modified to be compatible with Turbo C
Original gettime function changed to getthetime so not
to clash with Turbo C's gettime function.
sysint call changed to int86
dos.h added & regs modified in code

(Note: Still reports 2 warnings, but program runs ok)


*/

#include "stdio.h"
#include "ctype.h"
#include "dos.h"

int tme[10]; /* time date array */

main(argc,argv)
int argc;
char *argv[];
{
int i,satoi();
static char *dayno[] = {"Sun", "Mon", "Tue", "Wed", "Thurs", "Fri", "Sat"};
puts("\t-- Area Code Finder --");
getthetime(tme);
printf(" ");
otime(tme[1],tme[2]);
printf("\t%s %d/%d/%d\n\n", dayno[tme[5]], tme[7],tme[8],tme[6]);
if (argc==1)
{
puts("Program searches for telephone area codes,");
puts(" Use: AREA xxx xxx xxx ...\n");
puts(" where xxx can be:");
puts(" -An Area Code (like 914).");
puts(" -A foreign 1 to 4 digit country or city code");
puts(" -like 33 for France.");
puts(" -A two letter state postal code (as in TX for Texas).");
puts(" -The first few letters of the name (as in MASS or FR).");
puts(" -A two word names with * (as in New*Jersey).");
puts(" -A +n or -n for your timezone, relative to Eastern");
puts(" (for example, Calif residents use 'AREA -3 ...').\n");
puts(" Enter 'AREA *' for a list of all Area Codes.");
}

else
for (i=1; i < argc; ++i)
if (*argv[i]=='+' || *argv[i]=='-')
tme[1]-=satoi(argv[i]);
else
if (isdigit(*argv[i])==0)
areacode(argv[i],1);
else
areacode(argv[i],2);

} /* end main() */

areacode(s,x)
char *s;
int x;
{
unsigned strlen();
extern char *strcat();
static char *area[] =
{
"alalabama(-1)" ,
"205 All pts",
"akalaska(-5)" ,
"907 All pts",
"azarizona(-2)" ,
"602 All pts",
"ararkansas(-1)" ,
"501 All pts",
"cacalifornia(-3)" ,
"209 Fresno, Lodi, Merced, Modesto, Stockton" ,
"213 Beverly Hills, Hollywood, Los Angeles, Redondo Beach" ,
"408 Monterey, San Jose, Santa Cruz" ,
"415 Berkeley, Livermore, Menlo Park, San Francisco" ,
"619 Palm Springs, San Diego" ,
"707 Napa, Santa Rosa" ,
"714 Anaheim, Orange, San Bernadino " ,
"805 Bakersfield, Santa Barbara" ,
"818 Burbank, Glendale, Pasadena",
"916 Sacramento" ,
"cocolorado(-2)" ,
"303 All pts" ,
"ctconnecticut(0)" ,
"203 All pts" ,
"dedelaware(0)" ,
"302 All pts" ,
"dcdistrict*of*columbia(0)" ,
"202 Washington" ,
"flflorida(0)" ,
"305 Miami, Key West, Ft. Lauderdale, Orlando" ,
"813 Ft. Myers, Tampa, Winter Haven" ,
"904 Daytona Beach, Gainesville, Jacksonville" ,
"gageorgia(0)" ,
"404 Atlanta, Rome" , "912 Macon, Savannah, Waycross" ,
"hihawaii(-5)",
"808 All pts" ,
"ididaho(-2)",
"208 All pts" ,
"ilillinois(-1)" ,
"217 Urbana, Springfield" , "309 Bloomington, Peoria" ,
"312 Aurora, Chicago, Skokie, Waukegan, Wheaton" ,
"618 Alton, Mt. Vernon" , "815 De Kalb, Rockford" ,
"inindiana(0)" ,
"219 Gary, South Bend, Warsaw" ,
"317 Indianapolis, Kokomo" ,
"812 Bloomington, Evansville, Terre Haute" ,
"iaiowa(-1)" ,
"319 Cedar Rapids, Iowa City, Dubuque" ,
"515 Ames, Des Moines, Ottumwa" ,
"712 Council Bluffs" ,
"kskansas(-1)" ,
"316 Wichita, Dodge City" ,
"913 Topeka, Lawrence, Manhattan, Salina" ,
"kykentucky(0)" ,
"502 Louisville, Fort Knox, Frankfort, Paducah, Shelbyville" ,
"606 Covington, Newport, Winchester" ,
"lalouisiana(-1)" ,
"504 Baton Rouge, New Orleans" ,
"318 Lake Charles, Monroe, Shreveport" ,
"memaine(0)",
"207 All pts" ,
"mdmaryland(0)",
"301 All pts" ,
"mamassachusetts(0)" ,
"413 Amherst, Springfield" ,
"617 Boston, New Bedford, Plymouth, Worchester" ,
"mimichigan(0)" ,
"313 Ann Arbor, Dearborn, Detroit, Flint" ,
"616 Battle Creek, Grand Rapids, Kalamazoo" ,
"517 Lansing" , "906 Escanaba" ,
"mnminnesota(-1)" ,
"218 Duluth, Moorhead" , "612 Minneapolis, St. Paul" ,
"507 Rochester, Winona" ,
"msmississippi(-1)",
"601 All pts" ,
"momissouri(-1)" ,
"314 St. Louis, Cape Girardeau, Columbia, Fulton, Hannibal, \n\tJefferson City, Mexico, Poplar Bluff, Rolla" ,
"417 Joplin, Springfield" ,
"816 Belton, Independence, Kansas City, Marshall, St. Joseph, Sedalia" ,
"mtmontana(-2)",
"406 All pts" ,
"nenebraska(-1)" ,
"402 Omaha, Lincoln" , "308 North Platte" ,
"nvnevada(-3)",
"702 All pts" ,
"nhnew*hampshire(0)",
"603 All pts" ,
"njnew*jersey(0)" ,
"201 Belleville, Newark, Hackensack, New Brunswick, Patterson, Trenton" ,
"609 Atlantic City, Camden, Trenton" ,
"nmnew*mexico(-2)",
"505 All pts" ,
"nynew*york(0)" ,
"212 New York City (Manhattan & The Bronx)" ,
"315 Syracuse, Utica" ,
"516 Long Island, Hamptons, Hempstead, Port Jefferson",
"518 Albany, Schenectady, Troy" ,
"607 Binghamton, Elmira, Ithaca, Roscoe" ,
"716 Buffalo, Niagara Falls, Rochester" ,
"718 New York City (Brooklyn, Queens & Staten Island)" ,
"914 Poughkeepsie, White Plains, Yonkers" ,
"ncnorth*carolina(0)" ,
"704 Charlotte, Lexington, Salisbury" ,
"919 Greenville, Raleigh, Winston-Salem, Wilmington" ,
"ndnorth*dakota(-1)",
"701 All pts" ,
"ohohio(0)" ,
"216 Akron, Cleveland, Youngstown" ,
"419 Toledo" ,
"513 Cincinnati, Dayton" , "614 Columbus" ,
"okoklahoma(-1)" ,
"405 Oklahoma City, Enid, Norman, Ponca City, Stillwater" ,
"918 Tulsa, Bartlesville, McAlester, Muskogee" ,
"ororegon(-3)",
"503 All pts" ,
"papennsylvania(0)" ,
"215 Philadelphia, Allentown" ,
"412 Pittsburgh" , "717 Harrisburg, Scranton, Wilkes Barre" ,
"814 Erie, Johnstown, State College" ,
"prpuerto*rico(0)" ,
"809 All pts",
"rirhode*island(0)",
"401 All pts" ,
"scsouth*carolina(0)",
"803 All pts" ,
"sdsouth*dakota(-1)",
"605 All pts" ,
"tntennessee(-1)" ,
"615 Chattanooga, Nashville, Knoxville, Oak Ridge" ,
"901 Jackson, Memphis" ,
"txtexas(-1)" ,
"214 Dallas, Ennis, Greenville, Jefferson, Longview, Sherman, Tyler" ,
"409 Bay City, Beaumont, Bryan, College Station, Galveston, Huntsville" ,
"512 Austin, Brownsville, Corpus Christi, Del Rio, Eagle Pass, \n\tLaredo, McAllen, San Antonio, Victoria" ,
"713 Houston, Baytown, Pasadena" ,
"806 Amarillo, Dalhart, Lubbock" ,
"817 Fort Worth, Denton, Temple, Waco, Wichita Falls" ,
"915 Abilene, Alpine, Big Spring, El Paso, Midland, Odessa" ,
"ututah(-2)",
"801 All pts" ,
"vtvermont(0)",
"802 All pts" ,
"vivirgin*islands(0)",
"809 All pts" ,
"vavirginia(0)" ,
"703 Arlington, Roanoke, Winchester" ,
"804 Charlottesville, Newport News, Norfolk, Richmond" ,
"wawashington(-3)" ,
"206 Olympia, Seattle, Tacoma, Vancouver" ,
"509 Spokane, Walla Walla" ,
" wide area" ,
"800 All pts" ,
"wvwest*virginia(0)",
"304 All pts" ,
"wiwisconsin(-1)" ,
"414 Milwaukee, Green Bay, Racine" ,
"608 Madison" , "715 Wausau" ,
"wywyoming(-2)",
"307 All pts" ,
"abalberta(-2)" ,
"403 All pts" ,
"bcbritish*columbia(-3)" ,
"604 Vancouver" ,
"mbmanitoba(-1)" ,
"204 Manitoba" ,
"onontario(0)" ,
"416 Hamilton, Mississauga, Oakville, Toronto",
"519 Guelph, Kitchener, London, Waterloo, Sarnia, Windsor" ,
"613 Kingston, Ottawa" ,
"705 North Bay" ,
"807 Fort William, Thunder Bay" ,
"nfnewfoundland(+1)" ,
"709 All pts" ,
"nbnew*brunswick(+1)",
"506 All pts",
"nsnova*scotia(+2)",
"902 All pts",
"peprince*edward*isl" ,
"902 All pts",
"pqquebec(0)",
"418 Quebec" ,
"514 Montreal" ,
"819 Sherbrooke " ,
"sksaskatchewan(-2)",
"306 All pts" ,
"--algeria(+6)" ,
"213 All (no city code)",
"--am*samoa(-6)" ,
"684 All (no city code",
"--andorra(+6)" ,
"33 Country Code", "078 All pts",
"--anguilla(0)" ,
"809 All pts",
"--antigua(0)" ,
"809 All pts",
"--argentina(+2)" ,
"54 Country Code", "1 Buenos Aires", "41 Rosario",
"51 Cordoba",
"--australia(+15)" ,
"61 Country Code ", "2 Sydney", "3 Melbourne",
"7 Brisbane", "8 Adelaide", "62 Canberra",
"--austria(+6)",
"43 Country Code", "316 Graz", "222 Vienna",
"5222 Innsbruck",
"--bahamas(0)" ,
"809 All pts",
"--bahrain(+8)",
"973 All (no city code)",
"--barbados(+1)" ,
"809 All",
"--belgium(+6)" ,
"32 Country Code", "2 Brussels", "3 Antwerp",
"10 Louvain-la-Neuve", "16 Heverlee", "41 Liege",
"65 Mons", "91 Ghent",
"--belize(-1)",
"501 Country Code (Belize City no city code)",
"03 Orange Walk", "04 Corozal Town",
"--bequia(0)" ,
"809 All pts" ,
"--bermuda(0)" ,
"809 All pts",
"--bolivia(+1)",
"591 Country Code", "2 La Paz", "33 Santa Cruz",
"42 Cochabamba",
"--braddon(0)" ,
"616 All",
"--brazil(+2)" ,
"55 Country Code", "11 Sao Paulo",
"21 Rio de Janeiro", "31 Belo Horizonte",
"61 Brasilia",
"--cameroon(+6)" ,
"237 All (no city code)",
"--caribbean(0)" ,
"809 All islands",
"--cayman*islands(0)" ,
"809 All pts",
"--chile(+1)" ,
"56 Country Code", "2 Santiago", "31 Valparaiso",
"42 Concepcion",
"--columbia(0)" ,
"57 Country Code (no city code: Bogota )",
"3 Cali", "4 Medellin", "5 Barranquilla",
"--costa*rica(-1)" ,
"506 All (no city code)",
"--cyprus(+7)" ,
"357 Country Code","21 Nicosia",
"--czechoslovakia(+6)",
"42 Country Code", "2 Prague", "5 Brno",
"7 Bratislava", "69 Ostrava",
"--denmark(+6)" ,
"45 Country Code", "1 Copenhagen", "2 Copenhagen",
"8 Aalborg",
"--dominica(0)" ,
"809 All pts",
"--dominican*republic" ,
"809 All pts",
"--ecuador(+0)" ,
"593 Country Code", "2 Quito, Ambato",
"4 Cuenca, Guayaquil", "7 Cuenca",
"--egypt(+7)" ,
"20 Country Code", "2 Cairo", "3 Alexandria",
"40 Tanata", "66 Port Said",
"--el*salvador(-1)" ,
"503 All (no city code)",
"--ethiopia(+8)" ,
"251 Country Code", "1 Addis Ababa", "4 Asmara",
"5 Dire Dawa",
"--fiji(+17)",
"679 All (no city code)",
"--finland(+7)" ,
"358 Country Code", "0 Helsinki", "21 Turku",
"41 Jyvaskyla",
"--france(+6)" ,
"33 Country Code", "1 Paris", "6 Orsay","7 Lyon",
"20 Lille", "31 Caen", "50 Annecy-le-Vieux",
"56 Bordeaux", "61 Toulouse", "73 Aubiere",
"88 Strasbourg", "91 Marseille", "93 Nice",
"--french*antilles(+1)",
"596 All (no city code)",
"--french*polynesia(-5)",
"689 All (no city code)",
"--gabon(+6)" ,
"241 All (no city code)",
"--germ*dem*rep(+6)" ,
"37 Country Code", "2 Berlin", "41 Leipzig",
"51 Dresden", "91 Magdeburg",
"--germ*fed*rep(+6)",
"49 Country Code", "30 Berlin", "40 Hamburg",
"89 Munich", "201 Essen", "202 Wupertal", "228 Bonn",
"231 Dortmund", "241 Achen", "271 Siegen" ,
"521 Bielefeld", "611 Frankfurt", "6131 Mainz",
"6221 Heidelburg", "631 Kaiserslautern", "6421 Marburg",
"7071 Tubingen", "711 Stuttgard", "721 Karlsruhe",
"7247 Karlsruhe", "761 Freiburg",
"--greece(+7)" ,
"30 Country Code", "1 Athens, Piraeus",
"41 Larissa", "31 Thessaloniki", "241 Rhodes",
"--guam(+15)" ,
"671 All (no city code)",
"--guantanamo*bay(+0)",
"53 US Naval Base Routing", "99 All pts",
"--guatemala(-1)" ,
"502 All Pts no city code except :",
"2 Guatemala City",
"--guyana(\t+2)" ,
"592 Country Code", "2 Georgetown",
"3 New Amsterdam", "5 Bartica",
"--haiti(+0)" ,
"509 Country Code", "1 Port au Prince", "2 Gonaive",
"3 Cap Hatien",
"--honduras(-1)" ,
"504 All (no city code)",
"--hong*kong(+13)" ,
"852 Country Code", "0 Shatin", "3 Kowloon",
"5 Hong Kong",
"--hungary(+6)",
"36 Country Code", "1 Budapest", "46 Miskolc",
"52 Debrecen", "62 Szeged",
"--iceland(+5)" ,
"354 Country Code", "1 Reykjavik, Hafnarfjordhur",
"6 Akureyri",
"--india(\t+10)" ,
"91 Country Code", "11 New Delhi",
"22 Bombay", "33 Calcutta", "44 Madras",
"--indonesia(+12)" ,
"62 Country Code", "21 Jakarta", "24 Semarang",
"61 Medan",
"--iran(\t+8)" ,
"98 Country Code", "21 Teheran", "31 Isfahan",
"41 Tabriz", "51 Mashad",
"--iraq(+8)" ,
"964 Country Code", "1 Baghdad", "30 Hilla",
"40 Basra", "60 Mousul",
"--ireland(+5)" ,
"353 Country Code", "1 Dublin", "21 Cork",
"51 Waterford","61 Limerick","91 Galway",
"--isreal(+7)" ,
"972 Country Code" , "2 Jerusalem",
"3 Tel Aviv, Ramat Gan", "4 Haifa",
"54 Rehovot", "57 Beer-Sheeva",
"--italy(+6)" ,
"39 Counrty Code", "2 Milan", "6 Rome",
"10 Genoa", "11 Turin", "40 Trieste", "41 Venice",
"49 Padova", "50 Pisa", "51 Bologna", "55 Florence",
"70 Cagliari", "75 Perugia", "80 Bari",
"382 Pavia", "521 Parma", "81 Naples",
"--ivory*coast(+5)" ,
"225 All (no city code)",
"--jamaica(0)" ,
"809 All pts",
"--japan(+14)" ,
"81 Country Code", "3 Tokyo", "6 Osaka",
"11 Saporo", "45 Yokohama", "52 Nagoya", "75 Kyoto",
"78 Kobe", "82 Hiroshima", "222 Sendai", "424 Tokyo",
"8462 Hiroshima", "92 Kyushu",
"--jordan(+7)" ,
"962 Country Code", "2 Irbib, Ramtha", "4 Jerash",
"6 Amman",
"--kenya(+8)" ,
"254 Country Code", "2 Nairobi", "11 Momabasa",
"35 Kisumu", "37 Nakuru",
"--korea*rep(+14)" ,
"82 Country Code", "2 Seoul", "32 Incheon",
"51 Pusan", "53 Taegu",
"--kuwait(+8)" ,
"965 All (no city code)",
"--lebenon(+7)" ,
"961 All",
"--liberia(+5)" ,
"231 All (no city code)",
"--libya(+7)" ,
"218 Country Code", "21 Tripoli", "23 Zawai",
"51 Misuratha", "61 Benghazi",
"--liechtenstein(+6)" ,
"41 Country Code", "75 All pts",
"--luxembourg(+6)",
"352 All (no city code)",
"--malawi(+7)" ,
"265 Country Code (no city codes: Blantyre, Lilongwe)",
"50 Zomba", "531 Domasi",
"--malaysia(+13)" ,
"60 Country Code", "3 Kuala Lumpur, Kelang",
"5 Ipoh",
"--mexico(+1)" ,
"52 Country Code", "5 Mexico City", "66 Tijuana",
"--monaco(+6)" ,
"33 Country Code", "93 All pts",
"--montserrat(0)",
"809 All pts",
"--morocco(+5)" ,
"212 Country Code (no city code: Casablanca )",
"4 Marrakech", "7 Rabat", "8 Agadir",
"9 Tangiers",
"--mustique(0)" ,
"809 All pts",
"--namibia(+7)" ,
"264 Country Code", "61 Windhoek", "631 Keetmanshoop",
"671 Tsumeb",
"--netherlands*antilles(+1)" ,
"599 Country Code", "5 St Maarten", "7 Bonaire",
"8 Aruba", "9 Curacao",
"--netherlands(+6)" ,
"31 Country Code", "10 Rotterdam", "20 Amsterdam",
"30 Utrecht", "70 The Hague", "71 Leiden",
"80 Nijmegen",
"--new*caledonia(+16)",
"687 All",
"--new*zealand(+17)" ,
"64 Country Code","3 Christchurch", "4 Wellington",
"9 Auckland", "24 Dunedin",
"--nevis(0)",
"809 All pts",
"--nicaragua(-1)" ,
"505 Country Code", "2 Managua", "31 Leon",
"341 Chinandega",
"--nigeria(+6)" ,
"234 Country Code", "1 Lagos",
"--norway(+6)" ,
"47 Country Code", "2 Oslo", "4 Stavenger",
"5 Bergen", "75 Trondheim",
"--oman(+9)" ,
"968 All (no city code)",
"--pakistan(+10)" ,
"92 Country Code", "21 Karachi", "42 Lahore",
"51 Islamabad", "221 Hyderabad",
"--palm*island(0)",
"809 All pts",
"--panama(+0)" ,
"507 All (no city code)",
"--papua*new*guinea(+15)" ,
"675 Country Code (no city code)",
"--paraguay(+1)" ,
"595 Country Code", "21 Asuncion", "31 Concepcion",
"--peru(+0)" ,
"51 Country Code", "14 Lima, Callao", "44 Trujillo",
"54 Arequipa",
"--phillipines(+13)" ,
"63 Country Code", "2 Manilla", "32 Cebu",
"33 Iloilo", "35 Davao",
"--poland(+6)",
"48 Country Code", "12 Krakow", "22 Warsaw",
"32 Katowice", "58 Gdansk", "71 Wroclaw",
"--portugal(+5)" ,
"351 Country Code", "1 Lisbon", "2 Porto",
"65 Setubal",
"--quatar(+9)" ,
"974 All (no city code)",
"--romania(+7)" ,
"40 Country Code", "0 Bucuresti", "16 Constantia",
"51 Cluj-Napoca",
"--saipan(+15)",
"670 All (no city code)",
"--san*marino(+6)",
"39 Country Code", "541 All pts",
"--saudia*arabia(+8)" ,
"966 Country Code", "1 Riyadh",
"2 Mecca, Makkah, Jeddah", "3 Hofuf",
"--senegal(+5)" ,
"221 All (no city code)",
"--singapore(+13)" ,
"65 All (no city code)",
"--south*africa(+7)" ,
"27 Country Code", "11 Johannesburg", "12 Pretoria",
"21 Cape Town", "31 Durban",
"--spain(+6)" ,
"34 Country Code", "1 Madrid", "3 Barcelona",
"6 Valencia", "28 Las Palmas (Canary Is)",
"54 Seville",
"--sri*lanka(\t+10)" ,
"94 Country Code", "1 Columbo", "8 Kandy",
"72 Moratuwa",
"--st*denis" ,
"331 All",
"--st*kitts(0)",
"809 All pts",
"--st*lucia(0)" ,
"809 All pts",
"--st*vincent(0)",
"809 All pts",
"--suriname(\t+1)" ,
"597 All (no city code)",
"--sweden(+6)" ,
"46 Country Code", "8 Stockholm", "18 Uppsala",
"31 Goteborg", "40 Maimo", "46 Lund",
"--switzerland(+6)",
"41 Country Code", "1 Zurich", "21 Lausanne",
"22 Geneva", "31 Berne", "38 Neuchatel",
"41 Lucerne", "56 Villigen", "61 Basel",
"--taiwan(+13)" ,
"886 Country Code", "2 Taipei", "7 Kaohsiung",
"62 Tainan",
"--thailand(+12)" ,
"66 Country Code", "2 Bangkok",
"--trinidad(0)" ,
"809 All pts",
"--tunisia(+6)" ,
"216 Country Code", "1 Tunis",
"2 Bizerte, Msel Bourguiba", "7 Kairouan",
"--turkey(+8)" ,
"90 Country Code", "1 Istanbul", "41 Ankara",
"51 Izmir", "711 Adana",
"--union*island(0)",
"809 All pts",
"--united*arab*emirates(+9)" ,
"971 Country Code", "2 Abu Dhabi", "3 Al Ain",
"4 Dubai", "6 Ajman, Sharjah, Umm Al Quwain",
"77 Ras Al Khaimah",
"--united*kingdom(+5)",
"44 Country Code", "1 London", "21 Birmingham",
"31 Edinburgh","41 Glasgow", "51 Liverpool",
"61 Manchester",
"222 Cardiff", "223 Cambridge", "232 Belfast",
"235 Didcot",
"272 Bristol", "385 Durham", "524 Lancaster",
"532 Leeds", "703 Southhampton", "742 Sheffield",
"784 Egham", "865 Oxford",
"--uruguay(+2)" ,
"598 Country Code", "2 Montevideo", "332 Canelones",
"532 Mercedes",
"--vatican*city(+2)" ,
"39 Country Code", "6 All pts",
"--venezuela(+1)" ,
"58 Country Code", "2 Caracas", "41 Valencia",
"61 Maracaibo",
"--yemen*arab*rep(+8)",
"967 Country Code", "2 Amran, Sana",
"4 Taiz, Yarim",
"--yugoslavia(+6)" ,
"38 Country Code", "11 Belgrade", "41 Zagreb",
"61 Ljubljana", "71 Sarajevo", "91 Skoplje",
NULL } ;

int i,j,found;
unsigned k;
char *t;

found=0;

if (x==2) /* a number area code */
{
strcat(s," ");
for (i=0; area[i] != NULL; i++)
if (strncmp(area[i],s,4)==0) /* test for match */
{
for (j=i-1; isdigit(*area[j]) ; --j) /* then go back for state */
;
if( strncmp(area[j],"--",2) != 0 ) /* Foreign Code ? */
{
stprint(area[j]); /* special print out for state name */
printf("\n %s.\n\n",area[i]);
}
else
{
if(j+1 == i) /* Country Code ? */
allprint(&area[j]);
else
{
stprint(area[j]); /* Add Country Code */
printf(" [%s]",area[j+1]);
printf("\n %s.\n\n",area[i]);
}
}
found=-1;
}
}

else /* state name or 2 letter code is input */
{
for (i=0; s[i] != '\0'; i++) /* make everything lowercase */
s[i]=tolower(s[i]);
k=strlen(s);
for (i=0; area[i] != NULL; i++)
if (isdigit(*area[i])==0)
if (strncmp(area[i]+2,s,k) == 0 ||
(k==2 && strncmp(s,area[i],k)==0) || s[0]=='*')
{
found = -1;
allprint(&area[i]);
}
}
if (found==0)
printf("Not found, %s.\n\n",s);
} /* end areacode() */

/* special printout for state name */
stprint(s)
char s[];
{
int i,n;
putchar(toupper(s[0]));
putchar(toupper(s[1]));
printf(" ");
putchar(toupper(s[2]));
for (s+=3; *s != '\0' && *s != '(' ; s++)
if (*s=='*')
{
putchar(' ');s++;
putchar(toupper(*s));
}
else
putchar(*s);
if ((*s++)=='(')
{
printf(" (");
i=(*s=='\t') ? 30 : 0;
otime( tme[1]+satoi(s) , tme[2]+i );
putchar(')');
}
/* printf(" area codes: "); */
} /* end stprint */

/* print state and cities */
allprint(area)
char *area[];
{
int j;
stprint(area[0]);
putchar('\n');
for (j=1; isdigit(*area[j]) ; j++)
printf(" %s.\n",area[j]);
putchar('\n');
} /* end allprint() */


/* integer convert to number */
int satoi(s)
char s[];
{
int i,n, sign;
i=0;
for (i=0; *s==' ' || *s=='\n' || *s=='\t'; s++)
; /* skip white space */

sign = 1;
if (*s == '+' || *s == '-')
sign = (*s++ == '+') ? 1 : -1;
for (n=0; *s >= '0' && *s <= '9'; s++)
n = 10 * n + *s - '0';
return(sign * n);

} /* end satoi */

/* limited string compare */
int strncmp(x,y,n)
char *x, *y;
int n;
{
int c;
while (n--) {
if (c=*x-*y++) return (c);
if (*x++=='\0') return (0);
}
return (0);
}

otime(h,m)
int h,m;
{
static char s;
while (m>60)
{
m-=60;
h++;
}
s=( ((h+24)%24) < 12 ) ? 'a' : 'p';
h=(h+23) %12 +1;
printf("%02u:%02u %cm", h,m,s );
} /* end otime */

getthetime(tme)
int tme[];
{
int temp;
/* struct regval {int ax,bx,cx,dx,si,di,ds,es; } regs; */
union REGS regs;
regs.x.ax = 0x2C00; /* svc # */
int86(0x21,®s,®s);
temp = regs.x.cx;
tme[1] = temp >> 8; /* hrs */
tme[2] = temp & 0xff; /* min */
temp = regs.x.dx;
tme[3] = temp >> 8; /* sec */
tme[4] = temp & 0xff; /* 100ths */

regs.x.ax = 0x2A00; /* svc # */
int86(0x21,®s,®s);
temp = regs.x.ax;
tme[5] = temp & 0xff; /* (0-6) (sun-sat) */
tme[6] = regs.x.cx; /* yr */
temp = regs.x.dx;
tme[7] = temp >> 8; /* mo */
tme[8] = temp & 0xff; /* day */
return;
} /* end gettime() */


  3 Responses to “Category : Databases and related files
Archive   : AREA3TC.ZIP
Filename : AREA3.C

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/