home *** CD-ROM | disk | FTP | other *** search
- /*-
- * Copyright (c) 1989 The Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
- #ifndef _STDIO_H_
- #define _STDIO_H_
-
- #include <sys/cdefs.h>
-
- #include <machine/ansi.h>
- #ifdef _SIZE_T_
- typedef _SIZE_T_ size_t;
- #undef _SIZE_T_
- #endif
-
- #ifndef NULL
- #define NULL 0
- #endif
-
- #define BUFSIZ 1024
- #define _SBFSIZ 8
- extern struct _iobuf {
- int _cnt;
- unsigned char *_ptr;
- unsigned char *_base;
- int _bufsiz;
- short _flag;
- char _file; /* should be short */
- } _iob[];
-
- #define _IOFBF 0
- #define _IOREAD 01
- #define _IOWRT 02
- #define _IONBF 04
- #define _IOMYBUF 010
- #define _IOEOF 020
- #define _IOERR 040
- #define _IOSTRG 0100
- #define _IOLBF 0200
- #define _IORW 0400
- #define FILE struct _iobuf
- #define EOF (-1)
-
- #define stdin (&_iob[0])
- #define stdout (&_iob[1])
- #define stderr (&_iob[2])
-
- #ifdef lint /* so that lint likes (void)putc(a,b) */
- extern int putc();
- extern int getc();
- #else
- #define getc(p) (--(p)->_cnt>=0? ((int)*(p)->_ptr++):_filbuf(p))
- #define putc(x, p) (--(p)->_cnt >= 0 ?\
- (int)(*(p)->_ptr++ = (unsigned char)(x)) :\
- (((p)->_flag & _IOLBF) && -(p)->_cnt < (p)->_bufsiz ?\
- ((*(p)->_ptr = (unsigned char)(x)) != '\n' ?\
- (int)(*(p)->_ptr++) :\
- _flsbuf(*(unsigned char *)(p)->_ptr, p)) :\
- _flsbuf((unsigned char)(x), p)))
- #endif
- #define getchar() getc(stdin)
- #define putchar(x) putc((x),stdout)
- #define feof(p) (((p)->_flag&_IOEOF)!=0)
- #define ferror(p) (((p)->_flag&_IOERR)!=0)
- #define fileno(p) ((p)->_file)
- #define clearerr(p) (void) ((p)->_flag &= ~(_IOERR|_IOEOF))
-
- /*
- * Functions defined in ANSI C standard.
- */
- __BEGIN_DECLS
- void clearerr __P((FILE *));
- int fclose __P((FILE *));
- int feof __P((FILE *));
- int ferror __P((FILE *));
- int fflush __P((FILE *));
- int fgetc __P((FILE *));
- char *fgets __P((char *, size_t, FILE *));
- FILE *fopen __P((const char *, const char *));
- int fprintf __P((FILE *, const char *, ...));
- int fputc __P((int, FILE *));
- int fputs __P((const char *, FILE *));
- int fread __P((void *, size_t, size_t, FILE *));
- FILE *freopen __P((const char *, const char *, FILE *));
- int fscanf __P((FILE *, const char *, ...));
- int fseek __P((FILE *, long, int));
- long ftell __P((const FILE *));
- int fwrite __P((const void *, size_t, size_t, FILE *));
- int getc __P((FILE *));
- int getchar __P((void));
- char *gets __P((char *));
- #if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
- extern int sys_nerr; /* perror(3) external variables */
- extern char *sys_errlist[];
- #endif
- void perror __P((const char *));
- int printf __P((const char *, ...));
- int putc __P((int, FILE *));
- int putchar __P((int));
- int puts __P((const char *));
- int remove __P((const char *));
- int rename __P((const char *, const char *));
- void rewind __P((FILE *));
- int scanf __P((const char *, ...));
- void setbuf __P((FILE *, char *));
- int setvbuf __P((FILE *, char *, int, size_t));
- int sprintf __P((char *, const char *, ...));
- int sscanf __P((char *, const char *, ...));
- FILE *tmpfile __P((void));
- char *tmpnam __P((char *));
- int ungetc __P((int, FILE *));
- int vfprintf __P((FILE *, const char *, _VA_LIST_));
- int vprintf __P((const char *, _VA_LIST_));
- int vsprintf __P((char *, const char *, _VA_LIST_));
- __END_DECLS
-
- /*
- * Functions defined in POSIX 1003.1.
- */
- #ifndef _ANSI_SOURCE
- #define L_cuserid 9 /* size for cuserid(); UT_NAMESIZE + 1 */
- #define L_ctermid 1024 /* size for ctermid(); PATH_MAX */
- #define P_tmpdir "t:"
- #define L_tmpnam (sizeof(P_tmpdir) + 15)
-
- __BEGIN_DECLS
- char *ctermid __P((char *));
- FILE *fdopen __P((int, const char *));
- int fileno __P((FILE *));
-
- int _flsbuf(unsigned c, FILE *iop);
- int _filbuf(FILE *iop);
-
- __END_DECLS
- #endif /* not ANSI */
-
- # endif /* _STDIO_H_ */
-