diff options
author | Marcus Glocker <mglocker@cvs.openbsd.org> | 2024-08-22 04:34:20 +0000 |
---|---|---|
committer | Marcus Glocker <mglocker@cvs.openbsd.org> | 2024-08-22 04:34:20 +0000 |
commit | 97e8d146943d33d95d66c1fad7cd440dc4d33110 (patch) | |
tree | 20b984953334da9e0247493c4262a2f21646fb2b /games | |
parent | a07cf08c0eaec22c3188827f325d21807ef27169 (diff) |
Generate areas datfile from /usr/share/misc/na.phone during make.
A deraadt/mglocker production
Diffstat (limited to 'games')
-rw-r--r-- | games/quiz/Makefile | 14 | ||||
-rw-r--r-- | games/quiz/datfiles/areas | 124 | ||||
-rwxr-xr-x | games/quiz/naphone2areas.sh | 39 |
3 files changed, 50 insertions, 127 deletions
diff --git a/games/quiz/Makefile b/games/quiz/Makefile index 68d6639b98d..75a9ba24566 100644 --- a/games/quiz/Makefile +++ b/games/quiz/Makefile @@ -1,15 +1,23 @@ -# $OpenBSD: Makefile,v 1.6 2014/12/02 12:50:04 schwarze Exp $ +# $OpenBSD: Makefile,v 1.7 2024/08/22 04:34:19 mglocker Exp $ PROG= quiz MAN= quiz.6 SRCS= quiz.c rxp.c -CATS= africa america areas arith asia babies bard chinese collectives \ +CATS= africa america arith asia babies bard chinese collectives \ ed elements europe flowers greek inca index latin locomotive \ midearth morse mult murders poetry posneg pres province seq-easy \ seq-hard sexes sov state trek ucc -beforeinstall: +NAPHONE= ${.CURDIR}/../../share/misc/na.phone +CLEANFILES+= areas + +areas: ${NAPHONE} + ${.CURDIR}/naphone2areas.sh ${NAPHONE} > areas + +afterinstall: areas (cd ${.CURDIR}/datfiles; ${INSTALL} ${INSTALL_COPY} -o ${BINOWN} \ -g ${BINGRP} -m 444 ${CATS} ${DESTDIR}/usr/share/games/quiz.db) + ${INSTALL} ${INSTALL_COPY} -o ${BINOWN} -g ${BINGRP} -m 444 \ + areas ${DESTDIR}/usr/share/games/quiz.db .include <bsd.prog.mk> diff --git a/games/quiz/datfiles/areas b/games/quiz/datfiles/areas deleted file mode 100644 index 25a241be83c..00000000000 --- a/games/quiz/datfiles/areas +++ /dev/null @@ -1,124 +0,0 @@ -201:northern new jersey|NJ:newark -202:washington d c|DC: -203:connecticut|CT: -204:manitoba: -205:alabama|AL: -206:western washington state|WA:seattle -207:maine|ME: -208:idaho|ID: -209:central california|CA:fresno -212:new york city, new york|NY: -213:los angeles, california|CA: -214:northeastern texas|TX:dallas -215:southeastern pennsylvania|PA:philadelphia -216:northeastern ohio|OH:akron -217:central illinois|IL:springfield -218:northern minnesota|MN:duluth -219:northern indiana|IN:south bend -301:maryland|MD: -302:delaware|DE: -303:colorado|CO: -304:west virginia|WV: -305:southeastern florida|FL:miami -306:saskatchewan: -307:wyoming|WY: -308:western nebraska|NE:omaha -309:northwestern illinois|IL:peoria -312:chicago, illinois|IL: -313:eastern michigan|MI:detroit -314:southeastern missouri|MO:jefferson city -315:northern central new york|NY:syracuse -316:southern kansas|KS:wichita -317:central indiana|IN:indianapolis -318:western louisiana|LA:shreveport -319:eastern iowa|IA:cedar rapids -401:rhode island|RI: -402:eastern nebraska|NE:north platte -403:alberta: -404:northern georgia|GA:atlanta -405:western oklahoma|OK:oklahoma city -406:montana|MT: -408:central coastal california|CA:san jose -412:western pennsylvania|PA:pittsburgh -413:western massachusetts|MA:springfield -414:southeastern wisconsin|WI:milwaukee -415:san francisco, california|CA: -416:southern central ontario:toronto -417:southwestern missouri|MO:springfield -418:northeastern quebec:quebec -419:northwestern ohio|OH:toledo -501:arkansas|AR: -502:western kentucky|KY:louisville -503:oregon|OR: -504:eastern louisiana|LA:new orleans -505:new mexico|NM: -506:new brunswick: -507:southern minnesota|MN:rochester -509:eastern washington state|WA:spokane -512:southern texas|TX:austin -513:southwestern ohio|OH:dayton -514:southwestern quebec:montreal -515:central iowa|IA:des moines -516:long island, new york|NY: -517:central michigan|MI:lansing -518:northeastern new york|NY:albany -519:southwestern ontario:windsor -601:mississippi|MS: -602:arizona|AZ: -603:new hampshire|NH: -604:british columbia: -605:south dakota|SD: -606:eastern kentucky|KY:ashland -607:southern central new york|NY:ithaca, binghamton -608:southwestern wisconsin|WI:madison -609:southern new jersey|NJ:trenton -612:central minnesota|MN:minneapolis -613:southeastern ontario:ottawa -614:southeastern ohio|OH:columbus -615:eastern tennessee|TN:nashville -616:western michigan|MI:grand rapids -617:eastern massachusetts|MA:boston -618:southern illinois|IL:centralia -701:north dakota|ND: -702:nevada|NV: -703:western virginia|VA:arlington -704:western north carolina:charlotte -705:northeastern ontario:sault ste. marie -707:northwestern california|CA:santa rosa -709:newfoundland: -712:western iowa|IA:council bluffs -713:southeastern texas|TX:houston -714:southern california|CA:san diego -715:northern wisconsin|WI:superior -716:northern western new york|NY:buffalo, rochester -717:eastern pennsylvania|PA:wilkes-barre, scranton -801:utah|UT: -802:vermont|VT: -803:south carolina|SC: -804:eastern virginia|VA:richmond -805:southern central coastal california|CA:bakersfield -806:panhandle texas|TX:amarillo -807:western ontario:fort william -808:hawaii|HI: -809:bermuda, puerto rico, virgin islands, caribbean: -812:southern indiana|IN:evansville -813:southwestern florida|FL:st. petersburg -814:central pennsylvania|PA:erie -815:northeastern illinois|IL:rockford -816:northern missouri|MO:kansas city -817:northern central texas|TX:fort worth -819:northwestern quebec:trois rivieres -901:western tennessee|TN:memphis -902:nova scotia, prince edward island: -903:western mexico:mexicali -904:northern florida|FL:jacksonville -905:eastern mexico:mexico city -906:upper michigan|MI:escanaba -907:alaska|AK: -912:southern georgia|GA:savannah -913:northern kansas|KS:topeka -914:southern new york|NY:westchester county -915:western texas|TX:el paso -916:northeastern california|CA:sacramento -918:eastern oklahoma|OK:tulsa -919:eastern north carolina|NC:raleigh diff --git a/games/quiz/naphone2areas.sh b/games/quiz/naphone2areas.sh new file mode 100755 index 00000000000..febfa3fbf64 --- /dev/null +++ b/games/quiz/naphone2areas.sh @@ -0,0 +1,39 @@ +#!/bin/sh + +# na.phone: +# Area Code : City : State/Province : State/Province Abbrev. + +# areas: +# Area Code : State/Province|State/Province Abbrev. : City + +if [ X"$1" == X"" ]; then + exit 1 +fi + +AC=0 +grep -v '\#' $1 | grep -v '\$' | \ +while T= read -r line; do + AC_LAST=$AC + AC=`echo $line | cut -d: -f1` + + # skip line if area code isn't numeric + CMD=`echo $AC | grep "^[0-9]*$"` + if [ $? -eq 1 ]; then + continue + fi + + # skip line if area code is a duplicate + if [ $AC -eq $AC_LAST ]; then + continue + fi + + C=`echo $line | cut -d: -f2` + SP=`echo $line | cut -d: -f3` + SPA=`echo $line | cut -d: -f4` + + if [ X"$SPA" == X"" ]; then + echo "$AC:$SP:$C" + else + echo "$AC:$SP|$SPA:$C" + fi +done |