Commit | Line | Data |
---|---|---|
6941fcc4 | 1 | /* |
c5749c79 KB |
2 | * Copyright (c) 1988 Regents of the University of California. |
3 | * All rights reserved. | |
4 | * | |
5 | * Redistribution and use in source and binary forms are permitted | |
5e8b0e60 KB |
6 | * provided that the above copyright notice and this paragraph are |
7 | * duplicated in all such forms and that any documentation, | |
8 | * advertising materials, and other materials related to such | |
9 | * distribution and use acknowledge that the software was developed | |
10 | * by the University of California, Berkeley. The name of the | |
11 | * University may not be used to endorse or promote products derived | |
12 | * from this software without specific prior written permission. | |
13 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR | |
14 | * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED | |
15 | * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. | |
c5749c79 | 16 | * |
5e8b0e60 | 17 | * @(#)useful.h 4.4 (Berkeley) %G% |
c5749c79 | 18 | */ |
6941fcc4 | 19 | |
1146de6b | 20 | # ifndef makedev |
6e36536d | 21 | # include <sys/types.h> |
1146de6b EA |
22 | # endif |
23 | ||
24 | /* support for bool type */ | |
25 | typedef char bool; | |
6941fcc4 EA |
26 | # define TRUE 1 |
27 | # define FALSE 0 | |
28 | ||
29 | # ifndef NULL | |
30 | # define NULL 0 | |
31 | # endif NULL | |
21d76258 | 32 | |
1146de6b | 33 | /* bit hacking */ |
9e7b5f61 | 34 | # define bitset(bit, word) (((word) & (bit)) != 0) |
29871fef | 35 | |
04308aae EA |
36 | /* some simple functions */ |
37 | # ifndef max | |
38 | # define max(a, b) ((a) > (b) ? (a) : (b)) | |
39 | # define min(a, b) ((a) < (b) ? (a) : (b)) | |
40 | # endif max | |
41 | ||
4e5e456f EA |
42 | /* assertions */ |
43 | # ifndef NASSERT | |
44 | # define ASSERT(expr, msg, parm)\ | |
45 | if (!(expr))\ | |
46 | {\ | |
47 | fprintf(stderr, "assertion botch: %s:%d: ", __FILE__, __LINE__);\ | |
48 | fprintf(stderr, msg, parm);\ | |
49 | } | |
50 | # else NASSERT | |
51 | # define ASSERT(expr, msg, parm) | |
52 | # endif NASSERT | |
53 | ||
54 | /* sccs id's */ | |
55 | # ifndef lint | |
56 | # define SCCSID(arg) static char SccsId[] = "arg"; | |
57 | # else lint | |
58 | # define SCCSID(arg) | |
59 | # endif lint | |
60 | ||
29871fef | 61 | /* define the types of some common functions */ |
3991d0f8 EA |
62 | extern char *strcpy(), *strncpy(); |
63 | extern char *strcat(), *strncat(); | |
29871fef EA |
64 | extern char *malloc(); |
65 | extern char *index(), *rindex(); | |
66 | extern int errno; | |
62fff4f9 | 67 | extern time_t time(); |
29871fef EA |
68 | extern char *ctime(); |
69 | # ifndef V6 | |
70 | extern char *getenv(); | |
04674b08 EA |
71 | # endif V6 |
72 | # ifndef VMUNIX | |
040bceaf EA |
73 | typedef unsigned short u_short; |
74 | typedef long u_long; | |
75 | typedef char u_char; | |
76 | typedef int void; | |
04674b08 | 77 | # endif VMUNIX |