tmap.rc - plan9port - [fork] Plan 9 from user space
 (HTM) git clone git://src.adamsgaard.dk/plan9port
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
       tmap.rc (1576B)
       ---
            1 #!/bin/rc
            2 
            3 rfork en
            4 
            5 # F FEATUREs, M map files, A other arguments
            6 FEATURE=no
            7 
            8 if (~ $MAPPROG '')
            9         MAPPROG=/bin/aux/mapd
           10 
           11 if (~ $MAPDIR '')
           12         MAPDIR=/lib/map
           13 
           14 F=(); M=(); A=();
           15 for (i) {
           16         switch ($FEATURE) {
           17         case no
           18                 switch ($i) {
           19                 case -f
           20                         FEATURE=yes 
           21                         F=($F)
           22                 case *
           23                         A=($A $i)
           24                 }
           25         case yes
           26                 switch ($i) {
           27                 case -f
           28                 case -*
           29                         A=($A $i)
           30                         FEATURE=no
           31                 case riv*2
           32                         F=($F 201 202)
           33                 case riv*3
           34                         F=($F 201 202 203)
           35                 case riv*4
           36                         F=($F 201 202 203 204)
           37                 case riv*
           38                         F=($F 201)
           39                 case iriv*2
           40                         F=($F 206 207)
           41                 case iriv*[34]
           42                         F=($F 206 207 208)
           43                 case iriv*
           44                         F=($F 206)
           45                 case coast*2 shore*2 lake*2
           46                         F=($F 102)
           47                 case coast*3 shore*3 lake*3
           48                         F=($F 102 103)
           49                 case coast*4 shore*4 lake*4
           50                         F=($F 102 103 104)
           51                 case coast* shore* lake*
           52                 case ilake*[234] ishore*[234]
           53                         F=($F 106 107)
           54                 case ilake* ishore*
           55                         F=($F 106)
           56                 case reef*
           57                         F=($F 108)
           58                 case canal*2
           59                         F=($F 210 211)
           60                 case canal*[34]
           61                         F=($F 210 211 212)
           62                 case canal*
           63                         F=($F 210)
           64                 case glacier*
           65                         F=($F 115)
           66                 case state* province*
           67                         F=($F 401)
           68                 case countr*2
           69                         F=($F 301 302)
           70                 case countr*[34]
           71                         F=($F 301 302 303)
           72                 case countr*
           73                         F=($F 301)
           74                 case salt*[234]
           75                         F=($F 109 110)
           76                 case salt*
           77                         F=($F 109)
           78                 case ice*[234] shel*[234]
           79                         F=($F 113 114)
           80                 case ice* shel*
           81                         F=($F 113)
           82                 case *
           83                         echo map: unknown feature $i >[1=2]
           84                         exits "unknown feature"
           85                 }
           86         }
           87 }
           88 
           89 for (j in $F) {
           90         if (test -r $MAPDIR/$j)
           91                 M=($M $MAPDIR/$j)
           92 }
           93 
           94 if (~ $F ?*) {
           95         if (test -r $MAPDIR/101)
           96                 M=(101 $M)
           97         M=(-m $M)
           98 }
           99 
          100 if (~ $MAP '')
          101         MAP=world
          102 
          103 MAP=$MAP MAPDIR=$MAPDIR $MAPPROG $A $M