|
|
1.1 root 1: /***************************************************************************
2: * This program is Copyright (C) 1986, 1987, 1988 by Jonathan Payne. JOVE *
3: * is provided to you without charge, and with no warranty. You may give *
4: * away copies of JOVE, including sources, provided that this notice is *
5: * included in all the files. *
6: ***************************************************************************/
7:
8: #ifdef THINK_C
9: # define MAC 1
10: # define defined(x) (x) /* take this out and you're in trouble... */
11: typedef int size_t;
12: #endif
13:
14: #if defined(MAC) || defined(MSDOS)
15: extern int errno;
16: #endif /* MAC */
17:
18: #if !(defined(MSDOS) || defined(MAC) || defined(__STDC__))
19: # define void int
20: #endif
21:
22: #ifndef __STDC__
23: #define const
24: #endif
25:
26: /* The operating system (MSDOS or MAC) must be defined by this point.
27: IBMPC is defined in the Makefile. All MAC defines should be
28: numerical (i.e. #define MAC 1) so that defined() will work. */
29:
30: #if !(defined(MSDOS) || defined(MAC))
31: # define UNIX
32: #endif
33:
34: #ifdef UNIX
35: # if !sun
36: extern int errno;
37: # endif
38: # if sun
39: # define YP_PASSWD /* if you are a sun running the yellow pages */
40: # endif
41: # define KILL0 /* kill(pid, 0) returns 0 if proc exists */
42: #endif /* UNIX */
43:
44: #ifdef UNIX
45: # ifdef pdp11
46: # define SMALL
47: # define JBUFSIZ 512 /* or 1024 */
48: # define NBUF 3
49: # else
50: # define VMUNIX /* Virtual Memory UNIX */
51: # define JBUFSIZ 1024
52: # ifdef iAPX286
53: # define NBUF 48 /* NBUF*JBUFSIZ must be less than 64 kB */
54: # else
55: # define NBUF 64 /* number of disk buffers */
56: # endif /* iAPX286 */
57: # endif
58: #endif
59:
60: #ifdef SMALL
61: typedef unsigned short daddr;
62: #else
63: # if defined(iAPX286) || defined(MSDOS) || defined(MAC)
64: typedef long daddr;
65: # else
66: typedef int daddr;
67: # endif /* iAPX286 */
68: #endif /* SMALL */
69:
70: #ifdef UNIX
71: /* pick your version of Unix */
72: # define BSD4_2 /* Berkeley 4.2 BSD */
73: # define BSD4_3 /* Berkeley 4.3 BSD and 2.10 BSD */
74: /*# define SYSV /* for (System III/System V) UNIX systems */
75: /*# define SYSVR2 /* system 5, rel. 2 */
76: /*# define SYSVR3 /* system 5, rel. 3 */
77: /* M_XENIX is defined by the Compiler */
78: #endif /* UNIX */
79:
80: #ifdef SYSVR3
81: # ifndef SYSVR2
82: # define SYSVR2 /* SYSVR2 is a subset of SYSVR3 */
83: # endif
84: # define SIGRESULT void
85: # define SIGRETURN { return; }
86: # ifndef SIGCHLD
87: # define SIGCHLD SIGCLD
88: # endif
89: #endif
90:
91: #ifdef SYSVR2
92: # ifndef SYSV
93: # define SYSV /* SYSV is a subset of SYSVR2 */
94: # endif
95: #endif
96:
97: #ifdef BSD4_3
98: # ifndef BSD4_2
99: # define BSD4_2 /* 4.3 is 4.2 only different. */
100: # endif
101: #endif
102:
103: #ifdef M_XENIX
104: # define iAPX286 1 /* we have segments */
105: # define BSD_DIR
106: #endif
107:
108: #ifdef MSDOS
109: # ifdef M_I86LM /* large memory model */
110: # define NBUF 64
111: # else
112: # define NBUF 3
113: # define SMALL
114: # endif
115: # define JBUFSIZ 512 /* or 1024 */
116: #endif
117:
118: #if (defined(BSD4_3) || defined(MAC))
119: # define RESHAPING /* enable windows to handle reshaping */
120: #endif
121:
122: #ifdef BSD4_2 /* byte_copy(from, to, len) */
123: # define byte_copy bcopy /* use fast assembler version */
124: # define byte_zero bzero
125: # define strchr index
126: # define strrchr rindex
127: # define BSD_SIGS /* Berkeley style signals */
128: # define BSD_WAIT /* Berkeley style sys/wait.h */
129: # define WAIT3 /* Berkeley style wait3() */
130: # define BSD_DIR /* Berkeley style dirent routines */
131: # define VFORK /* if you have vfork(2) */
132: # define JOB_CONTROL /* if you have job stopping */
133: #endif
134:
135: #ifdef JOB_CONTROL
136: # define MENLO_JCL
137: #endif
138:
139: #ifdef apple_ux /* A/UX on a MacII */
140: # define BSD_WAIT /* Berkeley style sys/wait.h */
141: # define BSD_DIR /* Berkeley style dirent routines */
142: # define WAIT3 /* Berkeley style wait3() */
143: # define BSD_SIGS /* Berkeley style signals */
144: #endif
145:
146: #ifdef mips
147: /*
148: * MIPS and SGI boxes have BSD style wait, and directory routines if you link
149: * -lbsd and define -I/usr/include/bsd on the compile line. But they have SysV
150: * style signals.
151: */
152: # define BSD_WAIT /* Berkeley style sys/wait.h */
153: # define BSD_DIR /* Berkeley style dirent routines */
154: # ifdef sgi
155: # define WAIT3 /* Berkeley style wait3() */
156: # endif
157: #endif
158:
159: #ifndef VFORK
160: # define vfork fork
161: #endif
162:
163: #ifndef BSD4_2
164: # define PIPEPROCS /* if IPROCS selected, use pipes */
165: #endif
166:
167: #if defined(SYSV) || defined(MSDOS) || defined(M_XENIX)
168: #include <memory.h>
169: # define byte_copy(s2, s1, n) memcpy((s1), (s2), (n))
170: # define byte_zero(s, n) memset((s), 0, (n))
171: #endif
172:
173: #ifndef SIGRESULT
174: # define SIGRESULT int
175: # define SIGRETURN { return 0; }
176: #endif
177:
178: #ifndef BSD4_2
179: # ifdef MENLO_JCL
180: # define signal sigset
181: # endif /* MENLO_JCL */
182: #endif
183:
184: #if !(defined(IBMPC) || defined(MAC))
185: # define TERMCAP
186: # define ASCII
187: #endif
188:
189: #ifdef ASCII /* seven bit characters */
190: # define NCHARS 0200
191: #else
192: # define NCHARS 0400
193: #endif
194:
195: #define CHARMASK (NCHARS - 1)
196:
197: #ifndef MSDOS
198: # define FILESIZE 256
199: #else /* MSDOS */
200: # define FILESIZE 64
201: #endif /* MSDOS */
202:
203: #if defined(BSD_SIGS)
204: extern long SigMask;
205:
206: # define SigHold(s) sigblock(SigMask |= sigmask((s)))
207: # define SigRelse(s) sigsetmask(SigMask &= ~sigmask((s)))
208: #else
209: # define SigHold(s) sighold(s)
210: # define SigRelse(s) sigrelse(s)
211: # define killpg(pid, sig) kill(-(pid), (sig))
212: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.