00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifdef WIN32
00014 #define MSDOS
00015 #endif
00016 #ifdef __POWERC
00017 # define __TURBOC__
00018 # define MSDOS
00019 #endif
00020
00021 #if (defined(__MSDOS__) && !defined(MSDOS))
00022 # define MSDOS
00023 #endif
00024
00025 #ifdef ATARI_ST
00026 # undef MSDOS
00027 #endif
00028
00029
00030
00031
00032 #if defined(__STDC__) || defined(MSDOS) || defined(ATARI_ST) || defined(sgi)
00033 # ifndef PROTO
00034 # define PROTO
00035 # endif
00036 # define MODERN
00037 #endif
00038
00039 #if defined(__IBMC__) || defined(__EMX__) || defined(__WATCOMC__) || defined(__MWERKS__)
00040 # ifndef PROTO
00041 # define PROTO
00042 # endif
00043 # define MODERN
00044 #endif
00045
00046 #if defined(__BORLANDC__) || (defined(__alpha) && defined(VMS))
00047 # ifndef PROTO
00048 # define PROTO
00049 # endif
00050 # define MODERN
00051 #endif
00052
00053 #if defined(__EMX__) || defined(__WATCOMC__) || defined(__BORLANDC__)
00054 # if (defined(OS2) && !defined(__32BIT__))
00055 # define __32BIT__
00056 # endif
00057 #endif
00058
00059 #if (defined(__OS2__) && !defined(OS2))
00060 # define OS2
00061 #endif
00062
00063 #ifdef __convexc__
00064 # define CONVEX
00065 #endif
00066
00067 #ifdef __COMPILER_KCC__
00068 # define TOPS20
00069 # define NOPROTO
00070 # define NO_SYMLINK
00071 # define NO_TERMIO
00072 # define DIRENT
00073 # define BIG_MEM
00074 extern int isatty();
00075 # define R__window_size winsiz
00076 #endif
00077
00078
00079 #if (defined(NOPROTO) && defined(PROTO))
00080 # undef PROTO
00081 #endif
00082
00083
00084 #ifdef PROTO
00085 # define OF(a) a
00086 #else
00087 # define OF(a) ()
00088 #endif
00089
00090
00091 #ifndef MODERN
00092 # define const
00093 #endif
00094
00095 #if defined(MACOS) || defined(__MWERKS__)
00096 # define DYN_ALLOC
00097 #endif
00098 #if (defined(MSDOS) && !defined(__GO32__) && !defined(WIN32))
00099 # ifdef __TURBOC__
00100 # include <alloc.h>
00101 # define DYN_ALLOC
00102
00103 void far * fcalloc OF((unsigned items, unsigned size));
00104 void fcfree (void *ptr);
00105 # else
00106 # include <malloc.h>
00107 # define farmalloc _fmalloc
00108 # define farfree _ffree
00109 # define fcalloc(nitems,itemsize) halloc((long)(nitems),(itemsize))
00110 # define fcfree(ptr) hfree((void huge *)(ptr))
00111 # endif
00112 #else
00113 # if defined(WIN32)
00114 # include <malloc.h>
00115 # endif
00116 # ifdef __WATCOMC__
00117 # undef huge
00118 # undef far
00119 # undef near
00120 # else
00121 # define huge
00122 # define far
00123 # define near
00124 # endif
00125 # define farmalloc malloc
00126 # define farfree free
00127 # define fcalloc(items,size) calloc((unsigned)(items), (unsigned)(size))
00128 # define fcfree free
00129 # if (!defined(PROTO) && !defined(TOPS20))
00130 extern char *calloc();
00131 # endif
00132 #endif
00133
00134
00135 #if (defined(OS2) && !defined(MSDOS))
00136
00137
00138 # define MSDOS
00139
00140 #endif
00141
00142
00143
00144 #if defined(MSDOS) || defined(VMS)
00145 # define MSVMS
00146 #endif
00147
00148
00149
00150
00151
00152
00153 #if defined(MSDOS) || defined(VMS) || defined(OS2) || defined(WIN32)
00154 # define case_map(c) upper[(c) & 0xff]
00155 # define to_up(c) upper[(c) & 0xff]
00156 #else
00157 # define case_map(c) (c)
00158 # define to_up(c) ((c) >= 'a' && (c) <= 'z' ? (c)-'a'+'A' : (c))
00159 #endif
00160
00161
00162 #include <stdio.h>
00163 #include <string.h>
00164 #ifdef MODERN
00165 # if (!defined(M_XENIX) && !(defined(__GNUC__) && defined(sun)))
00166 # include <stddef.h>
00167 # endif
00168 # include <stdlib.h>
00169 # if defined(SYSV) || defined(__386BSD__)
00170 # include <unistd.h>
00171 # endif
00172 typedef size_t extent;
00173
00174
00175
00176
00177 #else
00178 typedef unsigned int extent;
00179 # define void int
00180
00181
00182
00183
00184 #endif
00185
00186
00187 #ifdef VMS
00188 # include <types.h>
00189 # include <stat.h>
00190 # define unlink delete
00191 # define NO_SYMLINK
00192 # define SSTAT vms_stat
00193 #else
00194 # if defined(MACOS)
00195 # include <types.h>
00196 # include <stddef.h>
00197 # include <Files.h>
00198 # include <StandardFile.h>
00199 # include <Think.h>
00200 # include <LoMem.h>
00201 # include <Pascal.h>
00202 # include "macstat.h"
00203 # define NO_SYMLINK
00204 # elif defined (__MWERKS__)
00205 # include <stddef.h>
00206 # include <stat.h>
00207 # define NO_SYMLINK
00208 # else
00209 # ifdef ATARI_ST
00210 # include <ext.h>
00211 # include <tos.h>
00212 # else
00213 # ifdef AMIGA
00214 int wild OF((char *));
00215
00216 # if ( (!defined(BIG_MEM)) && (!defined(SMALL_MEM)))
00217 # define MEDIUM_MEM
00218 # endif
00219 # if defined(LATTICE) || defined(__SASC)
00220 # include <sys/types.h>
00221 # include <sys/stat.h>
00222 extern int isatty(int);
00223 # endif
00224 # ifdef AZTEC_C
00225 # include "amiga/z-stat.h"
00226 # define RMDIR
00227 # endif
00228 # else
00229 # include <sys/types.h>
00230 # include <sys/stat.h>
00231 # endif
00232 # endif
00233 # endif
00234 #endif
00235
00236
00237 #if defined (S_IFLNK) && defined(NO_SYMLINK)
00238 # undef S_IFLNK
00239 #endif
00240
00241
00242
00243 #ifdef pyr
00244 # define strrchr rindex
00245 # define ZMEM
00246 #endif
00247
00248
00249
00250 #ifdef VMS
00251 # define FOPR "r","ctx=stm"
00252 # define FOPM "r+","ctx=stm","rfm=fix","mrs=512"
00253 # define FOPW "w","ctx=stm","rfm=fix","mrs=512"
00254 #else
00255 # if defined(MODERN)
00256 # define FOPR "rb"
00257 # define FOPM "r+b"
00258 # ifdef TOPS20
00259 # define FOPW "w8"
00260 # else
00261 # define FOPW "wb"
00262 # endif
00263 # else
00264 # ifdef AMIGA
00265 # define FOPR "rb"
00266 # define FOPM "rb+"
00267 # define FOPW "wb"
00268 # else
00269 # define FOPR "r"
00270 # define FOPM "r+"
00271 # define FOPW "w"
00272 # endif
00273 # endif
00274 #endif
00275
00276
00277
00278
00279 #ifdef OS2
00280 # define FOPR_EX FOPM
00281 #else
00282 # define FOPR_EX FOPR
00283 #endif
00284
00285
00286
00287
00288
00289 #if (defined(MSDOS) && !defined(WIN32)) || defined(i386)
00290 # define UNALIGNED_OK
00291 #endif
00292 #if defined(mc68020) || defined(vax)
00293 # define UNALIGNED_OK
00294 #endif
00295
00296
00297
00298
00299
00300 #ifdef SMALL_MEM
00301 # define CBSZ 2048
00302 # define ZBSZ 2048
00303 #else
00304 # ifdef MEDIUM_MEM
00305 # define CBSZ 8192
00306 # define ZBSZ 8192
00307 # else
00308 # ifdef OS2
00309 # ifdef __32BIT__
00310 # define CBSZ 0x40000
00311 # define ZBSZ 0x40000
00312 # else
00313 # define CBSZ 0xE000
00314 # define ZBSZ 0x7F00
00315 # endif
00316 # else
00317 # ifdef TOPS20
00318 # define CBSZ 524288
00319 # define ZBSZ 524288
00320 # else
00321 # define CBSZ 16384
00322 # define ZBSZ 16384
00323 # endif
00324 # endif
00325 # endif
00326 #endif
00327
00328 #if (defined(BIG_MEM) || defined(MMAP)) && !defined(DYN_ALLOC)
00329 # define DYN_ALLOC
00330 #endif
00331
00332 #ifdef __human68k__
00333 # include <sys/xglob.h>
00334 # define MSVMS
00335 # define SSTAT h68_stat
00336 int h68_stat OF((char *, struct stat *));
00337 # define OS_CODE 0x300
00338 #endif
00339
00340 #ifdef ATARI_ST
00341 # define MSDOS
00342 # define MSVMS
00343 # ifndef O_BINARY
00344 # define O_BINARY 0
00345 # endif
00346 # ifndef S_IFMT
00347 # define S_IFMT (S_IFCHR|S_IFREG|S_IFDIR)
00348 # endif
00349
00350 #ifdef __IBMC__
00351 # ifndef S_IFMT
00352 # define S_IFMT 0xF000
00353 # endif
00354 #endif
00355
00356
00357
00358
00359 # define unlink st_unlink
00360 # define chmod st_chmod
00361 # define mktemp st_mktemp
00362 # define fopen st_fopen
00363 # define open st_open
00364 # define SSTAT st_stat
00365 # define findfirst st_findfirst
00366 # define link st_rename
00367 # define rmdir st_rmdir
00368
00369 int st_unlink OF((char *));
00370 int st_chmod OF((char *, int));
00371 char *st_mktemp OF((char *));
00372 FILE *st_fopen OF((char *, char *));
00373 int st_open OF((char *, int));
00374 int st_stat OF((char *, struct stat *));
00375 int st_findfirst OF((char *, struct ffblk *, int));
00376 int st_rename OF((char *, char *));
00377 int st_rmdir OF((char *));
00378 #endif
00379
00380 #ifndef SSTAT
00381 # define SSTAT stat
00382 #endif
00383 #ifdef S_IFLNK
00384 # define LSTAT lstat
00385 #else
00386 # define LSTAT SSTAT
00387 #endif
00388
00389
00390
00391 #ifdef AMIGA
00392 # define OS_CODE 0x100
00393 #endif
00394 #ifdef VMS
00395 # define OS_CODE 0x200
00396 #endif
00397
00398
00399 #ifdef ATARI_ST
00400 # define OS_CODE 0x500
00401 #endif
00402 #ifdef OS2
00403 # define OS_CODE 0x600
00404 #endif
00405 #if defined(MACOS) || defined(__MWERKS__)
00406 # define OS_CODE 0x700
00407 #endif
00408
00409
00410 #ifdef TOPS20
00411 # define OS_CODE 0xa00
00412 #endif
00413 #ifdef WIN32
00414 # define OS_CODE 0xb00
00415 #endif
00416
00417
00418 #if defined(MSDOS) && !defined(OS_CODE)
00419 # define OS_CODE 0x000
00420 #endif
00421 #ifndef OS_CODE
00422 # define OS_CODE 0x300
00423 # ifndef R__UNIX
00424 # define R__UNIX
00425 # endif
00426 #endif
00427
00428
00429
00430