File: sysdep.h

package info (click to toggle)
jove 4.16-5
  • links: PTS
  • area: main
  • in suites: potato, slink
  • size: 1,804 kB
  • ctags: 2,866
  • sloc: ansic: 27,140; makefile: 401
file content (624 lines) | stat: -rw-r--r-- 18,455 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
/************************************************************************
 * This program is Copyright (C) 1986-1996 by Jonathan Payne.  JOVE is  *
 * provided to you without charge, and with no warranty.  You may give  *
 * away copies of JOVE, including sources, provided that this notice is *
 * included in all the files.                                           *
 ************************************************************************/

/*
 * System Feature Selection: describe OS and C system to JOVE.  See sysdep.doc
 * for a better description of what the different #define feature symbols
 * mean.  If you add new ones, please keep the syntax of the first #ifdef, so
 * that "grep System: sysdep.h" catches the first line of all symbols.
 */

/* System: Solaris 2.0, SunOS 5.0 -- use SYSVR4 and GRANTPT_BUG */

/* System: Solaris 2.x, SunOS 5.x -- use SYSVR4 */

#ifdef SUNOS41	/* System: SunOS4.1 to 4.1.3 */
# define TERMIOS	1
# define USE_GETCWD	1
# define POSIX_UNISTD	1
# define USE_SELECT	1
# define PTYPROCS	1
# define BSD_PTYS	1
# define POSIX_PROCS	1
# define BSD_SIGS	1
# define JOB_CONTROL	1
# define BSD_SETPGRP	1
# define USE_KILLPG	1
# define USE_GETPWNAM	1
# define USE_GETHOSTNAME	1
# define NO_STRERROR	1
# define USE_FSYNC	1
# define USE_FSTAT	1
# define USE_FCHMOD	1
# define USE_CTYPE	1
#endif

#ifdef SUNOS40	/* System: SunOS4.0 to 4.0.3c */
/* Almost identical to SUNOS41, main difference is that SUNOS41 uses
 * POSIX_PROCS, this one uses BSD_WAIT/WAIT3, USE_MEMORY_H.
 * Beware: TERMIO under SunOS 4.0 does not allow VSUSP to be changed,
 * so we cannot use it.
 */
/* try to patch over <termios.h> problems */
# define TERMIOS	1
# define setsid()	/* SunOS 4.0 apparently has no concept of session */
# define cfgetospeed(p)	(CBAUD & (p)->c_cflag)
# define tcgetattr(fd, p)	ioctl((fd), TCGETS, (UnivPtr)(p))
# define tcsetattr(fd, oa, p)	ioctl((fd), (oa), (UnivPtr)(p))
/* fake values for "optional_actions" (oa) arg to tcsetattr */
#  define TCSANOW	TCSETS
#  define TCSADRAIN	TCSETSW
#  define TCSAFLUSH	TCSETSF
/* end of <termios.h> patches */

# define USE_GETCWD	1
# define USE_SELECT	1
# define PTYPROCS	1
# define BSD_PTYS	1
# define BSD_WAIT	1
# define WAIT3		1
# define BSD_SIGS	1
# define JOB_CONTROL	1
# define USE_VFORK	1
# define BSD_SETPGRP	1
# define USE_KILLPG	1
# define USE_GETPWNAM	1
# define USE_GETHOSTNAME	1
# define NO_STRERROR	1
# define USE_FSYNC	1
# define USE_FSTAT	1
# define USE_FCHMOD	1
# define USE_MEMORY_H	1
#endif

#ifdef SUNOS3	/* System: SunOS before 4.0, eg. 3.5. not recently tested */
/* This is very close to BSD4 */
# define SGTTY		1
# define USE_GETWD	1
# define USE_SELECT	1
# define PTYPROCS	1
# define BSD_PTYS	1
# define BSD_WAIT	1
# define WAIT3		1
# define BSD_SIGS	1
# define JOB_CONTROL	1
# define USE_VFORK	1
# define BSD_SETPGRP	1
# define USE_KILLPG	1
# define BSD_DIR	1
# define USE_GETPWNAM	1
# define SIGRESTYPE	int
# define SIGRESVALUE	0
# define USE_GETHOSTNAME	1
# define NO_STRERROR	1
# define USE_FSYNC	1
# define USE_FSTAT	1
# define USE_FCHMOD	1
/* # define USE_BCOPY	1 */
/* # define USE_INDEX	1 */
#endif

#ifdef AIX3_2	/* System: IBM RS6000 running AIX 3.2 */
# define AIX		1
# define FULL_UNISTD	1
# define USE_GETWD	1
# define TERMIOS	1	/* uses termio struct for terminal modes */
# define USE_UNAME	1
# define USE_SELECT	1
# define USE_SELECT_H	1
# define PTYPROCS	1
# define BSD_PTYS	1
# define NO_EOF_FROM_PTY    1	/* BUG! */
# define POSIX_PROCS	1
# define WAIT3		1
# define POSIX_SIGS	1
# define JOB_CONTROL	1
# define USE_GETPWNAM	1
# define USE_UNAME	1
# define USE_FSYNC	1
# define USE_FSTAT	1
# define USE_FCHMOD	1
# define USE_CTYPE	1
#endif

#ifdef __QNX__	/* System: QNX OS for x86 family */
/* Note: this must be placed before BSDPOSIX ifdef (we define BSDPOSIX). */
# define BSDPOSIX	1
# define ONLCR		OPOST	/* how to do ONLCR */
# define USE_SELECT_H	1
#endif

#ifdef BSDPOSIX	/* System: Posix system with BSD flavouring for ptys */
/* System: BSDI, 386BSD, BSD4.4, NetBSD -- BSDPOSIX */
/* System: DEC Ultrix 4.2 -- BSDPOSIX */
/* System: DEC OSF/1 V1.3 -- BSDPOSIX + NO_TIOCREMOTE + NO_TIOCSIGNAL */
/* System: LINUX (MCC-Interim release) -- BSDPOSIX */
/* Also seems to work for SunOS4.1.3! */
# define TERMIOS	1
# define USE_GETCWD	1
# define FULL_UNISTD	1
# define USE_SELECT	1
# define PTYPROCS	1
# define BSD_PTYS	1
# define POSIX_PROCS	1
# define POSIX_SIGS	1
# define JOB_CONTROL	1
# define BSD_SETPGRP	1
# define USE_KILLPG	1
# define USE_GETPWNAM	1
# define USE_GETHOSTNAME	1
# define USE_FSYNC	1
# define USE_FSTAT	1
# define USE_FCHMOD	1
#endif

#ifdef LINUX
# define TERMIOS	1
# define USE_GETCWD	1
# define FULL_UNISTD	1
# define USE_SELECT	1
# define PTYPROCS	1
# define BSD_PTYS	1
# define POSIX_PROCS	1
# define POSIX_SIGS	1
# define JOB_CONTROL	1
//# define BSD_SETPGRP	1
# define USE_KILLPG	1
# define USE_GETPWNAM	1
# define USE_UNAME	1
# define USE_FSYNC	1
# define USE_FSTAT	1
# define USE_FCHMOD	1
# define USE_CTYPE 
#endif

#ifdef IRIX
# define _BSD_COMPAT	1	/* Turn on BSD setpgrp and other neat things */
# define TERMIOS	1
# define USE_GETCWD	1
# define FULL_UNISTD	1
# define USE_SELECT	1
# define PTYPROCS	1
# define POSIX_PROCS	1
# define POSIX_SIGS	1
# define JOB_CONTROL	1
# ifdef IRIX4
   /* Should work for IRIX 4.0.4 back to 3.2 or 3.3.  This is a Posix system
    * with its own way of doing PTYS.  Older versions may need MIPS_CC_BUG
    * defined as well.
    */
#  define IRIX_PTYS	1
#  define NO_TIOCREMOTE	1
#  define SIGRESTYPE	int
#  define SIGRESVALUE	0
# else
   /* IRIX 5 and later */
#  define SVR4_PTYS	1
#  define NO_TIOCREMOTE	1
#  define NO_TIOCSIGNAL	1
#  define SIGRESTYPE	void
#  define SIGRESVALUE	/*void!*/
# endif
# define BSD_SETPGRP	1
# define USE_GETPWNAM	1
# define USE_KILLPG	1
# define USE_GETHOSTNAME	1
# define USE_CTYPE	1
#endif

#ifdef SYSVR4	/* System: System V, Release 4 and derivatives */
/* System: Consensys V4 -- use SYSVR4 and GRANTPT_BUG */
/* System: DEC OSF/1 V2.0 or later -- use SYSVR4 */
/* System: DEC OSF R1.3MK -- use SYSVR4 */
/* System: Solaris 2.0, SunOS 5.0 -- use SYSVR4 and GRANTPT_BUG */
/* System: Solaris 2.x, SunOS 5.x -- use SYSVR4 */
/* Note: some versions of System V Release 4 have a bug in that affects
 * interactive processes.  Examples include Consensys V4 and SunOS 5.0
 * also known as Solaris 5.0.  See the description of GRANTPT_BUG in
 * sysdep.doc
 */
# define TERMIOS	1
# define USE_GETCWD	1
# define FULL_UNISTD	1
# define USE_SELECT	1
# define PTYPROCS	1
# define SVR4_PTYS	1
# define POSIX_PROCS	1
# define POSIX_SIGS	1
# define JOB_CONTROL	1
# define USE_UNAME	1
# define USE_GETPWNAM	1
# define USE_FSYNC	1
# define USE_FSTAT	1
# define USE_FCHMOD	1
# define REALSTDC	1
# define USE_CTYPE	1
#endif

#ifdef HPUX	/* System: Hewlett-Packard HP-UX 9.01 */
# define TERMIOS	1
# define USE_BSDTTYINCLUDE	1	/* No other way to turn off ^Y */
# define USE_GETCWD	1
# define FULL_UNISTD	1
# define USE_SELECT	1
# define PTYPROCS	1
# define BSD_PTYS	1
# define POSIX_PROCS	1
# define NO_EOF_FROM_PTY    1	/* BUG! */
# define POSIX_SIGS	1
# define JOB_CONTROL	1
# define USE_UNAME	1
# define DEFINE_PC_BC_UP_OSPEED	1	/* May be needed for all SYSVR2 */
#endif

#ifdef BSD4	/* System: Berkeley BSD4.x, 2.9, 2.10, MIPS RiscOS 4.x */
/* MIPS needs -systype bsd43, older releases (before 4.50?) may need
 * MIPS_CC_BUG defined as well.
 */
# define SGTTY		1
# define USE_GETWD	1
# define USE_SELECT	1
# define PTYPROCS	1
# define BSD_PTYS	1
# define BSD_WAIT	1
# define WAIT3		1
# define BSD_SIGS	1
# define JOB_CONTROL	1
# define USE_VFORK	1
# define BSD_SETPGRP	1
# define USE_KILLPG	1
# define BSD_DIR	1
# define SIGRESTYPE	int
# define SIGRESVALUE	0
# define USE_GETHOSTNAME	1
# define NO_STRERROR	1
# define USE_FSYNC	1
# define USE_FSTAT	1
# define USE_FCHMOD	1
# define USE_BCOPY	1
# define USE_INDEX	1
#endif

#ifdef SCO	/* System: SCO ODT 3.0 */
# define TERMIOS	1
# define FULLUNISTD	1
# define USE_GETCWD	1
# define POSIX_UNISTD	1
# define USE_SELECT	1
# define PTYPROCS	1
# define BSD_PTYS	1
# define POSIX_PROCS	1
# define JOB_CONTROL	1
# define USE_UNAME	1
/* In SCO ODT 3.0, a wait() will never finish if SIGCHLD is being held.
 * We think that this is a bug.  It's rumoured to be "fixed" in the next
 * release.  JOVE's IPROCS code no longer triggers this bug.
 */
# define PTYPROCS	1
# define USE_CTYPE	1
#endif

#ifdef _MSC_VER	/* System: Microsoft C for the IBM-PC under MSDOS or WIN32 */
# if defined(_WIN32) && !defined(WIN32)
#  define WIN32 _WIN32
# endif
# ifdef WIN32
#  define WINRESIZE	1
# else /* ! WIN32 => MSDOS */
#  define IBMPCDOS		1
#  define MALLOC_CACHE	1	/* DGROUP gets full otherwise */
#  if defined(M_I86LM)	/* large memory model */
#   define NBUF		62	/* NBUF*JBUFSIZ must be less than 64 kB */
#  else
#   define NBUF		3
#   define FAR_LINES	1	/* to squeeze larger files, distance Lines */
#  endif
# endif
# define REALSTDC	1	/* MS C only defines __STDC__ if you use /Za */
#endif

#ifdef ZTCDOS	/* System: Zortech C V3.0 for the IBM-PC under MSDOS */
# define IBMPCDOS		1
# define getch		jgetch	/* UGH!  Zortech steals from our namespace. */
# define MALLOC_CACHE	1	/* DGROUP gets full otherwise */
# define REALSTDC	1	/* close enough for us, but ZTCDOS doesn't define __STDC__ */
# ifdef M_I86LM		/* large memory model */
#  define NBUF		62	/* NBUF*JBUFSIZ must be less than 64 kB */
# else
#  define NBUF		3
#  define FAR_LINES	1	/* to squeeze larger files, distance Lines */
# endif
  /* (1) specify stack size, and
   * (2) request support of wildcards in command-line args (UGH!)
   */
# define STACK_DECL	unsigned int _stack = 0x2000; WILDCARDS
# define dostime_t	dos_time_t	/* is Zortech out of step? */
# define _dos_gettime	dos_gettime
#endif

#if defined(__WATCOMC__) && defined(MSDOS)	/* System: Watcom C V10.0 for the IBM-PC under MSDOS */
# define IBMPCDOS		1
# define MALLOC_CACHE	1	/* DGROUP gets full otherwise */
# define REALSTDC	1	/* close enough for us, but ZTCDOS doesn't define __STDC__ */
# ifdef M_I86LM		/* large memory model */
#  define NBUF		62	/* NBUF*JBUFSIZ must be less than 64 kB */
# else
#  define NBUF		3
#  define FAR_LINES	1	/* to squeeze larger files, distance Lines */
# endif
#endif

#ifdef __BORLANDC__	/* System: Borland C/C++ (v3.1) for the IBM-PC under MSDOS */
# define IBMPCDOS		1
# define MALLOC_CACHE	1	/* DGROUP gets full otherwise */
# define REALSTDC	1	/* close enough for us, but not strict ANSI */
# ifdef __LARGE__
#  define NBUF		62	/* NBUF*JBUFSIZ must be less than 64 kB */
#  define FAR_LINES 1	/* to squeeze larger files, distance Lines */
# else
#  ifdef __MEDIUM__
#    define NBUF	3
#    define FAR_LINES 1	/* to squeeze larger files, distance Lines */
#  endif
# endif
# define STACK_DECL	unsigned int _stklen = 0x2000;		/* Borland's way of specifying stack size */
#endif

/* All the systems marked with XXX_ are ones that this version of Jove (4.16)
 * has not been tested on.  4.15 was the transition from implicit #ifdefs
 * scattered throughout the code to feature-based ifdefs that MUST be
 * enabled in sysdep.h.  The #ifdef XXX_* below have been left in to provide a
 * guide to re-porting this version to those architectures.  If you do so
 * successfully, please send a copy of these changes to
 * jovehacks@cs.toronto.edu and we'll try to incorporate those changes above
 * and get rid of the XXX_.
 */

#ifdef XXX_M_XENIX	/* System: Microsoft or SCO Xenix */
/* #define NBUF	48 */	/* if we are on a 286, NBUF*JBUFSIZ must be less than 64 kB */
# define BSD_DIR	1
#endif

#ifdef XXX_SYSV		/* System: System V Rel. 2, System III */
# define TERMIO		1
# define USE_PWD
# define NONBLOCKINGREAD	1
# define USE_MEMORY_H	1
# define DIRENT_EMULATE	1	/* for truly old versions? */
#endif

#ifdef XXX_A_UX		/* System: A/UX on a MacII (Do *not* define "MAC") */
/* It might be better to try BSDPOSIX for newer A/UX. */
# define BSD_WAIT	1
# define BSD_DIR	1
# define WAIT3		1
# define BSD_SIGS	1	/* ??? */
# define USE_KILLPG	1
# define TERMIO		1	/* uses termio struct for terminal modes */
# define USE_GETHOSTNAME	1
# define USE_SELECT	1
#endif

#ifdef XXX_OLDMIPS	/* System: MIPS-SYSV, Irix before 3.3. */
/* Older MIPS (UMIPS-SYSV, anything other than their 4.3 port before
 * RISCOS4.x) and SGI 4D OSes (anything before Irix3.3) have BSD style wait,
 * and directory routines if you link -lbsd and define -I/usr/include/bsd on
 * the compile line. But they have SysV style signals.  Jove was ported to the
 * SGI 68K boxes once, but it the mods seem to have been lost.
 */
# define BSD_WAIT	1	/* Berkeley style sys/wait.h */
# define BSD_DIR	1	/* Berkeley style dirent routines */
#endif

#ifdef XXX_MSC51	/* System: Microsoft C 5.1 on IBM PC under DOS*/
/* This hasn't been tested recently.  Consider stealing ZTCDOS settings. */
# define IBMPCDOS		1
# define NO_PTRPROTO	1
# define REALSTDC	1	/* well, almost */
# ifdef M_I86LM		/* large memory model */
#  define NBUF		62	/* NBUF*JBUFSIZ must be less than 64 kB */
# else
#  define SMALL		1
# endif
#endif

#ifdef THINK_C	/* System: Think C version 5.0 on the Macintosh */
# define MAC 1
# define REALSTDC	1	/* we hope */
# define MALLOC_CACHE	1   /* Only 32K of static space on Mac, so... */
  typedef long	off_t;
# define USE_GETCWD	1
# define USE_INO	1	/* we fake it */
  typedef int	dev_t;
  typedef int	ino_t;
# define DIRECTORY_ADD_SLASH 1
# define EOL	'\r'	/* end-of-line character for files */
# define WINRESIZE	1
# define AUTO_BUFS	1	/* slim down data segment */
#endif

/**************** Common Characteristics ****************/

#ifdef pdp11
/* On the PDP-11, UNIX allocates at least 8K for the stack.
 * In order not to waste this space, we allocate
 * a bunch of buffers as autos.
 */
# define AUTO_BUFS	1
#endif

#ifdef IBMPCDOS	/* Common characteristics for IBM-PC MS-DOS systems. */
# ifndef MSDOS
#  define MSDOS	1
# endif
# define PCNONASCII	0xFF	/* prefix for peculiar IBM PC key codes */
# define NO_JSTDOUT	1	/* don't use jstdout */
# define CODEPAGE437	1	/* Code Page 437 English display characters */
# define PCSCRATTR	1	/* exploit IBMPC screen attributes */
# define HIGHLIGHTING	1	/* highlighting is used for mark and scrollbar */
#endif

#ifdef MSDOS	/* Common characteristics for MS-DOS systems. */
# define MSDOS_PROCS	1	/* spawn et al */
# define FILENAME_CASEINSENSITIVE 1
# define USE_CRLF 1
# define DIRECTORY_ADD_SLASH 1
# define MSFILESYSTEM 1
#endif

#ifdef WIN32	/* Common characteristics for WIN32 systems. */
# define PCNONASCII	0xFF	/* prefix for peculiar IBM PC key codes */
# define NO_JSTDOUT	1	/* don't use jstdout */
# define CODEPAGE437	1	/* Code Page 437 English display characters */
# define PCSCRATTR	1	/* exploit IBMPC screen attributes */
# define HIGHLIGHTING	1	/* highlighting is used for mark and scrollbar */
# define MSDOS_PROCS	1	/* spawn et al */
# define FILENAME_CASEINSENSITIVE 1
# define USE_CRLF 1
# define DIRECTORY_ADD_SLASH 1
# define MSFILESYSTEM 1
#endif

/* The operating system (MSDOS, WIN32, or MAC) must be defined by this point. */
#if !(defined(MSDOS) || defined(WIN32) || defined(MAC))
# define UNIX	1	/* default to UNIX */
#endif

#ifdef UNIX	/* Common characteristics for UNIX systems. */
/* Our defaults tend to be conservative and lean towards pure SYSV */
# define USE_INO	1
# define TERMCAP	1
# define WINRESIZE	1
# define MOUSE		1
# if !(defined(NO_IPROCS) || defined(PIPEPROCS) || defined(PTYPROCS))
#  define PIPEPROCS	1	/* use pipes */
# endif
# if !defined(TERMIOS) && !defined(SGTTY)
#  define TERMIO	1	/* uses termio struct for terminal modes */
# endif
/* At the moment, the PTY code mandates having select().  One day, this might
 * change.
 */
# if defined(PTYPROCS) && !defined(USE_SELECT)
   sysdep.h: Sorry, PTYPROCS requires the select() system call.  You must
   either define USE_SELECT or undefine PTYPROCS.
# endif
# if defined(SIGCLD) && !defined(SIGCHLD)
#  define SIGCHLD	SIGCLD
# endif
#endif /* UNIX */

/*************************************************************************
 *
 * The things below here aren't meant to be tuned, but are included here
 * because they're dependent on the things defined earlier in the file.
 */
#ifdef USE_BCOPY
# define byte_copy(from, to, len)	bcopy((UnivConstPtr)(from), (UnivPtr)(to), (size_t)(len))
# define byte_zero(s, n)	bzero((UnivPtr)(s), (size_t)(n))
#endif

#ifndef byte_copy
# ifdef USE_MEMORY_H
#  include <memory.h>
# endif
# define byte_copy(from, to, count)	memcpy((UnivPtr)(to), (UnivConstPtr)(from), (size_t)(count))
# define byte_zero(s, n)		memset((UnivPtr)(s), 0, (size_t)(n))
#endif

#ifdef USE_INDEX
# define strchr		index
# define strrchr	rindex
#endif

#ifdef FULL_UNISTD
# define POSIX_UNISTD	1
#endif

/* SSIZE_T: result type of read() and write() */
#ifdef FULL_UNISTD
# define SSIZE_T    ssize_t
#endif

#ifndef SSIZE_T
# define SSIZE_T    int
#endif

/* Determine if really ANSI C */
#ifdef __STDC__
# if __STDC__ > 0
#  define REALSTDC 1
# endif
#endif

/* Determine number of buffers and the size of a buffer
 * (and hence the maximum length of a line, among other things).
 */

#ifdef SMALL
# ifndef NBUF
#  define NBUF		3
# endif
# ifndef JLGBUFSIZ
#  define JLGBUFSIZ	9
# endif
#endif

#ifndef NBUF
# define NBUF 64
#endif

#ifndef JLGBUFSIZ
# define JLGBUFSIZ 10
#endif

#define JBUFSIZ	(1<<JLGBUFSIZ)


#ifndef NCHARS
# define NCHARS 0400
#endif

#ifndef EOL
# define EOL	'\n'	/* end-of-line character for files */
#endif

#ifndef MSDOS	/* maximum path length (including '\0') */
# define FILESIZE	256
#else /* MSDOS */
# define FILESIZE	128	/* currently, 2+1+64+3+1+3+1 == 80 ought to be OK */
#endif /* MSDOS */

#ifndef SIGRESTYPE	/* default to void, correct for most modern systems */
# define SIGRESTYPE	void
# define SIGRESVALUE	/*void!*/
#endif

/* daddr: tmp file index type (see temp.h)
 *
 * On a system which limits JOVE to a very small data segment,
 * it may be worthwhile limiting daddr to a short.  This reduces
 * the size of a Line descriptor, but reduces the addressable size
 * of the temp file.  This is reasonable on a PDP-11 and perhaps
 * an iAPX*86.
 * NOTE: logically, daddr is unsigned, but a signed type will work
 * if you cannot use an unsigned type.
 */

#ifdef SMALL
  typedef unsigned short	daddr;
#else
  typedef unsigned long	daddr;
#endif /* SMALL */

#define NULL_DADDR		((daddr) 0)

#ifndef CHAR_BITS
# define CHAR_BITS	8	/* factor to convert sizeof => bits */
#endif

#define DDIRTY	((daddr)1 << (sizeof(daddr)*CHAR_BITS - 1))	/* daddr dirty flag */