This is p-unistd.h in view mode; [Download] [Up]
/*+++*
* RCS $Id: p-unistd.h,v 1.5 1993/02/02 21:00:42 gerben Exp gerben $
* title: p-unistd.h
* abstract: portable Posix-compliant <unistd.h>.
* author: T.R.Hageman, Groningen, The Netherlands
* created: September 1992
* modified: (see RCS Log at end)
* copyleft:
*
* Copyright (C) 1992 Tom R. Hageman.
*
* This is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* description:
*
* This is a Posix-compatible version of <unistd.h> for both Posix
* and non-Posix systems.
*
* Notes:
* o In order for this to work correctly, you should define
* __POSIX__ or _I_UNISTD to 1 if your system has <unistd.h>,
* or, alternatively, define HAVE_UNISTD_H (Autoconfig compatibility).
*
* o The presence of a prototype here does not guarantee the existence
* of the corresponding function in the library.
*---*/
#ifndef _P_UNISTD_H_
#define _P_UNISTD_H_ 0x103
#ifndef _PORTDEFS_H_
# include "portdefs.h"
#endif
#if __STRICT_ANSI__
#error "You shouldn't use this header in strict ANSI C code"
#endif
#if _I_UNISTD && 0 /* already automagically #included by "portansi.h" */
# include <unistd.h>
#endif
#ifndef _P_TYPES_H_
# include "p-types.h"
#endif
#if !__POSIX__
#if _I_FCNTL /* Some UNIX systems define R_OK etc. in <fcntl.h> */
# ifndef _FCNTL_H_
# include <fcntl.h>
# define _FCNTL_H_
# endif
#endif
#ifndef R_OK /* Values used by access(). [Posix table 2-6.] */
# define R_OK 4
# define W_OK 2
# define X_OK 1
# define F_OK 0
#endif
#ifndef SEEK_SET /* Values used by lseek(). [Posix table 2-7.] */
# define SEEK_SET 0
# define SEEK_CUR 1
# define SEEK_END 2
#endif
#ifndef STDIN_FILENO
# define STDIN_FILENO 0
# define STDOUT_FILENO 1
# define STDERR_FILENO 2
#endif
#endif /* !__POSIX__ */
#if !_I_UNISTD
#if !__NO_PROTO__
#if !__NO_TRIV_PROTO__
extern
# if (__GNUC__ && !(2*__STRICT_ANSI__-1==2*0-1) && !(2*__STRICT_BSD__-1==2*0-1))
__volatile
# endif
void _exit __(( int _(status) ));
extern int access __(( const char *_(path), int _(mode) ));
extern unsigned alarm __(( unsigned _(seconds) ));
extern int chdir __(( const char *_(path) ));
extern int chown __(( const char *_(path), uid_t _(uid), gid_t _(gid) ));
extern int close __(( int _(fildes) ));
#endif /* !__NO_TRIV_PROTO__ */
extern char * ctermid __(( char *_(buf) ));
extern char * cuserid __(( char *_(buf) )); /* (obsolescent) */
#if !__NO_TRIV_PROTO__
extern int dup __(( int _(fildes) ));
#ifndef dup2
extern int dup2 __(( int _(src_fd), int _(dest_fd) ));
#endif
extern int execl __(( const char *_(path), const char *_(arg0) ___ ));
extern int execle __(( const char *_(path), const char *_(arg0) ___ ));
extern int execlp __(( const char *_(path), const char *_(arg0) ___ ));
extern int execv __(( const char *_(path), char * const _(argv)[] ));
extern int execve __(( const char *_(path), char * const _(argv)[],
char * const *_(envp) ));
extern int execvp __(( const char *_(path), char * const _(argv)[] ));
extern pid_t fork __(( void ));
#endif /* !__NO_TRIV_PROTO__ */
extern char * getcwd __(( char *_(buf), size_t _(size) ));
#if !__NO_TRIV_PROTO__
extern gid_t getegid __(( void ));
extern uid_t geteuid __(( void ));
#ifndef getgid
extern gid_t getgid __(( void ));
#endif
extern int getgroups __(( int _(gidsetsize), gid_t *_(grouplist) ));
#endif /* !__NO_TRIV_PROTO__ */
extern char * getlogin __(( void ));
#if !__NO_TRIV_PROTO__
#if 0
extern int getpgrp __(( void ));
#endif /* this is too system-dependent. */
#ifndef getpid
extern pid_t getpid __(( void ));
#endif
extern pid_t getppid __(( void ));
#ifndef getuid
extern gid_t getuid __(( void ));
#endif
extern int isatty __(( int _(fildes) ));
extern int link __(( const char *_(orgpath), const char *_(newpath) ));
extern off_t lseek __(( int _(fildes), off_t _(offset), int _(how) ));
extern int pause __(( void ));
extern int pipe __(( int _(fildes)[2] ));
extern ssize_t read __(( int _(fildes), void_*_(buf), size_t _(size) ));
extern int rmdir __(( const char *_(path) ));
extern int setgid __(( gid_t _(gid) ));
extern int setpgid __(( pid_t _(pid), pid_t _(pgid) )); /* (Posix) */
extern pid_t setsid __(( void )); /* (Posix) */
extern int setuid __(( uid_t _(uid) ));
extern unsigned sleep __(( unsigned _(seconds) ));
#endif /* !__NO_TRIV_PROTO__ */
extern char * ttyname __(( int _(fildes) ));
#if !__NO_TRIV_PROTO__
extern int unlink __(( const char *_(path) ));
extern ssize_t write __(( int _(fildes), const void_*_(buf), size_t _(size) ));
#endif
#endif /* !__NO_PROTO__ */
#endif /* !_I_UNISTD */
#ifdef _POSIX2_SOURCE /* Posix.2 utilities. */
#if !__NO_PROTO__ && !__NO_TRIV_PROTO__
extern int fnmatch __(( const char *_(pattern), const char *_(string),
int _(flags) ));
extern int getopt __(( int _(argc), char *_(argv)[],
const char *_(optstring) ));
#endif
extern char * optarg;
extern int optind, opterr, optopt;
#endif /* _POSIX2_SOURCE */
#endif /* _P_UNISTD_H_ */
/*======================================================================*
* $Log: p-unistd.h,v $
* Revision 1.5 1993/02/02 21:00:42 gerben
* *** empty log message ***
*
* Revision 1.4 1992/12/22 00:16:00 tom
* add _P_<function>_RETURN_TYPE, _PI_LIBC_ kludges; change order of `volatile'
* and `extern' keywords.
*
* Revision 1.3 1992/10/23 04:11:15 tom
* add __STRICT_ANSI__ check; add __NO_TRIV_PROTO__; add _POSIX2_SOURCE
* conditional; use `void_*'.
*
* Revision 1.2 1992/10/21 19:40:23 tom
* some comment changes.
*
* Revision 1.1 1992/10/14 13:38:20 tom
* rename to "p-<header>".
*
* Revision 1.0 1992/10/08 23:22:24 tom
* Initial revision
*
*======================================================================*/
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.