#include "../src/paths.h"
* Print a quotation from Zippy the Pinhead.
* Qux <Kaufman-David@Yale> March 6, 1986
#define YOW_FILE "yow.lines"
if (argc
> 2 && !strcmp (argv
[1], "-f"))
sprintf (file
, "%s%s", PATH_EXEC
, YOW_FILE
);
sprintf (file
, "%s/%s", PATH_EXEC
, YOW_FILE
);
if ((fp
= fopen(file
, "r")) == NULL
) {
/* initialize random seed */
srand((int) (getpid() + time((long *) 0)));
/* Get length of file, go to a random place in it */
if (fseek(fp
, 0, 2) == -1) {
if (fseek(fp
, offset
, 0) == -1) {
/* Read until SEP, read next line, print it.
(Note that we will never print anything before the first seperator.)
If we hit EOF looking for the first SEP, just recurse. */
while ((c
= getc(fp
)) != SEP
)
/* Skip leading whitespace, then read in a quotation.
If we hit EOF before we find a non-whitespace char, recurse. */
while (isspace(c
= getc(fp
)))
while ((c
= getc(fp
)) != SEP
&& c
!= EOF
) {
/* Yow! Is this quotation too long yet? */