]>
git.cameronkatri.com Git - bsdgames-darwin.git/blob - warp/util.h
1 /* Header: util.h,v 7.0 86/10/08 15:14:37 lwall Exp */
4 * Revision 7.0 86/10/08 15:14:37 lwall
5 * Split into separate files. Added amoebas and pirates.
9 #define RANDRAND 1152921504606846976.0 /* that's 2**60 */
10 #define HALFRAND 0x40000000 /* that's 2**30 */
11 #define myrand() (int)random()
12 #define rand_mod(m) ((myrand() / 37) % (m)) /* pick number in 0..m-1 */
14 * The reason for the /37 above is that our random number generator yields
15 * successive evens and odds, for some reason. This makes strange star maps.
18 /* we get fractions of seconds from calling ftime on timebuf */
20 extern struct timespec timebuf
;
21 #define roundsleep(x) (clock_gettime(CLOCK_REALTIME, &timebuf),sleep(timebuf.tv_nsec > 5000000000 ?x+1:x))
26 EXT
int len_last_line_got
INIT(0);
27 /* strlen of some_buf after */
28 /* some_buf = get_a_line(bufptr,buffersize,fp) */
32 /* is the string for makedir a directory name or a filename? */
39 void movc3(int, char *, char *);
40 __dead
void no_can_do(const char *);
42 void *safemalloc(size_t size
);
43 char *safecpy(char *, const char *, size_t);
44 char *cpytill(char *, const char *, int);
45 char *instr(const char *, const char *);
47 int eaccess(const char *, mode_t
);
49 __dead
void prexit(const char *);
50 char *savestr(const char *);
51 char *getval(const char *, const char *);