* Copyright (c) 1987 Regents of the University of California.
* Redistribution and use in source and binary forms are permitted
* provided that this notice is preserved and that due credit is given
* to the University of California at Berkeley. The name of the University
* may not be used to endorse or promote products derived from this
* software without specific prior written permission. This software
* is provided ``as is'' without express or implied warranty.
static char sccsid
[] = "@(#)getword.c 5.1 (Berkeley) %G%";
# define RN (((off_t) rand() << 16) | (off_t) rand())
* Get a valid word out of the dictionary file
fseek(inf
, abs(RN
% Dict_size
), 0);
if (fgets(Word
, BUFSIZ
, inf
) == NULL
)
if (fgets(Word
, BUFSIZ
, inf
) == NULL
)
Word
[strlen(Word
) - 1] = '\0';
if (strlen(Word
) < MINLEN
)
for (wp
= Word
; *wp
; wp
++)
* Return the absolute value of an integer