]>
git.cameronkatri.com Git - bsdgames-darwin.git/blob - hack/hack.rumors.c
1 /* $NetBSD: hack.rumors.c,v 1.4 1997/10/19 16:58:55 christos Exp $ */
4 * Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
9 __RCSID("$NetBSD: hack.rumors.c,v 1.4 1997/10/19 16:58:55 christos Exp $");
12 #include "hack.h" /* for RUMORFILE and BSD (strchr) */
14 #define CHARSZ 8 /* number of bits in a char */
16 int n_used_rumors
= -1;
25 while (skipline(rumf
))
28 i
= n_rumors
/ CHARSZ
;
29 usedbits
= (char *) alloc((unsigned) (i
+ 1));
40 if (!fgets(line
, sizeof(line
), rumf
))
42 if (strchr(line
, '\n'))
53 if (!fgets(line
, sizeof(line
), rumf
))
55 if ((ep
= strchr(line
, '\n')) != 0)
57 pline("This cookie has a scrap of paper inside! It reads: ");
66 if (n_rumors
<= n_used_rumors
||
67 (rumf
= fopen(RUMORFILE
, "r")) == (FILE *) 0)
69 if (n_used_rumors
< 0)
73 rn
= rn2(n_rumors
- n_used_rumors
);
75 while (rn
|| used(i
)) {
76 (void) skipline(rumf
);
81 usedbits
[i
/ CHARSZ
] |= (1 << (i
% CHARSZ
));
92 return (usedbits
[i
/ CHARSZ
] & (1 << (i
% CHARSZ
)));