home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / famapi.zip / INCLUDE.ZIP / UNISTD.H < prev    next >
C/C++ Source or Header  |  1992-12-19  |  6KB  |  167 lines

  1. //
  2. //      **************************************************************
  3. //       JdeBP C++ Library Routines      General Public Licence v1.00
  4. //          Copyright (c) 1991,1992  Jonathan de Boyne Pollard
  5. //      **************************************************************
  6. //
  7. //  STANDARD SYSTEM CALL INTERFACE (POSIX)
  8. //
  9.  
  10. #if !defined(___STDDEF_H_INCLUDED)
  11. #include <_stddef.h>
  12. #endif
  13.  
  14. #if !defined(__UNISTD_H_INCLUDED)
  15.  
  16. #define _POSIX_VERSION  199009L /* We conform to revised standard if we can */
  17.  
  18. #undef  _POSIX_JOB_CONTROL      /* On a single-tasking OS?  You jest. */
  19. #undef  _POSIX_SAVED_IDS        /* Not even under Netware */
  20. #define _POSIX_CHOWN_RESTRICTED -1  /* Always restricted */
  21. #undef  _POSIX_NO_TRUNC         /* Yes on Netware, no on MS-DOS */
  22. #define _POSIX_VDISABLE -1      /* No tty driver on MS-DOS */
  23.  
  24. #define _SC_ARG_MAX     1
  25. #define _SC_CHILD_MAX   2
  26. #define _SC_CLK_TCK     3
  27. #define _SC_NGROUPS_MAX 4
  28. #define _SC_OPEN_MAX    5
  29. #define _SC_JOB_CONTROL 6
  30. #define _SC_SAVED_IDS   7
  31. #define _SC_VERSION     8
  32. #define _PC_LINK_MAX    9
  33. #define _PC_MAX_CANON   10
  34. #define _PC_MAX_INPUT   11
  35. #define _PC_NAME_MAX    12
  36. #define _PC_PATH_MAX    13
  37. #define _PC_PIPE_BUF    14
  38. #define _PC_CHOWN_RESTRICTED    15
  39. #define _PC_NO_TRUNC    16
  40. #define _PC_VDISABLE    17
  41.  
  42. #define STDIN_FILENO    0
  43. #define STDOUT_FILENO   1
  44. #define STDERR_FILENO   2
  45.  
  46. #if _MSDOS_SOURCE > 0
  47. #define STDAUX_FILENO   3
  48. #define STDPRN_FILENO   4
  49. #endif
  50.  
  51. #if _MSDOS_SOURCE > 0
  52. #define P_WAIT      0
  53. #define P_NOWAIT    1
  54. #define P_OVERLAY   2
  55. #endif
  56.  
  57. extern "C" {
  58.  
  59. // NOTE.  The original POSIX.1 draft uses int and unsigned int instead of
  60. // ssize_t and size_t in some calls.  Because Borland C++ uses strong typing,
  61. // we stick to the second draft declaration rather than mucking about with
  62. // #if's.
  63.  
  64. void    _CDECL  _exit       (int);
  65.  
  66. int     _CDECL  access      (const char *, int);
  67. unsigned int    _CDECL  alarm   (unsigned int);
  68. int     _CDECL  chdir       (const char *);
  69. int     _CDECL  chown       (const char *, _Gid_t, _Gid_t);
  70. int     _CDECL  close       (int);
  71. char *  _CDECL  ctermid     (char *);
  72. int     _CDECL  dup         (int);
  73. int     _CDECL  dup2        (int, int);
  74. int     _CDECL  execl       (const char *, const char *, ...);
  75. int     _CDECL  execle      (const char *, const char *, ...);
  76. int     _CDECL  execlp      (const char *, const char *, ...);
  77. int     _CDECL  execlpe     (const char *, const char *, ...);
  78. int     _CDECL  execv       (const char *, const char * const *);
  79. int     _CDECL  execve      (const char *, const char * const *, const char * const *);
  80. int     _CDECL  execvp      (const char *, const char * const *);
  81. int     _CDECL  execvpe     (const char *, const char * const *, const char * const *);
  82. _Pid_t  _CDECL  fork        (void);
  83. long    _CDECL  fpathconf   (int, int);
  84. char *  _CDECL  getcwd      (char *, _Size_t);
  85. _Gid_t  _CDECL  getegid     (void);
  86. _Uid_t  _CDECL  geteuid     (void);
  87. _Gid_t  _CDECL  getgid      (void);
  88. int     _CDECL  getgroups   (int, _Gid_t *);
  89. char *  _CDECL  getlogin    (void);
  90. _Pid_t  _CDECL  getpgrp     (void);
  91. _Pid_t  _CDECL  getpid      (void);
  92. _Pid_t  _CDECL  getppid     (void);
  93. _Uid_t  _CDECL  getuid      (void);
  94. int     _CDECL  isatty      (int);
  95. int     _CDECL  link        (const char *, const char *);
  96. _Off_t  _CDECL  lseek       (int, _Off_t, int);
  97. long    _CDECL  pathconf    (const char *, int);
  98. // pause
  99. int     _CDECL  pipe        (int [2]);
  100. _Ssize_t _CDECL read        (int, void *, _Size_t);
  101. int     _CDECL  rmdir       (const char *);
  102. int     _CDECL  setgid      (_Gid_t) ;              // POSIX.1 ?
  103. int     _CDECL  setpgid     (_Pid_t, _Pid_t) ;      // POSIX.1 ?
  104. _Pid_t  _CDECL  setsid      (void);
  105. int     _CDECL  seteuid     (_Uid_t);
  106. int     _CDECL  setegid     (_Uid_t);               // POSIX.1 ?
  107. unsigned int    _CDECL  sleep   (unsigned int);
  108. long    _CDECL  sysconf     (int);
  109. char *  _CDECL  ttyname     (int fd);
  110. int     _CDECL  unlink      (const char *);
  111. _Ssize_t _CDECL write       (int, const void *, _Size_t);
  112.  
  113. // This was in the original POSIX.1 standard, but removed in the 1990
  114. // revision.  There is no feature test macro for the 1990 revision.
  115. #if _POSIX1_SOURCE == 1
  116. char *  _CDECL  cuserid     (char *);
  117. #endif
  118.  
  119. // These are only tentatively declared here, pending the second draft of
  120. // POSIX.1 standard.
  121. #if _POSIX1_SOURCE > 1
  122. int     _CDECL  fchown      (int, _Uid_t, _Gid_t);
  123. int     _CDECL  ftruncate   (int, _Off_t);
  124. #endif
  125.  
  126. #if _POSIX2_SOURCE > 0
  127. int     _CDECL  fnmatch     (const char *, const char *, int);
  128. int     _CDECL  getopt      (int, const char *[], const char *);
  129. #endif
  130.  
  131. #if _MSDOS_SOURCE > 0
  132. int     _CDECL  chsize      (int, _Off_t);
  133. int     _CDECL  eof         (int);
  134. _Off_t  _CDECL  filelength  (int);
  135. int     _CDECL  locking     (int, int, _Off_t);
  136. char *  _CDECL  mktemp      (char *);
  137. int     _CDECL  setmode     (int, _Mode_t);
  138. _Off_t  _CDECL  tell        (int);
  139.  
  140. int     _CDECL  spawnl      (int, const char *, const char *, ...);
  141. int     _CDECL  spawnle     (int, const char *, const char *, ...);
  142. int     _CDECL  spawnlp     (int, const char *, const char *, ...);
  143. int     _CDECL  spawnlpe    (int, const char *, const char *, ...);
  144. int     _CDECL  spawnv      (int, const char *, const char * const *);
  145. int     _CDECL  spawnve     (int, const char *, const char * const *, const char * const *);
  146. int     _CDECL  spawnvp     (int, const char *, const char * const *);
  147. int     _CDECL  spawnvpe    (int, const char *, const char * const *, const char * const *);
  148. #endif
  149.  
  150. #if _POSIX2_SOURCE > 0
  151. extern  _CDECL  char *  optarg;
  152. extern  _CDECL  int     optind, opterr, optopt;
  153. #endif
  154.  
  155. long    _CDECL  _pathconf   (int);
  156.  
  157. }
  158.  
  159. #define ttyname(fd)     _NULL       /* Can't use NULL in this header */
  160.  
  161. #if _MSDOS_SOURCE > 0 && _POSIX1_SOURCE > 1
  162. #define chsize(fd,sz)   ftruncate(fd,sz)
  163. #endif
  164.  
  165. #define __UNISTD_H_INCLUDED
  166. #endif
  167.