home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / amiga / programm / programi / ixemupd_.lzh / ixemupd-920129 / include / stdio.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-01-26  |  5.3 KB  |  166 lines

  1. /*-
  2.  * Copyright (c) 1989 The Regents of the University of California.
  3.  * All rights reserved.
  4.  *
  5.  * Redistribution and use in source and binary forms, with or without
  6.  * modification, are permitted provided that the following conditions
  7.  * are met:
  8.  * 1. Redistributions of source code must retain the above copyright
  9.  *    notice, this list of conditions and the following disclaimer.
  10.  * 2. Redistributions in binary form must reproduce the above copyright
  11.  *    notice, this list of conditions and the following disclaimer in the
  12.  *    documentation and/or other materials provided with the distribution.
  13.  * 3. All advertising materials mentioning features or use of this software
  14.  *    must display the following acknowledgement:
  15.  *    This product includes software developed by the University of
  16.  *    California, Berkeley and its contributors.
  17.  * 4. Neither the name of the University nor the names of its contributors
  18.  *    may be used to endorse or promote products derived from this software
  19.  *    without specific prior written permission.
  20.  *
  21.  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  22.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  23.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  24.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  25.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  26.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  27.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  28.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  29.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  30.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  31.  * SUCH DAMAGE.
  32.  */
  33. #ifndef    _STDIO_H_
  34. #define    _STDIO_H_
  35.  
  36. #include <sys/cdefs.h>
  37.  
  38. #include <machine/ansi.h>
  39. #ifdef    _SIZE_T_
  40. typedef    _SIZE_T_    size_t;
  41. #undef    _SIZE_T_
  42. #endif
  43.  
  44. #ifndef NULL
  45. #define    NULL    0
  46. #endif
  47.  
  48. #define    BUFSIZ    1024
  49. #define _SBFSIZ    8
  50. extern    struct    _iobuf {
  51.     int    _cnt;
  52.     unsigned char *_ptr;
  53.     unsigned char *_base;
  54.     int    _bufsiz;
  55.     short    _flag;
  56.     char    _file;        /* should be short */
  57. } _iob[];
  58.  
  59. #define _IOFBF    0
  60. #define    _IOREAD    01
  61. #define    _IOWRT    02
  62. #define    _IONBF    04
  63. #define    _IOMYBUF    010
  64. #define    _IOEOF    020
  65. #define    _IOERR    040
  66. #define    _IOSTRG    0100
  67. #define    _IOLBF    0200
  68. #define    _IORW    0400
  69. #define    FILE    struct _iobuf
  70. #define    EOF    (-1)
  71.  
  72. #define    stdin    (&_iob[0])
  73. #define    stdout    (&_iob[1])
  74. #define    stderr    (&_iob[2])
  75.  
  76. #ifdef lint    /* so that lint likes (void)putc(a,b) */
  77. extern int putc();
  78. extern int getc();
  79. #else
  80. #define    getc(p)        (--(p)->_cnt>=0? ((int)*(p)->_ptr++):_filbuf(p))
  81. #define putc(x, p)    (--(p)->_cnt >= 0 ?\
  82.     (int)(*(p)->_ptr++ = (unsigned char)(x)) :\
  83.     (((p)->_flag & _IOLBF) && -(p)->_cnt < (p)->_bufsiz ?\
  84.         ((*(p)->_ptr = (unsigned char)(x)) != '\n' ?\
  85.             (int)(*(p)->_ptr++) :\
  86.             _flsbuf(*(unsigned char *)(p)->_ptr, p)) :\
  87.         _flsbuf((unsigned char)(x), p)))
  88. #endif
  89. #define    getchar()    getc(stdin)
  90. #define    putchar(x)    putc((x),stdout)
  91. #define    feof(p)        (((p)->_flag&_IOEOF)!=0)
  92. #define    ferror(p)    (((p)->_flag&_IOERR)!=0)
  93. #define    fileno(p)    ((p)->_file)
  94. #define    clearerr(p)    (void) ((p)->_flag &= ~(_IOERR|_IOEOF))
  95.  
  96. /*
  97.  * Functions defined in ANSI C standard.
  98.  */
  99. __BEGIN_DECLS
  100. void     clearerr __P((FILE *));
  101. int     fclose __P((FILE *));
  102. int     feof __P((FILE *));
  103. int     ferror __P((FILE *));
  104. int     fflush __P((FILE *));
  105. int     fgetc __P((FILE *));
  106. char    *fgets __P((char *, size_t, FILE *));
  107. FILE    *fopen __P((const char *, const char *));
  108. int     fprintf __P((FILE *, const char *, ...));
  109. int     fputc __P((int, FILE *));
  110. int     fputs __P((const char *, FILE *));
  111. int     fread __P((void *, size_t, size_t, FILE *));
  112. FILE    *freopen __P((const char *, const char *, FILE *));
  113. int     fscanf __P((FILE *, const char *, ...));
  114. int     fseek __P((FILE *, long, int));
  115. long     ftell __P((const FILE *));
  116. int     fwrite __P((const void *, size_t, size_t, FILE *));
  117. int     getc __P((FILE *));
  118. int     getchar __P((void));
  119. char    *gets __P((char *));
  120. #if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
  121. extern int sys_nerr;            /* perror(3) external variables */
  122. extern char *sys_errlist[];
  123. #endif
  124. void     perror __P((const char *));
  125. int     printf __P((const char *, ...));
  126. int     putc __P((int, FILE *));
  127. int     putchar __P((int));
  128. int     puts __P((const char *));
  129. int     remove __P((const char *));
  130. int     rename  __P((const char *, const char *));
  131. void     rewind __P((FILE *));
  132. int     scanf __P((const char *, ...));
  133. void     setbuf __P((FILE *, char *));
  134. int     setvbuf __P((FILE *, char *, int, size_t));
  135. int     sprintf __P((char *, const char *, ...));
  136. int     sscanf __P((char *, const char *, ...));
  137. FILE    *tmpfile __P((void));
  138. char    *tmpnam __P((char *));
  139. int     ungetc __P((int, FILE *));
  140. int     vfprintf __P((FILE *, const char *, _VA_LIST_));
  141. int     vprintf __P((const char *, _VA_LIST_));
  142. int     vsprintf __P((char *, const char *, _VA_LIST_));
  143. __END_DECLS
  144.  
  145. /*
  146.  * Functions defined in POSIX 1003.1.
  147.  */
  148. #ifndef _ANSI_SOURCE
  149. #define    L_cuserid    9    /* size for cuserid(); UT_NAMESIZE + 1 */
  150. #define    L_ctermid    1024    /* size for ctermid(); PATH_MAX */
  151. #define P_tmpdir    "t:"
  152. #define L_tmpnam    (sizeof(P_tmpdir) + 15)
  153.  
  154. __BEGIN_DECLS
  155. char    *ctermid __P((char *));
  156. FILE    *fdopen __P((int, const char *));
  157. int     fileno __P((FILE *));
  158.  
  159. int    _flsbuf(unsigned c, FILE *iop);
  160. int    _filbuf(FILE *iop);
  161.  
  162. __END_DECLS
  163. #endif /* not ANSI */
  164.  
  165. # endif /* _STDIO_H_ */
  166.