home *** CD-ROM | disk | FTP | other *** search
/ Super Net 1 / SUPERNET_1.iso / PC / OTROS / EXTRAS / UUCODE / UUPC / TEST / UPC12ES4.ZIP / UUTRAF / libc.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-10-07  |  7.1 KB  |  273 lines

  1. /*
  2.  *    libc.h - support for some older libc's
  3.  */
  4.  
  5. #define SID_H    "@(#)head:libc.h    1.5    92/10/09 23:40:41 (woods)"
  6. #define SID_NM    libc_sccsid
  7. #include <sccsid.h>
  8.  
  9. /*
  10.  * DESCRIPTION:  This file defines several things that are expected to be a
  11.  * part of the compile-time environment for a normal UNIX program.  In
  12.  * particular, this header attempts to bend a non-POSIX (1003.1) environment
  13.  * into some semblance of conformance.  By no means am I advocating complete
  14.  * compliance of POSIX is a good thing -- rather it is a necessary evil!
  15.  */
  16. /*
  17.  * USAGE:  If your system is POSIX compliant, this header assumes that
  18.  * _POSIX_SOURCE will be defined.
  19.  */
  20. /*
  21.  * NOTE:  This file must always included *AFTER* <stdio.h>, <unistd.h>,
  22.  * <sys/stat.h>, and/or <limits.h>, if you're using either, and in fact you
  23.  * might want to include it after *all* other includes.
  24.  */
  25. /*
  26.  * ALSO NOTE: This file should probably be preceded by "sysdefs.h"
  27.  */
  28. /*
  29.  * HISTORY:  This header is modeled after one of the same name found in the C
  30.  * News sources written at the University of Toronto by Geoff Collyer and
  31.  * Henry Spencer.  Greg A. Woods <woods@robohack.UUCP> has adapted it to be
  32.  * more complete and useful as a stand-alone header.  Some of the following
  33.  * bits have been derived from headers in many other tools, including Jove.
  34.  */
  35.  
  36. #ifndef NULL
  37. # define NULL    0
  38. #endif
  39. #ifndef    EOF
  40. # define EOF    (-1)
  41. #endif
  42. #ifndef EOS
  43. # define EOS    '\0'
  44. #endif
  45.  
  46. /*
  47.  * Yes, it's ugly to define the following things in here, but the alternative
  48.  * is to have several copies of each clause spread around many files.
  49.  */
  50.  
  51. /*
  52.  * this _should_ be in <limits.h>, but SYSVR2 & BSD don't have one
  53.  */
  54. #ifndef PATH_MAX
  55. # ifdef MAXPATHLEN
  56. #  define PATH_MAX    MAXPATHLEN
  57. # else
  58. #  define PATH_MAX    1024
  59. # endif
  60. #endif
  61. #ifndef NAME_MAX
  62. # ifdef MAXNAMELEN
  63. #  define NAME_MAX    MAXNAMELEN
  64. # else
  65. #  define NAME_MAX    14
  66. # endif
  67. #endif
  68.  
  69. /*
  70.  * Symbolic constants for the "lseek" routine (should be in <unistd.h>).
  71.  * Don't bother with the old BSD "L*" things.
  72.  */
  73. #ifndef SEEK_SET
  74. # define SEEK_SET    0    /* Set file pointer to "offset" */
  75. # define SEEK_CUR    1    /* Set file pointer to current plus "offset" */
  76. # define SEEK_END    2    /* Set file pointer to EOF plus "offset" */
  77. #endif
  78.  
  79. /*
  80.  * these _should_ be in <sys/stat.h>!
  81.  */
  82. #ifndef S_IRWXU
  83. # define S_IRWXU    00700        /* read, write, execute: owner */
  84. # define S_IRWXG    00070        /* read, write, execute: group */
  85. # define S_IRWXO    00007        /* read, write, execute: other */
  86. #endif
  87. #ifndef S_IRUSR
  88. # define S_IRUSR    00400        /* read permission: owner */
  89. # define S_IWUSR    00200        /* write permission: owner */
  90. # define S_IXUSR    00100        /* execute permission: owner */
  91. # define S_IRGRP    00040        /* read permission: group */
  92. # define S_IWGRP    00020        /* write permission: group */
  93. # define S_IROTH    00004        /* read permission: other */
  94. # define S_IWOTH    00002        /* write permission: other */
  95. # define S_IXOTH    00001        /* execute permission: other */
  96. #endif
  97.  
  98. /*
  99.  * signal types: tailor to suit local needs (usually 'VOID' is OK, as it will
  100.  * be either 'void' or 'int', and most systems that support 'void' will have
  101.  * "void (*signal)();", and 'VOID' will be 'int' otherwise.)
  102.  */
  103. typedef VOID (*sigret_t)();
  104. typedef VOID (*sigarg_t)();
  105.  
  106. /*
  107.  * The SCO UNIX, Solaris 2.0, and probably others have getopt(3c)'s that are not
  108.  * POSIX compliant.  These should be in <unistd.h>!
  109.  */
  110. #if !defined(NO_GETOPT)        /* might force in getopt(3c) */
  111. extern int        optind;
  112. extern char        *optarg;
  113. #endif
  114.  
  115. #if !REALSTDC && \
  116.     !defined(_POSIX_SOURCE) && !defined(XOPEN_SOURCE)
  117.  
  118. /*
  119.  * these _should_ be in other system header files....  <stdio.h>, <stdlib.h>,
  120.  * <unistd.h>, etc.
  121.  *
  122.  * NOTE:  There are some in here you may not have.
  123.  *
  124.  * WARNING:  These are the "standard" declarations, and some "broken" systems
  125.  * may define things a bit differently.  Hopefully a re-declaration clash
  126.  * will make this obvious!
  127.  */
  128.  
  129. extern int        errno;        /* always(?) in <errno.h> */
  130.  
  131. #ifndef UUPC
  132. extern SPRINTF_T    sprintf();
  133. #endif
  134.  
  135. extern sigret_t        signal();
  136.  
  137. extern void        exit();
  138. extern void        _exit();
  139.  
  140. extern void        abort();
  141. extern void        _assert();
  142. extern void        longjmp();
  143.  
  144. extern char        *crypt();
  145. extern void        setkey();
  146. extern void        encrypt();
  147.  
  148. extern void        monitor();
  149. extern void        profil();
  150.  
  151. #ifndef M_UNIX    /* on SCO, it's a macro! */
  152. extern char        *strerror();
  153. #endif /* M_UNIX */
  154.  
  155. extern unsigned int    sleep();
  156.  
  157. #ifndef UUPC
  158. extern time_t        time();
  159. extern struct tm    *gmtime();
  160. extern char        *ctime();
  161. #endif
  162.  
  163. extern struct passwd    *getpwent();
  164. extern struct passwd    *getpwuid();
  165. extern struct passwd    *getpwnam();
  166. extern void        setpwent();
  167. extern void        endpwent();
  168. extern struct passwd    *fgetpwent();
  169.  
  170. extern struct group    *getgrent();
  171. extern struct group    *getgrgid();
  172. extern struct group    *getgrnam();
  173. extern void        setgrent();
  174. extern void        endgrent();
  175. extern struct group    *fgetgrent();
  176.  
  177. #ifndef UUPC
  178. extern uid_t        getuid();
  179. extern uid_t        geteuid();
  180. extern gid_t        getgid();
  181. extern gid_t        getegid();
  182. #endif
  183.  
  184. extern FILE        *fopen();
  185. extern FILE        *freopen();
  186. extern FILE        *popen();
  187. extern FILE        *tmpfile();
  188. extern char        *mktemp();
  189. extern char        *tempnam();
  190. extern char        *fgets();
  191. extern char        *gets();
  192. extern long        ftell();
  193. extern void        setbuf();
  194. #if 0
  195. extern void        clearerr();    /* a macro in most <stdio.h>! */
  196. #endif
  197. extern void        rewind();
  198. extern void        perror();
  199.  
  200. extern char        *getenv();
  201. extern char        *cuserid();
  202.  
  203. #ifndef UUPC
  204. #ifndef M_UNIX    /* SCO's compiler (i.e. Microsoft's) barfs on some of these */
  205. extern char        *strcpy();
  206. extern char        *strncpy();
  207. extern char        *strcat();
  208. extern char        *strncat();
  209. extern char        *strchr();
  210. extern char        *strrchr();
  211. extern char        *strpbrk();
  212. extern char        *strtok();
  213. extern char        *strdup();
  214. extern char        *strstr();
  215. #endif /* M_UNIX */
  216. extern int        strcmp();
  217. extern int        strncmp();
  218. extern int        strlen();
  219. extern int        strspn();
  220. extern int        strcspn();
  221.  
  222. #ifndef M_UNIX    /* more SCO inconsitency */
  223. extern UnivPtr        memccpy();
  224. extern UnivPtr        memchr();
  225. extern UnivPtr        memcpy();
  226. extern UnivPtr        memmove();
  227. extern UnivPtr        memset();
  228. #endif /* M_UNIX */
  229. extern int        memcmp();
  230. #endif
  231.  
  232. extern UnivPtr        bsearch();
  233. extern void        qsort();
  234. extern void        twalk();
  235.  
  236. extern void        srand();
  237.  
  238. extern void        swab();
  239.  
  240. #ifndef UUPC
  241. #ifndef USE_MALLOC
  242. extern void        free();
  243. extern UnivPtr        calloc();
  244. extern UnivPtr        malloc();
  245. extern UnivPtr        realloc();
  246. #endif /* USE_MALLOC */
  247. #endif
  248.  
  249. extern double        atof();
  250. extern long        atol();
  251. extern long        labs();
  252.  
  253. extern double        strtod();
  254. extern long        strtol();
  255. # if 0
  256. extern unsigned long    strtoul();    /* 'unsigned long' not portable */
  257. # endif
  258.  
  259. #endif
  260.  
  261. /*
  262.  * The following prototypes are esp. useful since they are stdargs-like.
  263.  * If they clash, please let me know!
  264.  */
  265. #if !REALSTDC && defined(USE_PROTOTYPES)
  266. extern int    printf(const char *fmt, ...);
  267. extern int    fprintf(FILE *fp, const char *fmt, ...);
  268. extern int    sprintf(char *buf, const char *fmt, ...);
  269. extern int    scanf(const char *fmt, ...);
  270. extern int    fscanf(FILE *fp, const char *fmt, ...);
  271. extern int    sscanf(char *s, const char *fmt, ...);
  272. #endif
  273.