Unsorted-Debian-patches.patch 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554
  1. From: Tobias Quathamer <toddy@debian.org>
  2. Date: Mon, 26 Mar 2012 10:07:17 +0200
  3. Subject: Unsorted Debian patches
  4. ---
  5. adventure/crc.c | 4 ++-
  6. arithmetic/arithmetic.6 | 2 +-
  7. backgammon/backgammon/move.c | 3 ++
  8. backgammon/common_source/allow.c | 4 ++-
  9. backgammon/teachgammon/ttext1.c | 2 +-
  10. backgammon/teachgammon/ttext2.c | 2 +-
  11. dab/gamescreen.h | 6 ++--
  12. dm/dm.c | 6 ++--
  13. fish/Makefrag | 8 ++++--
  14. fish/fish.6 | 4 +-
  15. gomoku/gomoku.6 | 2 +-
  16. hack/Makefrag | 3 +-
  17. hack/config.h | 15 ++++++++----
  18. hunt/hunt/hunt.6.in | 2 +-
  19. hunt/hunt/hunt.c | 6 +++-
  20. hunt/hunt/playit.c | 4 +-
  21. number/number.c | 47 +++++++++++++++++++++++++-------------
  22. sail/pl_main.c | 2 +-
  23. tests/number.-0.1 | 2 +-
  24. tetris/scores.c | 17 ++++++++-----
  25. trek/setup.c | 5 +++-
  26. 21 files changed, 92 insertions(+), 54 deletions(-)
  27. diff --git a/adventure/crc.c b/adventure/crc.c
  28. index 66504f1..c6ee5f1 100644
  29. --- a/adventure/crc.c
  30. +++ b/adventure/crc.c
  31. @@ -42,6 +42,8 @@ __RCSID("$NetBSD: crc.c,v 1.8 2003/08/07 09:36:50 agc Exp $");
  32. #endif
  33. #endif /* not lint */
  34. +#include <limits.h>
  35. +
  36. #include "extern.h"
  37. const unsigned long crctab[] = {
  38. @@ -125,7 +127,7 @@ crc(ptr, nr) /* Process nr bytes at a time; ptr points to them */
  39. while (nr > 0)
  40. for (p = ptr; nr--; ++p) {
  41. - if (!(i = crcval >> 24 ^ *p)) {
  42. + if (!(i = crcval >> (sizeof(crcval) * CHAR_BIT - 8) ^ *p)) {
  43. i = step++;
  44. if (step >= sizeof(crctab) / sizeof(crctab[0]))
  45. step = 0;
  46. diff --git a/arithmetic/arithmetic.6 b/arithmetic/arithmetic.6
  47. index b8d4d8f..bc41bca 100644
  48. --- a/arithmetic/arithmetic.6
  49. +++ b/arithmetic/arithmetic.6
  50. @@ -79,7 +79,7 @@ divide by or subtract will be between 0 and
  51. .Nm
  52. will not ask you to divide by 0.)
  53. The default
  54. -.I range
  55. +.It range
  56. is 10.
  57. .El
  58. .Pp
  59. diff --git a/backgammon/backgammon/move.c b/backgammon/backgammon/move.c
  60. index 9fd81f1..027cab5 100644
  61. --- a/backgammon/backgammon/move.c
  62. +++ b/backgammon/backgammon/move.c
  63. @@ -152,6 +152,9 @@ move(okay)
  64. trymove(0, 0);
  65. pickmove();
  66. + if (d0)
  67. + swap;
  68. +
  69. /* print move */
  70. writel(" and moves ");
  71. for (i = 0; i < mvlim; i++) {
  72. diff --git a/backgammon/common_source/allow.c b/backgammon/common_source/allow.c
  73. index f6bae78..8189f07 100644
  74. --- a/backgammon/common_source/allow.c
  75. +++ b/backgammon/common_source/allow.c
  76. @@ -83,8 +83,10 @@ movallow()
  77. p[i--] = bar;
  78. if (p[i] != bar)
  79. continue;
  80. - else
  81. + else if (d0)
  82. break;
  83. + swap;
  84. + continue;
  85. }
  86. if (d0 || m == 4)
  87. break;
  88. diff --git a/backgammon/teachgammon/ttext1.c b/backgammon/teachgammon/ttext1.c
  89. index 82db223..73ea6ee 100644
  90. --- a/backgammon/teachgammon/ttext1.c
  91. +++ b/backgammon/teachgammon/ttext1.c
  92. @@ -94,7 +94,7 @@ const char *const intro2[] = {
  93. "\n Although not indicated on the board, the players' homes are",
  94. "located just to the right of the board. A player's men are placed",
  95. "there when they are removed from the board. The board you just",
  96. - "saw was in it's initial position. All games start with the board",
  97. + "saw was in its initial position. All games start with the board",
  98. "looking like this. Notice that red's pieces are represented by the",
  99. "letter 'r' and white's pieces are represented by the letter 'w'.",
  100. "Also, a position may have zero or more pieces on it, e.g. posi-",
  101. diff --git a/backgammon/teachgammon/ttext2.c b/backgammon/teachgammon/ttext2.c
  102. index 5e827d7..eb9a083 100644
  103. --- a/backgammon/teachgammon/ttext2.c
  104. +++ b/backgammon/teachgammon/ttext2.c
  105. @@ -65,7 +65,7 @@ const char *const stragy[] = {
  106. "points in a row) are difficult to form, many points nestled close-",
  107. "ly together produce a formidable barrier. Also, while it is good",
  108. "to move back men forward, doing so lessens the opportunity for you",
  109. - "to hit men. Finally, remember that once the two player's have",
  110. + "to hit men. Finally, remember that once the two players have",
  111. "passed each other on the board, there is no chance of either team",
  112. "being hit, so the game reduces to a race off the board. Addi-",
  113. "tional hints on strategy are presented in the practice game.",
  114. diff --git a/dab/gamescreen.h b/dab/gamescreen.h
  115. index ca90cb3..b3db2ea 100644
  116. --- a/dab/gamescreen.h
  117. +++ b/dab/gamescreen.h
  118. @@ -70,9 +70,9 @@ class GAMESCREEN {
  119. virtual void redraw(void) = 0; // Refresh
  120. virtual int getinput(void) = 0; // Get user input
  121. virtual void bell(void) = 0; // Beep
  122. - virtual void score(size_t p, const PLAYER& p) = 0; // Post current score
  123. - virtual void games(size_t p, const PLAYER& p) = 0; // Post games won
  124. - virtual void total(size_t p, const PLAYER& p) = 0; // Post total score
  125. + virtual void score(size_t s, const PLAYER& p) = 0; // Post current score
  126. + virtual void games(size_t s, const PLAYER& p) = 0; // Post games won
  127. + virtual void total(size_t s, const PLAYER& p) = 0; // Post total score
  128. virtual void ties(const PLAYER& p) = 0; // Post tie games
  129. };
  130. diff --git a/dm/dm.c b/dm/dm.c
  131. index c131904..16129d8 100644
  132. --- a/dm/dm.c
  133. +++ b/dm/dm.c
  134. @@ -134,19 +134,19 @@ read_config()
  135. while (fgets(lbuf, sizeof(lbuf), cfp))
  136. switch (*lbuf) {
  137. case 'b': /* badtty */
  138. - if (sscanf(lbuf, "%s%s", f1, f2) != 2 ||
  139. + if (sscanf(lbuf, "%39s%39s", f1, f2) != 2 ||
  140. strcasecmp(f1, "badtty"))
  141. break;
  142. c_tty(f2);
  143. break;
  144. case 'g': /* game */
  145. - if (sscanf(lbuf, "%s%s%s%s%s",
  146. + if (sscanf(lbuf, "%39s%39s%39s%39s%39s",
  147. f1, f2, f3, f4, f5) != 5 || strcasecmp(f1, "game"))
  148. break;
  149. c_game(f2, f3, f4, f5);
  150. break;
  151. case 't': /* time */
  152. - if (sscanf(lbuf, "%s%s%s%s", f1, f2, f3, f4) != 4 ||
  153. + if (sscanf(lbuf, "%39s%39s%39s%39s", f1, f2, f3, f4) != 4 ||
  154. strcasecmp(f1, "time"))
  155. break;
  156. c_day(f2, f3, f4);
  157. diff --git a/fish/Makefrag b/fish/Makefrag
  158. index 1039af5..1fec493 100644
  159. --- a/fish/Makefrag
  160. +++ b/fish/Makefrag
  161. @@ -31,7 +31,9 @@ fish_DIRS := $(GAMESDIR) $(MAN6DIR) $(shell dirname $(FISH_INSTRFILE))
  162. fish_all: fish/fish fish/fish.instr fish/fish.6
  163. fish_install: fish_all
  164. - $(INSTALL_BINARY) fish/fish $(INSTALL_PREFIX)$(GAMESDIR)/fish
  165. - $(HIDE_GAME) fish
  166. + $(INSTALL_BINARY) fish/fish $(INSTALL_PREFIX)$(GAMESDIR)/go-fish
  167. + $(HIDE_GAME) go-fish
  168. $(INSTALL_DATA) fish/fish.instr $(INSTALL_PREFIX)$(FISH_INSTRFILE)
  169. - $(INSTALL_MANUAL) fish/fish.6
  170. + ln -sf fish.6 fish/go-fish.6 # hack for rename
  171. + $(INSTALL_MANUAL) fish/go-fish.6
  172. + rm -f fish/go-fish.6
  173. diff --git a/fish/fish.6 b/fish/fish.6
  174. index 398c55f..46eef2b 100644
  175. --- a/fish/fish.6
  176. +++ b/fish/fish.6
  177. @@ -30,10 +30,10 @@
  178. .\" @(#)fish.6 8.1 (Berkeley) 5/31/93
  179. .\"
  180. .Dd May 31, 1993
  181. -.Dt FISH 6
  182. +.Dt GO-FISH 6
  183. .Os
  184. .Sh NAME
  185. -.Nm fish
  186. +.Nm go-fish
  187. .Nd play
  188. .Dq Go Fish
  189. .Sh SYNOPSIS
  190. diff --git a/gomoku/gomoku.6 b/gomoku/gomoku.6
  191. index f78eb0e..024da85 100644
  192. --- a/gomoku/gomoku.6
  193. +++ b/gomoku/gomoku.6
  194. @@ -45,7 +45,7 @@
  195. .Op Ar inputfile
  196. .Sh DESCRIPTION
  197. .Nm
  198. -is a two player game were the object is to get 5 in a row horizontally,
  199. +is a two player game where the object is to get 5 in a row horizontally,
  200. vertically or diagonally on a 19 by 19 grid.
  201. By convention, black always moves first.
  202. With no arguments,
  203. diff --git a/hack/Makefrag b/hack/Makefrag
  204. index eabbd2a..5807ef0 100644
  205. --- a/hack/Makefrag
  206. +++ b/hack/Makefrag
  207. @@ -56,7 +56,8 @@ hack_install: hack_all
  208. $(INSTALL_SCORE_GAME) hack/hack $(INSTALL_PREFIX)$(GAMESDIR)/hack
  209. $(HIDE_GAME) hack
  210. $(INSTALL_HACK_DIR) $(INSTALL_PREFIX)$(HACK_DIR)
  211. - set -e; for f in data help hh rumors; do $(INSTALL_DATA) hack/$$f $(INSTALL_PREFIX)$(HACK_DIR)/$$f; done
  212. + install -d $(INSTALL_PREFIX)/usr/share/games/bsdgames/hack
  213. + set -e; for f in data help hh rumors; do $(INSTALL_DATA) hack/$$f $(INSTALL_PREFIX)/usr/share/games/bsdgames/hack/$$f; done
  214. $(INSTALL_SCORE_FILE) $(HACK_DIR)/perm
  215. $(INSTALL_SCORE_FILE) $(HACK_DIR)/record
  216. $(INSTALL_MANUAL) hack/hack.6
  217. diff --git a/hack/config.h b/hack/config.h
  218. index ad3bbcf..03a8b02 100644
  219. --- a/hack/config.h
  220. +++ b/hack/config.h
  221. @@ -88,13 +88,18 @@
  222. /* #define PYRAMID_BUG */ /* avoid a bug on the Pyramid */
  223. /* #define NOWAITINCLUDE */ /* neither <wait.h> nor <sys/wait.h> exists */
  224. -#define WIZARD "bruno" /* the person allowed to use the -D option */
  225. +/*
  226. + * Debian mods: use root for WIZARD, and move files that are static to
  227. + * /usr/share/ -- JEH
  228. + */
  229. +#define WIZARD "root" /* the person allowed to use the -D option */
  230. +#define SHAREDIR "/usr/share/games/bsdgames/hack/"
  231. #define RECORD "record"/* the file containing the list of topscorers */
  232. #define NEWS "news" /* the file containing the latest hack news */
  233. -#define HELP "help" /* the file containing a description of the commands */
  234. -#define SHELP "hh" /* abbreviated form of the same */
  235. -#define RUMORFILE "rumors" /* a file with fortune cookies */
  236. -#define DATAFILE "data" /* a file giving the meaning of symbols used */
  237. +#define HELP SHAREDIR "help" /* the file containing a description of the commands */
  238. +#define SHELP SHAREDIR "hh" /* abbreviated form of the same */
  239. +#define RUMORFILE SHAREDIR "rumors" /* a file with fortune cookies */
  240. +#define DATAFILE SHAREDIR "data" /* a file giving the meaning of symbols used */
  241. #define FMASK 0660 /* file creation mask */
  242. #define HLOCK "perm" /* an empty file used for locking purposes */
  243. #define LLOCK "safelock" /* link to previous */
  244. diff --git a/hunt/hunt/hunt.6.in b/hunt/hunt/hunt.6.in
  245. index 406296e..22e45ec 100644
  246. --- a/hunt/hunt/hunt.6.in
  247. +++ b/hunt/hunt/hunt.6.in
  248. @@ -387,7 +387,7 @@ how many of player's shots were ducked
  249. how many slime kills player had
  250. .It enemy
  251. how many enemies were killed
  252. -.tI friend
  253. +.It friend
  254. how many friends were killed (self and same team)
  255. .It deaths
  256. how many times player died
  257. diff --git a/hunt/hunt/hunt.c b/hunt/hunt/hunt.c
  258. index 11f4c44..28321bc 100644
  259. --- a/hunt/hunt/hunt.c
  260. +++ b/hunt/hunt/hunt.c
  261. @@ -394,7 +394,8 @@ broadcast_vec(s, vector)
  262. vec_cnt = 0;
  263. for (ip = ifp; ip; ip = ip->ifa_next)
  264. - if ((ip->ifa_addr->sa_family == AF_INET) &&
  265. + if (ip->ifa_addr &&
  266. + (ip->ifa_addr->sa_family == AF_INET) &&
  267. (ip->ifa_flags & IFF_BROADCAST))
  268. vec_cnt++;
  269. @@ -405,7 +406,8 @@ broadcast_vec(s, vector)
  270. vec_cnt = 0;
  271. for (ip = ifp; ip; ip = ip->ifa_next)
  272. - if ((ip->ifa_addr->sa_family == AF_INET) &&
  273. + if (ip->ifa_addr &&
  274. + (ip->ifa_addr->sa_family == AF_INET) &&
  275. (ip->ifa_flags & IFF_BROADCAST))
  276. memcpy(&(*vector)[vec_cnt++], ip->ifa_broadaddr,
  277. sizeof(struct sockaddr_in));
  278. diff --git a/hunt/hunt/playit.c b/hunt/hunt/playit.c
  279. index 9acf86e..881a4e7 100644
  280. --- a/hunt/hunt/playit.c
  281. +++ b/hunt/hunt/playit.c
  282. @@ -114,7 +114,7 @@ playit()
  283. bad_con();
  284. /* NOTREACHED */
  285. }
  286. - if (ntohl(version) != (unsigned long)HUNT_VERSION) {
  287. + if (ntohl(version) != (uint32_t)HUNT_VERSION) {
  288. bad_ver();
  289. /* NOTREACHED */
  290. }
  291. @@ -649,7 +649,7 @@ do_message()
  292. bad_con();
  293. /* NOTREACHED */
  294. }
  295. - if (ntohl(version) != (unsigned long)HUNT_VERSION) {
  296. + if (ntohl(version) != (uint32_t)HUNT_VERSION) {
  297. bad_ver();
  298. /* NOTREACHED */
  299. }
  300. diff --git a/number/number.c b/number/number.c
  301. index c7559e1..3086a86 100644
  302. --- a/number/number.c
  303. +++ b/number/number.c
  304. @@ -78,9 +78,9 @@ static const char *const name1[] = {
  305. void convert(char *);
  306. int main(int, char *[]);
  307. -int number(const char *, int);
  308. -void pfract(int);
  309. -int unit(int, const char *);
  310. +int number(const char *, int, int *);
  311. +void pfract(int, int);
  312. +int unit(int, const char *, int *);
  313. void usage(void) __attribute__((__noreturn__));
  314. int lflag;
  315. @@ -131,7 +131,7 @@ void
  316. convert(line)
  317. char *line;
  318. {
  319. - int flen, len, rval;
  320. + int flen, len, rval, singular;
  321. char *p, *fraction;
  322. flen = 0;
  323. @@ -174,7 +174,7 @@ badnum: errx(1, "illegal number: %s", line);
  324. --len;
  325. }
  326. - rval = len > 0 ? unit(len, line) : 0;
  327. + rval = len > 0 ? unit(len, line, &singular) : 0;
  328. if (fraction != NULL && flen != 0)
  329. for (p = fraction; *p != '\0'; ++p)
  330. if (*p != '0') {
  331. @@ -182,10 +182,10 @@ badnum: errx(1, "illegal number: %s", line);
  332. (void)printf("%sand%s",
  333. lflag ? " " : "",
  334. lflag ? " " : "\n");
  335. - if (unit(flen, fraction)) {
  336. + if (unit(flen, fraction, &singular)) {
  337. if (lflag)
  338. (void)printf(" ");
  339. - pfract(flen);
  340. + pfract(flen, singular);
  341. rval = 1;
  342. }
  343. break;
  344. @@ -197,9 +197,10 @@ badnum: errx(1, "illegal number: %s", line);
  345. }
  346. int
  347. -unit(len, p)
  348. +unit(len, p, singular)
  349. int len;
  350. const char *p;
  351. + int *singular;
  352. {
  353. int off, rval;
  354. @@ -208,7 +209,7 @@ unit(len, p)
  355. if (len % 3) {
  356. off = len % 3;
  357. len -= off;
  358. - if (number(p, off)) {
  359. + if (number(p, off, singular)) {
  360. rval = 1;
  361. (void)printf(" %s%s",
  362. name3[len / 3], lflag ? " " : ".\n");
  363. @@ -217,14 +218,16 @@ unit(len, p)
  364. }
  365. for (; len > 3; p += 3) {
  366. len -= 3;
  367. - if (number(p, 3)) {
  368. + if (number(p, 3, singular)) {
  369. rval = 1;
  370. (void)printf(" %s%s",
  371. name3[len / 3], lflag ? " " : ".\n");
  372. }
  373. }
  374. }
  375. - if (number(p, len)) {
  376. + if (number(p, len, singular)) {
  377. + if (rval)
  378. + *singular = 0;
  379. if (!lflag)
  380. (void)printf(".\n");
  381. rval = 1;
  382. @@ -233,17 +236,20 @@ unit(len, p)
  383. }
  384. int
  385. -number(p, len)
  386. +number(p, len, singular)
  387. const char *p;
  388. int len;
  389. + int *singular;
  390. {
  391. int val, rval;
  392. rval = 0;
  393. + *singular = 1;
  394. switch (len) {
  395. case 3:
  396. if (*p != '0') {
  397. rval = 1;
  398. + *singular = 0;
  399. (void)printf("%s hundred", name1[*p - '0']);
  400. }
  401. ++p;
  402. @@ -262,33 +268,42 @@ number(p, len)
  403. }
  404. rval = 1;
  405. }
  406. + if (val != 1)
  407. + *singular = 0;
  408. break;
  409. case 1:
  410. if (*p != '0') {
  411. rval = 1;
  412. (void)printf("%s", name1[*p - '0']);
  413. }
  414. + if (*p != '1')
  415. + *singular = 0;
  416. }
  417. return (rval);
  418. }
  419. void
  420. -pfract(len)
  421. +pfract(len, singular)
  422. int len;
  423. + int singular;
  424. {
  425. static const char *const pref[] = { "", "ten-", "hundred-" };
  426. switch(len) {
  427. case 1:
  428. - (void)printf("tenths.\n");
  429. + (void)printf("tenth");
  430. break;
  431. case 2:
  432. - (void)printf("hundredths.\n");
  433. + (void)printf("hundredth");
  434. break;
  435. default:
  436. - (void)printf("%s%sths.\n", pref[len % 3], name3[len / 3]);
  437. + (void)printf("%s%sth", pref[len % 3], name3[len / 3]);
  438. break;
  439. }
  440. + if (!singular) {
  441. + printf("s");
  442. + }
  443. + printf(".\n");
  444. }
  445. void
  446. diff --git a/sail/pl_main.c b/sail/pl_main.c
  447. index 6183420..b8b26b1 100644
  448. --- a/sail/pl_main.c
  449. +++ b/sail/pl_main.c
  450. @@ -219,7 +219,7 @@ reprint:
  451. printf("\nInitial broadside %s (grape, chain, round, double): ",
  452. n ? "right" : "left");
  453. fflush(stdout);
  454. - scanf("%s", buf);
  455. + scanf("%9s", buf);
  456. switch (*buf) {
  457. case 'g':
  458. load = L_GRAPE;
  459. diff --git a/tests/number.-0.1 b/tests/number.-0.1
  460. index fea1e89..69c365b 100644
  461. --- a/tests/number.-0.1
  462. +++ b/tests/number.-0.1
  463. @@ -1,3 +1,3 @@
  464. minus
  465. one.
  466. -tenths.
  467. +tenth.
  468. diff --git a/tetris/scores.c b/tetris/scores.c
  469. index d731e25..c2d36c9 100644
  470. --- a/tetris/scores.c
  471. +++ b/tetris/scores.c
  472. @@ -335,7 +335,8 @@ checkscores(hs, num)
  473. continue;
  474. }
  475. }
  476. - levelfound[sp->hs_level] = 1;
  477. + if (sp->hs_level < NLEVELS && sp->hs_level >= 0)
  478. + levelfound[sp->hs_level] = 1;
  479. i++, sp++;
  480. }
  481. return (num > MAXHISCORES ? MAXHISCORES : num);
  482. @@ -374,11 +375,13 @@ showscores(level)
  483. for (i = MINLEVEL; i < NLEVELS; i++)
  484. levelfound[i] = 0;
  485. for (i = 0, sp = scores; i < nscores; i++, sp++) {
  486. - if (levelfound[sp->hs_level])
  487. - sp->hs_time = 0;
  488. - else {
  489. - sp->hs_time = 1;
  490. - levelfound[sp->hs_level] = 1;
  491. + if (sp->hs_level < NLEVELS && sp->hs_level >= 0) {
  492. + if (levelfound[sp->hs_level])
  493. + sp->hs_time = 0;
  494. + else {
  495. + sp->hs_time = 1;
  496. + levelfound[sp->hs_level] = 1;
  497. + }
  498. }
  499. }
  500. @@ -433,7 +436,7 @@ printem(level, offset, hs, n, me)
  501. continue;
  502. }
  503. sp = &hs[item];
  504. - (void)sprintf(buf,
  505. + (void)snprintf(buf, sizeof(buf),
  506. "%3d%c %6d %-11s (%6d on %d)",
  507. item + offset, sp->hs_time ? '*' : ' ',
  508. sp->hs_score * sp->hs_level,
  509. diff --git a/trek/setup.c b/trek/setup.c
  510. index 1f14f27..fab5136 100644
  511. --- a/trek/setup.c
  512. +++ b/trek/setup.c
  513. @@ -234,11 +234,14 @@ setup()
  514. for (i = 0; i < NQUADS; i++)
  515. for (j = 0; j < NQUADS; j++)
  516. {
  517. + signed char tmp;
  518. q = &Quad[i][j];
  519. q->klings = q->bases = 0;
  520. q->scanned = -1;
  521. q->stars = ranf(9) + 1;
  522. - q->holes = ranf(3) - q->stars / 5;
  523. + tmp = ranf(3) - q->stars / 5;
  524. + tmp = tmp < 0 ? 0 : tmp;
  525. + q->holes = tmp;
  526. q->qsystemname = 0;
  527. }
  528. --