tc.os.h revision 69408
150472Speter/* $Header: /src/pub/tcsh/tc.os.h,v 3.86 2000/11/11 23:03:39 christos Exp $ */ 218218Speter/* 3228060Sbapt * tc.os.h: Shell os dependent defines 4228060Sbapt */ 518218Speter/*- 6228060Sbapt * Copyright (c) 1980, 1991 The Regents of the University of California. 767068Sobrien * All rights reserved. 818218Speter * 918218Speter * Redistribution and use in source and binary forms, with or without 1094821Sru * modification, are permitted provided that the following conditions 11228060Sbapt * are met: 12228060Sbapt * 1. Redistributions of source code must retain the above copyright 13228060Sbapt * notice, this list of conditions and the following disclaimer. 14228060Sbapt * 2. Redistributions in binary form must reproduce the above copyright 1518218Speter * notice, this list of conditions and the following disclaimer in the 16228060Sbapt * documentation and/or other materials provided with the distribution. 1767068Sobrien * 3. All advertising materials mentioning features or use of this software 1818218Speter * must display the following acknowledgement: 19 * This product includes software developed by the University of 20 * California, Berkeley and its contributors. 21 * 4. Neither the name of the University nor the names of its contributors 22 * may be used to endorse or promote products derived from this software 23 * without specific prior written permission. 24 * 25 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 26 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 28 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 31 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 32 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 33 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 34 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 35 * SUCH DAMAGE. 36 */ 37#ifndef _h_tc_os 38#define _h_tc_os 39 40#ifndef WINNT_NATIVE 41#define NEEDstrerror /* Too hard to find which systems have it */ 42#endif /* WINNT_NATIVE */ 43 44 45#ifdef notdef 46/* 47 * for SVR4 and linux we used to fork pipelines backwards. 48 * This should not be needed any more. 49 * more info in sh.sem.c 50 */ 51# define BACKPIPE 52#endif /* notdef */ 53 54#ifdef __CYGWIN__ 55# undef NEEDstrerror 56#endif 57 58#ifdef _VMS_POSIX 59# ifndef NOFILE 60# define NOFILE 64 61# endif /* NOFILE */ 62# define nice(a) setprio((getpid()),a) 63# undef NEEDstrerror /* won't get sensible error messages otherwise */ 64# define NEEDgethostname 65# include <sys/time.h> /* for time stuff in tc.prompt.c */ 66# include <limits.h> 67#endif /* atp vmsposix */ 68 69#if defined(DECOSF1) || defined(HPUXVERSION) 70# include <sys/signal.h> 71#endif /* DECOSF1 || HPUXVERSION */ 72 73#ifdef DECOSF1 74# include <sys/ioctl.h> 75#endif /* DECOSF1 */ 76 77#if defined(OPEN_MAX) && !defined(NOFILE) 78# define NOFILE OPEN_MAX 79#endif /* OPEN_MAX && !NOFILE */ 80 81#if defined(USR_NFDS) && !defined(NOFILE) 82# define NOFILE USR_NFDS 83#endif /* USR_NFDS && !NOFILE */ 84 85#ifndef NOFILE 86# define NOFILE 256 87#endif /* NOFILE */ 88 89#if defined(linux) || defined(__NetBSD__) || defined(__FreeBSD__) || SYSVREL >= 4 || defined(_MINIX_VMD) 90# undef NEEDstrerror 91#endif /* linux || __NetBSD__ || __FreeBSD__ || SYSVREL >= 4 || _MINIX_VMD */ 92 93#if !defined(pyr) && !defined(sinix) 94/* Pyramid's cpp complains about the next line */ 95# if defined(BSD) && BSD >= 199306 96# undef NEEDstrerror 97# endif /* BSD && BSD >= 199306 */ 98#endif /* pyr */ 99 100#ifdef OREO 101# include <sys/time.h> 102# ifdef notdef 103 /* Don't include it, because it defines things we don't really have */ 104# include <sys/resource.h> 105# endif /* notdef */ 106# ifdef POSIX 107# include <sys/tty.h> 108# include <termios.h> 109# endif /* POSIX */ 110#endif /* OREO */ 111 112#ifndef NCARGS 113# ifdef _SC_ARG_MAX 114# define NCARGS sysconf(_SC_ARG_MAX) 115# else /* !_SC_ARG_MAX */ 116# ifdef ARG_MAX 117# define NCARGS ARG_MAX 118# else /* !ARG_MAX */ 119# ifdef _MINIX 120# define NCARGS 80 121# else /* !_MINIX */ 122# define NCARGS 1024 123# endif /* _MINIX */ 124# endif /* ARG_MAX */ 125# endif /* _SC_ARG_MAX */ 126#endif /* NCARGS */ 127 128#ifdef convex 129# include <sys/dmon.h> 130#endif /* convex */ 131 132#ifdef titan 133extern int end; 134#endif /* titan */ 135 136#ifdef hpux 137# ifdef lint 138/* 139 * Hpux defines struct ucred, in <sys/user.h>, but if I include that 140 * then I need to include the *world* 141 * [all this to pass lint cleanly!!!] 142 * so I define struct ucred here... 143 */ 144struct ucred { 145 int foo; 146}; 147# endif /* lint */ 148 149/* 150 * hpux 7.0 does not define it 151 */ 152# ifndef CSUSP 153# define CSUSP 032 154# endif /* CSUSP */ 155 156# include <signal.h> 157# if !defined(hp9000s500) && !(defined(SIGRTMAX) || defined(SIGRTMIN)) 158/* 159 * hpux < 7 160 */ 161# include <sys/bsdtty.h> 162# endif /* !hp9000s500 && !(SIGRTMAX || SIGRTMIN) */ 163 164# ifndef POSIX 165# ifdef BSDJOBS 166# define getpgrp(a) getpgrp2(a) 167# define setpgrp(a, b) setpgrp2(a, b) 168# endif /* BSDJOBS */ 169# endif /* POSIX */ 170#endif /* hpux */ 171 172/* 173 * ISC does not define CSUSP 174 */ 175#ifdef ISC 176# ifndef CSUSP 177# define CSUSP 032 178# endif /* CSUSP */ 179# if defined(POSIX) && !defined(TIOCGWINSZ) 180/* 181 * ISC defines this only in termio.h. If we are using POSIX and include 182 * termios.h, then we define it ourselves so that window resizing works. 183 */ 184# define TIOCGWINSZ (('T'<<8)|104) 185# endif /* POSIX && !TIOCGWINSZ */ 186#endif /* ISC */ 187 188#ifdef ISC202 189# undef TIOCGWINSZ 190#endif /* ISC202 */ 191 192/* 193 * XXX: This will be changed soon to 194 * #if (SYSVREL > 0) && defined(TIOCGWINSZ) 195 * If that breaks on your machine, let me know. 196 * 197 * It would break on linux, where all this is 198 * defined in <termios.h>. Wrapper added. 199 */ 200#if !defined(linux) && !defined(_VMS_POSIX) 201# if defined(INTEL) || defined(u3b2) || defined (u3b5) || defined(ub15) || defined(u3b20d) || defined(ISC) || defined(SCO) || defined(tower32) 202# ifdef TIOCGWINSZ 203/* 204 * for struct winsiz 205 */ 206# include <sys/stream.h> 207# include <sys/ptem.h> 208# endif /* TIOCGWINSZ */ 209# ifndef ODT 210# define NEEDgethostname 211# endif /* ODT */ 212# endif /* INTEL || u3b2 || u3b5 || ub15 || u3b20d || ISC || SCO || tower32 */ 213#endif /* !linux && !_VMS_POSIX */ 214 215#if defined(UNIXPC) || defined(COHERENT) 216# define NEEDgethostname 217#endif /* UNIXPC || COHERENT */ 218 219#ifdef IRIS4D 220# include <sys/time.h> 221# include <sys/resource.h> 222# ifndef POSIX 223/* 224 * BSDsetpgrp() and BSDgetpgrp() are BSD versions of setpgrp, etc. 225 */ 226# define setpgrp BSDsetpgrp 227# define getpgrp BSDgetpgrp 228# endif /* POSIX */ 229#endif /* IRIS4D */ 230 231/* 232 * For some versions of system V software, specially ones that use the 233 * Wollongong Software TCP/IP, the FIOCLEX, FIONCLEX, FIONBIO calls 234 * might not work correctly for file descriptors [they work only for 235 * sockets]. So we try to use first the fcntl() and we only use the 236 * ioctl() form, only if we don't have the fcntl() one. 237 * 238 * From: scott@craycos.com (Scott Bolte) 239 */ 240#ifndef WINNT_NATIVE 241# ifdef F_SETFD 242# define close_on_exec(fd, v) fcntl((fd), F_SETFD, v) 243# else /* !F_SETFD */ 244# ifdef FIOCLEX 245# define close_on_exec(fd, v) ioctl((fd), ((v) ? FIOCLEX : FIONCLEX), NULL) 246# else /* !FIOCLEX */ 247# define close_on_exec(fd, v) /* Nothing */ 248# endif /* FIOCLEX */ 249# endif /* F_SETFD */ 250#else /* WINNT_NATIVE */ 251# define close_on_exec(fd, v) nt_close_on_exec((fd),(v)) 252#endif /* !WINNT_NATIVE */ 253 254/* 255 * Stat 256 */ 257#ifdef ISC 258/* these are not defined for _POSIX_SOURCE under ISC 2.2 */ 259# ifndef S_IFMT 260# define S_IFMT 0170000 /* type of file */ 261# define S_IFDIR 0040000 /* directory */ 262# define S_IFCHR 0020000 /* character special */ 263# define S_IFBLK 0060000 /* block special */ 264# define S_IFREG 0100000 /* regular */ 265# define S_IFIFO 0010000 /* fifo */ 266# define S_IFNAM 0050000 /* special named file */ 267# ifndef ISC202 268# define S_IFLNK 0120000 /* symbolic link */ 269# endif /* ISC202 */ 270# endif /* S_IFMT */ 271#endif /* ISC */ 272 273#if defined(uts) || defined(UTekV) || defined(sysV88) 274/* 275 * The uts 2.1.2 macros (Amdahl) are busted! 276 * You should fix <sys/stat.h>, cause other programs will break too! 277 * 278 * From: creiman@ncsa.uiuc.edu (Charlie Reiman) 279 */ 280 281/* 282 * The same applies to Motorola MPC (System V/88 R32V2, UTekV 3.2e) 283 * workstations, the stat macros are broken. 284 * Kaveh Ghazi (ghazi@caip.rutgers.edu) 285 */ 286# undef S_ISDIR 287# undef S_ISCHR 288# undef S_ISBLK 289# undef S_ISREG 290# undef S_ISFIFO 291# undef S_ISNAM 292# undef S_ISLNK 293# undef S_ISSOCK 294#endif /* uts || UTekV || sysV88 */ 295 296#ifdef S_IFMT 297# if !defined(S_ISDIR) && defined(S_IFDIR) 298# define S_ISDIR(a) (((a) & S_IFMT) == S_IFDIR) 299# endif /* ! S_ISDIR && S_IFDIR */ 300# if !defined(S_ISCHR) && defined(S_IFCHR) 301# define S_ISCHR(a) (((a) & S_IFMT) == S_IFCHR) 302# endif /* ! S_ISCHR && S_IFCHR */ 303# if !defined(S_ISBLK) && defined(S_IFBLK) 304# define S_ISBLK(a) (((a) & S_IFMT) == S_IFBLK) 305# endif /* ! S_ISBLK && S_IFBLK */ 306# if !defined(S_ISREG) && defined(S_IFREG) 307# define S_ISREG(a) (((a) & S_IFMT) == S_IFREG) 308# endif /* ! S_ISREG && S_IFREG */ 309# if !defined(S_ISFIFO) && defined(S_IFIFO) 310# define S_ISFIFO(a) (((a) & S_IFMT) == S_IFIFO) 311# endif /* ! S_ISFIFO && S_IFIFO */ 312# if !defined(S_ISNAM) && defined(S_IFNAM) 313# define S_ISNAM(a) (((a) & S_IFMT) == S_IFNAM) 314# endif /* ! S_ISNAM && S_IFNAM */ 315# if !defined(S_ISLNK) && defined(S_IFLNK) 316# define S_ISLNK(a) (((a) & S_IFMT) == S_IFLNK) 317# endif /* ! S_ISLNK && S_IFLNK */ 318# if !defined(S_ISSOCK) && defined(S_IFSOCK) 319# define S_ISSOCK(a) (((a) & S_IFMT) == S_IFSOCK) 320# endif /* ! S_ISSOCK && S_IFSOCK */ 321#endif /* S_IFMT */ 322 323#ifdef tower32 324/* The header files lie; we really don't have symlinks */ 325# undef S_ISLNK 326# undef S_IFLNK 327#endif /* tower32 */ 328 329#ifndef S_IREAD 330# define S_IREAD 0000400 331#endif /* S_IREAD */ 332#ifndef S_IROTH 333# define S_IROTH (S_IREAD >> 6) 334#endif /* S_IROTH */ 335#ifndef S_IRGRP 336# define S_IRGRP (S_IREAD >> 3) 337#endif /* S_IRGRP */ 338#ifndef S_IRUSR 339# define S_IRUSR S_IREAD 340#endif /* S_IRUSR */ 341 342#ifndef S_IWRITE 343# define S_IWRITE 0000200 344#endif /* S_IWRITE */ 345#ifndef S_IWOTH 346# define S_IWOTH (S_IWRITE >> 6) 347#endif /* S_IWOTH */ 348#ifndef S_IWGRP 349# define S_IWGRP (S_IWRITE >> 3) 350#endif /* S_IWGRP */ 351#ifndef S_IWUSR 352# define S_IWUSR S_IWRITE 353#endif /* S_IWUSR */ 354 355#ifndef S_IEXEC 356# define S_IEXEC 0000100 357#endif /* S_IEXEC */ 358#ifndef S_IXOTH 359# define S_IXOTH (S_IEXEC >> 6) 360#endif /* S_IXOTH */ 361#ifndef S_IXGRP 362# define S_IXGRP (S_IEXEC >> 3) 363#endif /* S_IXGRP */ 364#ifndef S_IXUSR 365# define S_IXUSR S_IEXEC 366#endif /* S_IXUSR */ 367 368#ifndef S_ISUID 369# define S_ISUID 0004000 /* setuid */ 370#endif /* S_ISUID */ 371#ifndef S_ISGID 372# define S_ISGID 0002000 /* setgid */ 373#endif /* S_ISGID */ 374#ifndef S_ISVTX 375# define S_ISVTX 0001000 /* sticky */ 376#endif /* S_ISVTX */ 377#ifndef S_ENFMT 378# define S_ENFMT S_ISGID /* record locking enforcement flag */ 379#endif /* S_ENFMT */ 380 381/* the following macros are for POSIX conformance */ 382#ifndef S_IRWXU 383# define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR) 384#endif /* S_IRWXU */ 385#ifndef S_IRWXG 386# define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP) 387#endif /* S_IRWXG */ 388#ifndef S_IRWXO 389# define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH) 390#endif /* S_IRWXO */ 391 392/* 393 * Access() 394 */ 395#ifndef F_OK 396# define F_OK 0 397#endif /* F_OK */ 398#ifndef X_OK 399# define X_OK 1 400#endif /* X_OK */ 401#ifndef W_OK 402# define W_OK 2 403#endif /* W_OK */ 404#ifndef R_OK 405# define R_OK 4 406#endif /* R_OK */ 407 408/* 409 * Open() 410 */ 411#ifndef O_RDONLY 412# define O_RDONLY 0 413#endif /* O_RDONLY */ 414#ifndef O_WRONLY 415# define O_WRONLY 1 416#endif /* O_WRONLY */ 417#ifndef O_RDWR 418# define O_RDWR 2 419#endif /* O_RDWR */ 420 421/* 422 * Lseek() 423 */ 424#ifndef L_SET 425# ifdef SEEK_SET 426# define L_SET SEEK_SET 427# else /* !SEEK_SET */ 428# define L_SET 0 429# endif /* SEEK_SET */ 430#endif /* L_SET */ 431#ifndef L_INCR 432# ifdef SEEK_CUR 433# define L_INCR SEEK_CUR 434# else /* !SEEK_CUR */ 435# define L_INCR 1 436# endif /* SEEK_CUR */ 437#endif /* L_INCR */ 438#ifndef L_XTND 439# ifdef SEEK_END 440# define L_XTND SEEK_END 441# else /* !SEEK_END */ 442# define L_XTND 2 443# endif /* SEEK_END */ 444#endif /* L_XTND */ 445 446#ifdef _SEQUENT_ 447# define NEEDgethostname 448#endif /* _SEQUENT_ */ 449 450#if defined(BSD) && defined(POSIXJOBS) && !defined(BSD4_4) && !defined(__hp_osf) 451# define setpgid(pid, pgrp) setpgrp(pid, pgrp) 452#endif /* BSD && POSIXJOBS && && !BSD4_4 && !__hp_osf */ 453 454#if defined(BSDJOBS) && !(defined(POSIX) && defined(POSIXJOBS)) 455# if !defined(_AIX370) && !defined(_AIXPS2) 456# define setpgid(pid, pgrp) setpgrp(pid, pgrp) 457# endif /* !_AIX370 && !_AIXPS2 */ 458# define NEEDtcgetpgrp 459#endif /* BSDJOBS && !(POSIX && POSIXJOBS) */ 460 461#ifdef RENO 462/* 463 * RENO has this broken. It is fixed on 4.4BSD 464 */ 465# define NEEDtcgetpgrp 466#endif /* RENO */ 467 468#ifdef DGUX 469# define setpgrp(a, b) setpgrp2(a, b) 470# define getpgrp(a) getpgrp2(a) 471#endif /* DGUX */ 472 473#ifdef SXA 474# ifndef _BSDX_ 475/* 476 * Only needed in the system V environment. 477 */ 478# define setrlimit bsd_setrlimit 479# define getrlimit bsd_getrlimit 480# endif /* _BSDX_ */ 481#endif /* SXA */ 482 483#if defined(_MINIX) || defined(__EMX__) 484# define NEEDgethostname 485# define NEEDnice 486# define HAVENOLIMIT 487/* 488 * Minix does not have these, so... 489 */ 490# define getpgrp getpid 491#endif /* _MINIX || __EMX__ */ 492 493#ifdef __EMX__ 494/* XXX: How can we get the tty name in emx? */ 495# define ttyname(fd) (isatty(fd) ? "/dev/tty" : NULL) 496#endif /* __EMX__ */ 497 498#ifndef POSIX 499# define mygetpgrp() getpgrp(0) 500#else /* POSIX */ 501# if (defined(BSD) && !defined(BSD4_4)) || defined(SUNOS4) || defined(IRIS4D) || defined(DGUX) || defined(HPRT) 502# define mygetpgrp() getpgrp(0) 503# else /* !((BSD && !BSD4_4) || SUNOS4 || IRIS4D || DGUX || HPRT) */ 504# define mygetpgrp() getpgrp() 505# endif /* (BSD && BSD4_4) || SUNOS4 || IRISD || DGUX || HPRT */ 506#endif /* POSIX */ 507 508 509#if !defined(SOLARIS2) && !defined(sinix) && !defined(BSD4_4) && !defined(WINNT_NATIVE) 510# if (SYSVREL > 0 && !defined(OREO) && !defined(sgi) && !defined(linux) && !defined(sinix) && !defined(_AIX) &&!defined(_UWIN)) || defined(NeXT) 511# define NEEDgetcwd 512# endif /* (SYSVREL > 0 && !OREO && !sgi && !linux && !sinix && !_AIX && !_UWIN) || NeXT */ 513#endif 514 515#ifndef S_IFLNK 516# define lstat stat 517#endif /* S_IFLNK */ 518 519 520#if defined(BSDTIMES) && !defined(_SEQUENT_) 521typedef struct timeval timeval_t; 522#endif /* BSDTIMES && ! _SEQUENT_ */ 523 524#ifdef NeXT 525/* 526 * From Tony_Mason@transarc.com, override NeXT's malloc stuff. 527 */ 528# define malloc tcsh_malloc 529# define calloc tcsh_calloc 530# define realloc tcsh_realloc 531# define free tcsh_free 532#endif /* NeXT */ 533 534#if !defined(BSD4_4) && !defined(__linux__) && !defined(__hpux) && \ 535 !defined(sgi) && !defined(_AIX) && !defined(__CYGWIN__) 536#ifndef NEEDgethostname 537extern int gethostname __P((char *, int)); 538#endif /* NEEDgethostname */ 539#endif /* !BDS4_4 && !__linux__ && !__hpux && !sgi */ 540 541#if !defined(POSIX) || defined(SUNOS4) || defined(UTekV) || defined(sysV88) 542extern time_t time(); 543extern char *getenv(); 544extern int atoi(); 545# ifndef __EMX__ 546extern char *ttyname(); 547# endif /* __EMX__ */ 548 549# if defined(SUNOS4) 550# ifndef toupper 551extern int toupper __P((int)); 552# endif /* toupper */ 553# ifndef tolower 554extern int tolower __P((int)); 555# endif /* tolower */ 556extern caddr_t sbrk __P((int)); 557# if SYSVREL == 0 && !defined(__lucid) 558extern int qsort(); 559# endif /* SYSVREL == 0 && !__lucid */ 560# else /* !SUNOS4 */ 561# ifndef WINNT_NATIVE 562# ifndef hpux 563# if __GNUC__ != 2 564extern int abort(); 565# endif /* __GNUC__ != 2 */ 566# ifndef fps500 567extern int qsort(); 568# endif /* !fps500 */ 569# else /* !hpux */ 570extern void abort(); 571extern void qsort(); 572# endif /* hpux */ 573# endif /* !WINNT_NATIVE */ 574# endif /* SUNOS4 */ 575#ifndef _CX_UX 576extern void perror(); 577#endif 578 579# ifdef BSDSIGS 580# if defined(_AIX370) || defined(MACH) || defined(NeXT) || defined(_AIXPS2) || defined(ardent) || defined(SUNOS4) || defined(HPBSD) || defined(__MACHTEN__) 581extern int sigvec(); 582extern int sigpause(); 583# else /* !(_AIX370 || MACH || NeXT || _AIXPS2 || ardent || SUNOS4 || HPBSD) */ 584# if (!defined(apollo) || !defined(__STDC__)) && !defined(__DGUX__) && !defined(fps500) 585extern sigret_t sigvec(); 586#ifndef _CX_UX 587extern void sigpause(); 588#endif /* _CX_UX */ 589# endif /* (!apollo || !__STDC__) && !__DGUX__ && !fps500 */ 590# endif /* _AIX370 || MACH || NeXT || _AIXPS2 || ardent || SUNOS4 || HPBSD */ 591extern sigmask_t sigblock(); 592extern sigmask_t sigsetmask(); 593# endif /* BSDSIGS */ 594 595# ifndef killpg 596extern int killpg(); 597# endif /* killpg */ 598 599# ifndef lstat 600extern int lstat(); 601# endif /* lstat */ 602 603# ifdef BSD 604extern uid_t getuid(), geteuid(); 605extern gid_t getgid(), getegid(); 606# endif /* BSD */ 607 608# ifdef SYSMALLOC 609extern memalign_t malloc(); 610extern memalign_t realloc(); 611extern memalign_t calloc(); 612extern void free(); 613# endif /* SYSMALLOC */ 614 615# ifdef BSDTIMES 616extern int getrlimit(); 617extern int setrlimit(); 618extern int getrusage(); 619extern int gettimeofday(); 620# endif /* BSDTIMES */ 621 622# if defined(NLS) && !defined(NOSTRCOLL) && !defined(NeXT) 623extern int strcoll(); 624# endif /* NLS && !NOSTRCOLL && !NeXT */ 625 626# ifdef BSDJOBS 627# ifdef BSDTIMES 628# ifdef __MACHTEN__ 629extern pid_t wait3(); 630# else 631# ifndef HPBSD 632extern int wait3(); 633# endif /* HPBSD */ 634# endif /* __MACHTEN__ */ 635# else /* !BSDTIMES */ 636# if !defined(POSIXJOBS) && !defined(_SEQUENT_) 637extern int wait3(); 638# else /* POSIXJOBS || _SEQUENT_ */ 639extern int waitpid(); 640# endif /* POSIXJOBS || _SEQUENT_ */ 641# endif /* BSDTIMES */ 642# else /* !BSDJOBS */ 643# if SYSVREL < 3 644extern int ourwait(); 645# else /* SYSVREL >= 3 */ 646extern int wait(); 647# endif /* SYSVREL < 3 */ 648# endif /* BSDJOBS */ 649 650# ifdef BSDNICE 651extern int setpriority(); 652# else /* !BSDNICE */ 653extern int nice(); 654# endif /* BSDNICE */ 655 656# if (!defined(fps500) && !defined(apollo) && !defined(__lucid) && !defined(HPBSD) && !defined(DECOSF1)) 657extern void setpwent(); 658extern void endpwent(); 659# endif /* !fps500 && !apollo && !__lucid && !HPBSD && !DECOSF1 */ 660 661# ifndef __STDC__ 662extern struct passwd *getpwuid(), *getpwnam(), *getpwent(); 663# ifdef PW_SHADOW 664extern struct spwd *getspnam(), *getspent(); 665# endif /* PW_SHADOW */ 666# ifdef PW_AUTH 667extern struct authorization *getauthuid(); 668# endif /* PW_AUTH */ 669# endif /* __STDC__ */ 670 671# ifndef getcwd 672extern char *getcwd(); 673# endif /* getcwd */ 674 675#else /* POSIX || !SUNOS4 || !UTekV || !sysV88 */ 676 677# if (defined(SUNOS4) && !defined(__GNUC__)) || defined(_IBMR2) || defined(_IBMESA) 678extern char *getvwd(); 679# endif /* (SUNOS4 && ! __GNUC__) || _IBMR2 || _IBMESA */ 680 681# ifdef SCO 682extern char *ttyname(); 683# endif /* SCO */ 684 685# ifdef __clipper__ 686extern char *ttyname(); 687# endif /* __clipper__ */ 688 689#endif /* !POSIX || SUNOS4 || UTekV || sysV88 */ 690 691#if defined(SUNOS4) && __GNUC__ == 2 692/* 693 * Somehow these are missing 694 */ 695extern int ioctl __P((int, int, ...)); 696extern int readlink __P((const char *, char *, size_t)); 697extern void setgrent __P((void)); 698extern void endgrent __P((void)); 699# ifdef REMOTEHOST 700# ifndef _SOCKLEN_T /* Avoid Solaris 2.7 bogosity. */ 701struct sockaddr; 702extern int getpeername __P((int, struct sockaddr *, int *)); 703# endif /* _SOCKLEN_T */ 704# endif /* REMOTEHOST */ 705#endif /* SUNOS4 && __GNUC__ == 2 */ 706 707#if (defined(BSD) && !defined(BSD4_4)) || defined(SUNOS4) 708# if defined(__alpha) && defined(__osf__) && DECOSF1 < 200 709extern void bcopy __P((const void *, void *, size_t)); 710# define memmove(a, b, c) (bcopy((char *) (b), (char *) (a), (int) (c)), a) 711# endif /* __alpha && __osf__ && DECOSF1 < 200 */ 712#endif /* (BSD && !BSD4_4) || SUNOS4 */ 713 714#if !defined(hpux) && !defined(COHERENT) && ((SYSVREL < 4) || defined(_SEQUENT_)) && !defined(BSD4_4) && !defined(memmove) 715# define NEEDmemmove 716#endif /* !hpux && !COHERENT && (SYSVREL < 4 || _SEQUENT_) && !BSD4_4 && !memmove */ 717 718#if defined(UTek) || defined(pyr) 719# define NEEDmemset 720#else /* !UTek && !pyr */ 721# ifdef SUNOS4 722# include <memory.h> /* memset should be declared in <string.h> but isn't */ 723# endif /* SUNOS4 */ 724#endif /* UTek || pyr */ 725 726#if SYSVREL == 4 727# ifdef REMOTEHOST 728/* Irix6 defines getpeername(int, void *, int *) which conflicts with 729 the definition below. */ 730# if !defined(__sgi) && !defined(_OSD_POSIX) && !defined(__MVS__) 731# ifndef _SOCKLEN_T /* Avoid Solaris 2.7 bogosity. */ 732struct sockaddr; 733extern int getpeername __P((int, struct sockaddr *, int *)); 734# endif /* _SOCKLEN_T */ 735# endif /* !__sgi && !_OSD_POSIX && !__MVS__ */ 736# endif /* REMOTEHOST */ 737# ifndef BSDTIMES 738extern int getrlimit __P((int, struct rlimit *)); 739extern int setrlimit __P((int, const struct rlimit *)); 740# endif /* !BSDTIMES */ 741# if !defined(IRIS4D) && !defined(SOLARIS2) 742extern int wait3(); /* I think some bizarre systems still need this */ 743# endif /* !IRIS4D && !SOLARIS2 */ 744# if defined(SOLARIS2) 745# undef NEEDstrerror 746extern char *strerror __P((int)); 747# endif /* SOLARIS2 */ 748#endif /* SYSVREL == 4 */ 749 750#if defined(__alpha) && defined(__osf__) && DECOSF1 < 200 751/* These are ok for 1.3, but conflict with the header files for 2.0 */ 752extern int gethostname __P((char *, int)); 753extern char *sbrk __P((ssize_t)); 754extern int ioctl __P((int, unsigned long, char *)); 755extern pid_t vfork __P((void)); 756extern int killpg __P((pid_t, int)); 757#endif /* __osf__ && __alpha && DECOSF1 < 200 */ 758 759#endif /* _h_tc_os */ 760