map 1.5 KB

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