|
|
1.1 root 1: /*
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
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.
16: *
17: * @(#)useful.h 4.4 (Berkeley) 6/29/88
18: */
19:
20: # ifndef makedev
21: # include <sys/types.h>
22: # endif
23:
24: /* support for bool type */
25: typedef char bool;
26: # define TRUE 1
27: # define FALSE 0
28:
29: # ifndef NULL
30: # define NULL 0
31: # endif NULL
32:
33: /* bit hacking */
34: # define bitset(bit, word) (((word) & (bit)) != 0)
35:
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:
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:
61: /* define the types of some common functions */
62: extern char *strcpy(), *strncpy();
63: extern char *strcat(), *strncat();
64: extern char *malloc();
65: extern char *index(), *rindex();
66: extern int errno;
67: extern time_t time();
68: extern char *ctime();
69: # ifndef V6
70: extern char *getenv();
71: # endif V6
72: # ifndef VMUNIX
73: typedef unsigned short u_short;
74: typedef long u_long;
75: typedef char u_char;
76: typedef int void;
77: # endif VMUNIX
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.