|
|
1.1 root 1: /* util.h - various useful utility definitions */
2:
3: /*
4: * $Header: /f/osi/h/quipu/RCS/util.h,v 7.1 90/07/09 14:38:41 mrose Exp $
5: *
6: *
7: * $Log: util.h,v $
8: * Revision 7.1 90/07/09 14:38:41 mrose
9: * sync
10: *
11: * Revision 7.0 89/11/23 21:56:45 mrose
12: * Release 6.0
13: *
14: */
15:
16: /*
17: * NOTICE
18: *
19: * Acquisition, use, and distribution of this module and related
20: * materials are subject to the restrictions of a license agreement.
21: * Consult the Preface in the User's Manual for the full terms of
22: * this agreement.
23: *
24: */
25:
26:
27: #ifndef _DIDUTIL_
28:
29: #define _DIDUTIL_
30:
31: #ifndef _H_UTIL /* PP interwork */
32:
33: #include <errno.h>
34: #include <stdio.h> /* minus the ctype stuff */
35: #include <ctype.h>
36: #include <setjmp.h>
37: #include "manifest.h"
38: #include "logger.h"
39:
40: #endif
41:
42: #ifndef _GENERAL_
43: #include "general.h"
44: #endif
45:
46: #include "quipu/config.h"
47: /* declarations that should have been in the system files */
48:
49: #ifndef _H_UTIL /* PP interwork */
50:
51: extern char *strcat ();
52: extern char *strcpy ();
53: extern char *strncpy ();
54: extern char *strdup ();
55: extern char *multcat ();
56: extern char *multcpy ();
57: extern char *index ();
58: extern char *rindex ();
59: extern char *gets ();
60: extern long lseek ();
61:
62: /* some common logical values */
63:
64: #ifndef TRUE
65: #define TRUE 1
66: #endif
67: #ifndef FALSE
68: #define FALSE 0
69: #endif
70: #ifndef YES
71: #define YES 1
72: #endif
73: #ifndef NO
74: #define NO 0
75: #endif
76: #ifndef OK
77: #define OK 0
78: #endif
79: #ifndef DONE
80: #define DONE 1
81: #endif
82: #ifndef NOTOK
83: #define NOTOK -1
84: #endif
85: #ifndef MAYBE
86: #define MAYBE 1
87: #endif
88:
89: /* stdio extensions */
90:
91: #ifndef lowtoup
92: #define lowtoup(chr) (islower(chr)?toupper(chr):chr)
93: #endif
94: #ifndef uptolow
95: #define uptolow(chr) (isupper(chr)?tolower(chr):chr)
96: #endif
97: #ifndef MIN
98: #define MIN(a,b) (( (b) < (a) ) ? (b) : (a) )
99: #endif
100: #ifndef MAX
101: #define MAX(a,b) (( (b) > (a) ) ? (b) : (a) )
102: #endif
103: #ifndef MAXINT
104: #define MAXINT (~(1 << ((sizeof(int) * 8) - 1)))
105: #endif
106:
107: #define isstr(ptr) ((ptr) != 0 && *(ptr) != '\0')
108: #define isnull(chr) ((chr) == '\0')
109: #define isnumber(c) ((c) >= '0' && (c) <= '9')
110:
111: /*
112: * provide a timeout facility
113: */
114:
115: extern jmp_buf _timeobuf;
116:
117: #define timeout(val) (setjmp(_timeobuf) ? 1 : (_timeout(val), 0))
118:
119: /*
120: * some common extensions
121: */
122: #define LINESIZE 1024 /* what we are prepared to consider a line length */
123: #define FILNSIZE 256 /* max filename length */
124: #define LOTS 1024 /* a max sort of thing */
125: #define MAXFILENAMELEN 15 /* size of largest fine name allowed */
126:
127: # define MAXFORK 10 /* no. of times to try a fork() */
128:
129: #ifndef NULLCP
130: #define NULLCP ((char *)0)
131: #define NULLVP ((char **) 0)
132:
133: extern char * malloc ();
134: extern char * smalloc ();
135:
136: #define _H_UTIL
137: #endif
138: #endif
139: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.