-/* $NetBSD: hack.rumors.c,v 1.6 2009/06/07 18:30:39 dholland Exp $ */
+/* $NetBSD: hack.rumors.c,v 1.9 2011/08/06 20:18:26 dholland Exp $ */
/*
* Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica,
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: hack.rumors.c,v 1.6 2009/06/07 18:30:39 dholland Exp $");
+__RCSID("$NetBSD: hack.rumors.c,v 1.9 2011/08/06 20:18:26 dholland Exp $");
#endif /* not lint */
#include "hack.h" /* for RUMORFILE and BSD (strchr) */
#include "extern.h"
#define CHARSZ 8 /* number of bits in a char */
-int n_rumors = 0;
-int n_used_rumors = -1;
-char *usedbits;
-void
+static int n_rumors = 0;
+static int n_used_rumors = -1;
+static char *usedbits;
+
+static void init_rumors(FILE *);
+static int skipline(FILE *);
+static void outline(FILE *);
+static int used(int);
+
+static void
init_rumors(FILE *rumf)
{
int i;
n_rumors++;
rewind(rumf);
i = n_rumors / CHARSZ;
- usedbits = (char *) alloc((unsigned) (i + 1));
+ usedbits = alloc(i + 1);
for (; i >= 0; i--)
usedbits[i] = 0;
}
-int
+static int
skipline(FILE *rumf)
{
char line[COLNO];
}
}
-void
+static void
outline(FILE *rumf)
{
char line[COLNO];
if ((ep = strchr(line, '\n')) != 0)
*ep = 0;
pline("This cookie has a scrap of paper inside! It reads: ");
- pline(line);
+ pline("%s", line);
}
void
(void) fclose(rumf);
}
-int
+static int
used(int i)
{
return (usedbits[i / CHARSZ] & (1 << (i % CHARSZ)));