]>
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.
10 #define __UNCONST(a) ((void *)(unsigned long)(const void *)(a))
12 #define RANDRAND 1152921504606846976.0 /* that's 2**60 */
13 #define HALFRAND 0x40000000 /* that's 2**30 */
14 #define myrand() (int)random()
15 #define rand_mod(m) ((myrand() / 37) % (m)) /* pick number in 0..m-1 */
17 * The reason for the /37 above is that our random number generator yields
18 * successive evens and odds, for some reason. This makes strange star maps.
21 /* we get fractions of seconds from calling ftime on timebuf */
23 extern struct timespec timebuf
;
24 #define roundsleep(x) (clock_gettime(CLOCK_REALTIME, &timebuf),sleep(timebuf.tv_nsec > (500 * 1000 * 1000) ?x+1:x))
29 EXT
int len_last_line_got
INIT(0);
30 /* strlen of some_buf after */
31 /* some_buf = get_a_line(bufptr,buffersize,fp) */
35 /* is the string for makedir a directory name or a filename? */
42 void movc3(int, char *, char *);
43 __dead
void no_can_do(const char *);
45 void *safemalloc(size_t size
);
46 char *safecpy(char *, const char *, size_t);
47 char *cpytill(char *, const char *, int);
48 char *instr(const char *, const char *);
50 int eaccess(const char *, mode_t
);
52 __dead
void prexit(const char *);
53 char *savestr(const char *);
54 char *getval(const char *, const char *);