home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 15 / 15.iso / s / s053 / 25.ddi / root.2 / usr / ucbinclude / stdio.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-12-08  |  7.7 KB  |  275 lines

  1. /*    Copyright (c) 1990 UNIX System Laboratories, Inc.    */
  2. /*    Copyright (c) 1984, 1986, 1987, 1988, 1989, 1990 AT&T    */
  3. /*      All Rights Reserved      */
  4.  
  5. /*    THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF         */
  6. /*    UNIX System Laboratories, Inc.                         */
  7. /*    The copyright notice above does not evidence any       */
  8. /*    actual or intended publication of such source code.    */
  9.  
  10.  
  11. /*******************************************************************
  12.  
  13.         PROPRIETARY NOTICE (Combined)
  14.  
  15. This source code is unpublished proprietary information
  16. constituting, or derived under license from AT&T's UNIX(r) System V.
  17. In addition, portions of such source code were derived from Berkeley
  18. 4.3 BSD under license from the Regents of the University of
  19. California.
  20.  
  21.  
  22.  
  23.         Copyright Notice 
  24.  
  25. Notice of copyright on this source code product does not indicate 
  26. publication.
  27.  
  28.     (c) 1986,1987,1988,1989  Sun Microsystems, Inc
  29.     (c) 1983,1984,1985,1986,1987,1988,1989  AT&T.
  30.               All rights reserved.
  31. ********************************************************************/ 
  32.  
  33. #ident    "@(#)//usr/ucbinclude/stdio.h.sl 1.1 4.0 12/08/90 14580 AT&T-USL"
  34.  
  35. /*
  36. * User-visible pieces of the ANSI C standard I/O package.
  37. */
  38. #ifndef _STDIO_H /* if not defined then stdio.h has not yet been included */
  39. #define _STDIO_H
  40.  
  41. #ifndef BSD
  42. #define BSD
  43. #endif
  44.  
  45.  
  46. #ifndef _SIZE_T
  47. #define _SIZE_T
  48. typedef unsigned int     size_t;
  49. #endif 
  50.  
  51. typedef long    fpos_t;
  52.  
  53. #ifndef NULL
  54. #define NULL            0
  55. #endif 
  56.  
  57. #if defined(__STDC__)
  58.  
  59. #if #machine(pdp11)
  60. #   define BUFSIZ        512
  61. #   define _STDIO_REVERSE
  62. #elif #machine(u370)
  63. #   define BUFSIZ        4096
  64. #   define _STDIO_REVERSE
  65. #   define _STDIO_ALLOCATE
  66. #else
  67. #   define BUFSIZ        1024
  68. #endif
  69.  
  70. #else    /* !defined(__STDC__) */
  71.  
  72. #if pdp11 || u370
  73.  
  74. #if pdp11
  75. #   define BUFSIZ        512
  76. #   define _STDIO_REVERSE
  77. #else     /* u370 */
  78. #   define BUFSIZ        4096
  79. #   define _STDIO_REVERSE
  80. #   define _STDIO_ALLOCATE
  81. #endif
  82.  
  83. #else
  84. #   define BUFSIZ        1024
  85. #endif
  86.  
  87. #endif    /* __STDC__ */
  88.  
  89. #ifdef i386
  90. #define _NFILE    60    /* initial number of streams */
  91. #else
  92. #define _NFILE    20    /* initial number of streams */
  93. #endif
  94. #define _SBFSIZ    8    /* compatibility with shared libs */
  95.  
  96. #define _IOFBF        0000    /* full buffered */
  97. #define _IOLBF        0100    /* line buffered */
  98. #define _IONBF        0004    /* not buffered */
  99. #define _IOEOF        0020    /* EOF reached on read */
  100. #define _IOERR        0040    /* I/O error from system */
  101.  
  102. #define _IOREAD        0001    /* currently reading */
  103. #define _IOWRT        0002    /* currently writing */
  104. #define _IORW        0200    /* opened for reading and writing */
  105. #define _IOMYBUF    0010    /* stdio malloc()'d buffer */
  106.  
  107. #ifndef EOF
  108. #   define EOF    (-1)
  109. #endif
  110.  
  111. #define FOPEN_MAX    _NFILE
  112. #define FILENAME_MAX    1024    /* max # of characters in a path name */
  113.  
  114. #define SEEK_SET    0
  115. #define SEEK_CUR    1
  116. #define SEEK_END    2
  117. #define TMP_MAX        17576    /* 26 * 26 * 26 */
  118.  
  119. #if __STDC__ - 0 == 0 || defined(_POSIX_SOURCE) || defined(_XOPEN_SOURCE)
  120. #define L_ctermid    9
  121. #define L_cuserid    9
  122. #define P_tmpdir    "/var/tmp/"
  123. #endif
  124.  
  125. #define L_tmpnam    25    /* (sizeof(P_tmpdir) + 15) */
  126.  
  127. #if defined(__STDC__)
  128. #define stdin    (&__iob[0])
  129. #define stdout    (&__iob[1])
  130. #define stderr    (&__iob[2])
  131. #else
  132. #define stdin    (&_iob[0])
  133. #define stdout    (&_iob[1])
  134. #define stderr    (&_iob[2])
  135. #endif
  136.  
  137. typedef struct    /* needs to be binary-compatible with old versions */
  138. {
  139. #ifdef _STDIO_REVERSE
  140.     unsigned char    *_ptr;    /* next character from/to here in buffer */
  141.     int        _cnt;    /* number of available characters in buffer */
  142. #else
  143.     int        _cnt;    /* number of available characters in buffer */
  144.     unsigned char    *_ptr;    /* next character from/to here in buffer */
  145. #endif
  146.     unsigned char    *_base;    /* the buffer */
  147.     unsigned char    _flag;    /* the state of the stream */
  148.     unsigned char    _file;    /* UNIX System file descriptor */
  149. } FILE;
  150.  
  151. #if defined(__STDC__)
  152. extern FILE        __iob[_NFILE];
  153. #else
  154. extern FILE        _iob[_NFILE];
  155. #endif
  156. extern FILE        *_lastbuf;
  157. extern unsigned char     *_bufendtab[];
  158. #ifndef _STDIO_ALLOCATE
  159. extern unsigned char     _sibuf[], _sobuf[];
  160. #endif
  161.  
  162. #if defined(__STDC__)
  163.  
  164. extern int    remove(const char *);
  165. extern int    rename(const char *, const char *);
  166. extern int    fclose(FILE *);
  167. extern int    fflush(FILE *);
  168. extern FILE    *fopen(const char *, const char *);
  169. extern FILE    *freopen(const char *, const char *, FILE *);
  170. extern void    setbuf(FILE *, char *);
  171. extern int    setvbuf(FILE *, char *, int, size_t);
  172. /* PRINTFLIKE2 */
  173. extern int    fprintf(FILE *, const char *, ...);
  174. /* SCANFLIKE2 */
  175. extern int    fscanf(FILE *, const char *, ...);
  176. /* PRINTFLIKE1 */
  177. extern int    printf(const char *, ...);
  178. /* SCANFLIKE1 */
  179. extern int    scanf(const char *, ...);
  180. /* PRINTFLIKE2 */
  181. extern char    *sprintf(const char *, const char *, ...);
  182. /* SCANFLIKE2 */
  183. extern int    sscanf(const char *, const char *, ...);
  184. extern int    vfprintf(FILE *, const char *, void *);
  185. extern int    vprintf(const char *, void *);
  186. extern char    *vsprintf(char *, char *, void *);
  187. extern int    fgetc(FILE *);
  188. extern char    *fgets(char *, int, FILE *); 
  189. extern int    fputc(int, FILE *);
  190. extern int    fputs(const char *, FILE *);
  191. extern int    getc(FILE *);
  192. extern int    getchar(void);
  193. extern char    *gets(char *);
  194. extern int    putc(int, FILE *);
  195. extern int    putchar(int);
  196. extern int    puts(const char *);
  197. extern int    ungetc(int, FILE *);
  198. extern size_t    fread(void *, size_t, size_t, FILE *);
  199.     #pragma int_to_unsigned fread
  200. extern size_t    fwrite(const void *, size_t, size_t, FILE *);
  201.     #pragma int_to_unsigned fwrite
  202. extern int    fgetpos(FILE *, fpos_t *);
  203. extern int    fseek(FILE *, long, int);
  204. extern int    fsetpos(FILE *, const fpos_t *);
  205. extern long    ftell(FILE *);
  206. extern void    rewind(FILE *);
  207. extern void    clearerr(FILE *);
  208. extern int    feof(FILE *);
  209. extern int    ferror(FILE *);
  210. extern void    perror(const char *);
  211.  
  212. extern int    __filbuf(FILE *);
  213. extern int    __flsbuf(int, FILE *);
  214.  
  215. #if !#lint(on)
  216. #define getc(p)        (--(p)->_cnt < 0 ? __filbuf(p) : (int)*(p)->_ptr++)
  217. #define putc(x, p)    (--(p)->_cnt < 0 ? __flsbuf((x), (p)) \
  218.                 : (int)(*(p)->_ptr++ = (x)))
  219. #define getchar()    getc(stdin)
  220. #define putchar(x)    putc((x), stdout)
  221. #define clearerr(p)    ((void)((p)->_flag &= ~(_IOERR | _IOEOF)))
  222. #define feof(p)        ((p)->_flag & _IOEOF)
  223. #define ferror(p)    ((p)->_flag & _IOERR)
  224. #endif
  225.  
  226. #if __STDC__ == 0 || defined(_POSIX_SOURCE) || defined(_XOPEN_SOURCE) /* non-ANSI standard compilation */
  227.  
  228. extern FILE    *fdopen(int, const char *);
  229. extern FILE    *popen(const char *, const char *);
  230. extern char    *ctermid(char *);
  231. extern char    *cuserid(char *);
  232. extern char    *tempnam(const char *, const char *);
  233. extern int     getw(FILE *);
  234. extern int     putw(int, FILE *);
  235. extern int     pclose(FILE *);
  236. extern int     system(const char *);
  237. extern int    fileno(FILE *);
  238.  
  239. #if !#lint(on)
  240. #define fileno(p)    (p)->_file
  241. #endif
  242.  
  243. #endif    /* __STDC__ == 0 */
  244.  
  245. #else    /* !defined __STDC__ */
  246. #define _bufend(p)      _bufendtab[(p)->_file]
  247. #define _bufsiz(p)      (_bufend(p) - (p)->_base)
  248.  
  249. #ifndef lint
  250. #define getc(p)         (--(p)->_cnt < 0 ? _filbuf(p) : (int) *(p)->_ptr++)
  251. #define putc(x, p)      (--(p)->_cnt < 0 ? \
  252.                         _flsbuf((unsigned char) (x), (p)) : \
  253.                         (int) (*(p)->_ptr++ = (unsigned char) (x)))
  254. #define getchar()       getc(stdin)
  255. #define putchar(x)      putc((x), stdout)
  256. #define clearerr(p)     ((void) ((p)->_flag &= ~(_IOERR | _IOEOF)))
  257. #define feof(p)         ((p)->_flag & _IOEOF)
  258. #define ferror(p)       ((p)->_flag & _IOERR)
  259. #define fileno(p)       (p)->_file
  260. #endif    /* lint */
  261.  
  262. extern FILE     *fopen(), *fdopen(), *freopen(), *popen();
  263. extern long     ftell();
  264. extern void     rewind(), setbuf();
  265. extern char     *ctermid(), *cuserid(), *fgets(), *gets();
  266. extern int      fclose(), fflush(), fread(), fwrite(), fseek(), fgetc(),
  267.                 getw(), pclose(), printf(), fprintf(), sprintf(),
  268.                 vprintf(), vfprintf(), vsprintf(), fputc(), putw(),
  269.                 puts(), fputs(), scanf(), fscanf(), sscanf(),
  270.                 setvbuf(), system(), ungetc();
  271.  
  272. #endif    /* __STDC__ */
  273.  
  274. #endif  /* _STDIO_H */
  275.