17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 57c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 67c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 77c478bd9Sstevel@tonic-gate * with the License. 87c478bd9Sstevel@tonic-gate * 97c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 107c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 117c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 127c478bd9Sstevel@tonic-gate * and limitations under the License. 137c478bd9Sstevel@tonic-gate * 147c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 157c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 167c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 177c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 187c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 197c478bd9Sstevel@tonic-gate * 207c478bd9Sstevel@tonic-gate * CDDL HEADER END 217c478bd9Sstevel@tonic-gate */ 227c478bd9Sstevel@tonic-gate /* 237c478bd9Sstevel@tonic-gate * Copyright 1988 Sun Microsystems, Inc. All rights reserved. 247c478bd9Sstevel@tonic-gate * Use is subject to license terms. 257c478bd9Sstevel@tonic-gate */ 267c478bd9Sstevel@tonic-gate 277c478bd9Sstevel@tonic-gate /* Copyright (c) 1984 AT&T */ 287c478bd9Sstevel@tonic-gate /* All Rights Reserved */ 297c478bd9Sstevel@tonic-gate 30*5d54f3d8Smuffin 31*5d54f3d8Smuffin #ifndef __5include_stdio_h 32*5d54f3d8Smuffin #define __5include_stdio_h 33*5d54f3d8Smuffin 347c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 357c478bd9Sstevel@tonic-gate 367c478bd9Sstevel@tonic-gate #include <sys/stdtypes.h> /* for size_t */ 377c478bd9Sstevel@tonic-gate 387c478bd9Sstevel@tonic-gate #if pdp11 397c478bd9Sstevel@tonic-gate #define BUFSIZ 512 407c478bd9Sstevel@tonic-gate #elif u370 417c478bd9Sstevel@tonic-gate #define BUFSIZ 4096 427c478bd9Sstevel@tonic-gate #else /* just about every other UNIX system in existence */ 437c478bd9Sstevel@tonic-gate #define BUFSIZ 1024 447c478bd9Sstevel@tonic-gate #endif 457c478bd9Sstevel@tonic-gate #ifndef EOF 467c478bd9Sstevel@tonic-gate #define EOF (-1) 477c478bd9Sstevel@tonic-gate #endif 487c478bd9Sstevel@tonic-gate #define L_ctermid 9 497c478bd9Sstevel@tonic-gate #define L_cuserid 9 507c478bd9Sstevel@tonic-gate #define L_tmpnam 25 /* (sizeof (_tmpdir) + 15) */ 517c478bd9Sstevel@tonic-gate #define _tmpdir "/usr/tmp/" 527c478bd9Sstevel@tonic-gate #define FILENAME_MAX 1025 537c478bd9Sstevel@tonic-gate #define TMP_MAX 17576 547c478bd9Sstevel@tonic-gate 557c478bd9Sstevel@tonic-gate /* 567c478bd9Sstevel@tonic-gate * ANSI C requires definitions of SEEK_CUR, SEEK_END, and SEEK_SET here. 577c478bd9Sstevel@tonic-gate * They must be kept in sync with SEEK_* in <sys/unistd.h> (as required 587c478bd9Sstevel@tonic-gate * by POSIX.1) and L_* in <sys/file.h>. 597c478bd9Sstevel@tonic-gate * FOPEN_MAX should follow definition of _POSIX_OPEN_MAX in <sys/unistd.h>. 607c478bd9Sstevel@tonic-gate */ 617c478bd9Sstevel@tonic-gate 627c478bd9Sstevel@tonic-gate #ifndef SEEK_SET 637c478bd9Sstevel@tonic-gate #define SEEK_SET 0 647c478bd9Sstevel@tonic-gate #define SEEK_CUR 1 657c478bd9Sstevel@tonic-gate #define SEEK_END 2 667c478bd9Sstevel@tonic-gate #endif 677c478bd9Sstevel@tonic-gate 687c478bd9Sstevel@tonic-gate #define FOPEN_MAX 16 697c478bd9Sstevel@tonic-gate 707c478bd9Sstevel@tonic-gate #ifndef _POSIX_SOURCE 717c478bd9Sstevel@tonic-gate #define P_tmpdir _tmpdir 727c478bd9Sstevel@tonic-gate #endif 737c478bd9Sstevel@tonic-gate #ifndef NULL 747c478bd9Sstevel@tonic-gate #define NULL 0 757c478bd9Sstevel@tonic-gate #endif 767c478bd9Sstevel@tonic-gate #define stdin (&_iob[0]) 777c478bd9Sstevel@tonic-gate #define stdout (&_iob[1]) 787c478bd9Sstevel@tonic-gate #define stderr (&_iob[2]) 797c478bd9Sstevel@tonic-gate /* 807c478bd9Sstevel@tonic-gate * _IOLBF means that a file's output will be buffered line by line 817c478bd9Sstevel@tonic-gate * In addition to being flags, _IONBF, _IOLBF and _IOFBF are possible 827c478bd9Sstevel@tonic-gate * values for "type" in setvbuf. 837c478bd9Sstevel@tonic-gate */ 847c478bd9Sstevel@tonic-gate #define _IOFBF 0000 857c478bd9Sstevel@tonic-gate #define _IOREAD 0001 867c478bd9Sstevel@tonic-gate #define _IOWRT 0002 877c478bd9Sstevel@tonic-gate #define _IONBF 0004 887c478bd9Sstevel@tonic-gate #define _IOMYBUF 0010 897c478bd9Sstevel@tonic-gate #define _IOEOF 0020 907c478bd9Sstevel@tonic-gate #define _IOERR 0040 917c478bd9Sstevel@tonic-gate #define _IOSTRG 0100 927c478bd9Sstevel@tonic-gate #define _IOLBF 0200 937c478bd9Sstevel@tonic-gate #define _IORW 0400 947c478bd9Sstevel@tonic-gate /* 957c478bd9Sstevel@tonic-gate * buffer size for multi-character output to unbuffered files 967c478bd9Sstevel@tonic-gate */ 977c478bd9Sstevel@tonic-gate #define _SBFSIZ 8 987c478bd9Sstevel@tonic-gate 997c478bd9Sstevel@tonic-gate typedef struct { 1007c478bd9Sstevel@tonic-gate #if pdp11 || u370 1017c478bd9Sstevel@tonic-gate unsigned char *_ptr; 1027c478bd9Sstevel@tonic-gate int _cnt; 1037c478bd9Sstevel@tonic-gate #else /* just about every other UNIX system in existence */ 1047c478bd9Sstevel@tonic-gate int _cnt; 1057c478bd9Sstevel@tonic-gate unsigned char *_ptr; 1067c478bd9Sstevel@tonic-gate #endif 1077c478bd9Sstevel@tonic-gate unsigned char *_base; 1087c478bd9Sstevel@tonic-gate int _bufsiz; 1097c478bd9Sstevel@tonic-gate short _flag; 1107c478bd9Sstevel@tonic-gate unsigned char _file; /* should be short */ 1117c478bd9Sstevel@tonic-gate } FILE; 1127c478bd9Sstevel@tonic-gate 1137c478bd9Sstevel@tonic-gate #ifndef _POSIX_SOURCE 114*5d54f3d8Smuffin extern char *ctermid(char *); /* unistd.h */ 115*5d54f3d8Smuffin extern char *cuserid(char *); /* unistd.h */ 116*5d54f3d8Smuffin extern FILE *popen(char *, char *); 117*5d54f3d8Smuffin extern char *tempnam(char *, char *); 1187c478bd9Sstevel@tonic-gate #endif 1197c478bd9Sstevel@tonic-gate 120*5d54f3d8Smuffin extern void clearerr(FILE *); 121*5d54f3d8Smuffin extern int fclose(FILE *); 122*5d54f3d8Smuffin extern FILE *fdopen(int, char *); 123*5d54f3d8Smuffin extern int feof(FILE *); 124*5d54f3d8Smuffin extern int ferror(FILE *); 125*5d54f3d8Smuffin extern int fflush(FILE *); 126*5d54f3d8Smuffin extern int fgetc(FILE *); 127*5d54f3d8Smuffin extern int fileno(FILE *); 128*5d54f3d8Smuffin extern FILE *fopen(char *, char *); 129*5d54f3d8Smuffin extern char *fgets(char *, int, FILE *); 130*5d54f3d8Smuffin extern int fprintf(FILE *, char *, ...); 131*5d54f3d8Smuffin extern int fputc(int, FILE *); 132*5d54f3d8Smuffin extern int fputs(char *, FILE *); 133*5d54f3d8Smuffin extern size_t fread(char *, int, int, FILE *); 134*5d54f3d8Smuffin extern FILE *freopen(char *, char *, FILE *); 135*5d54f3d8Smuffin extern int fscanf(FILE *, char *, ...); 136*5d54f3d8Smuffin extern int fseek(FILE *, long int, int); 137*5d54f3d8Smuffin extern long ftell(FILE *); 138*5d54f3d8Smuffin extern size_t fwrite(char *, int, int, FILE *); 139*5d54f3d8Smuffin extern int getc(FILE *); 140*5d54f3d8Smuffin extern int getchar(void); 141*5d54f3d8Smuffin extern char *gets(char *); 142*5d54f3d8Smuffin extern void perror(char *); 143*5d54f3d8Smuffin extern int printf(char *, ...); 144*5d54f3d8Smuffin extern int putc(int, FILE *); 145*5d54f3d8Smuffin extern int putchar(int); 146*5d54f3d8Smuffin extern int puts(char *); 147*5d54f3d8Smuffin extern int remove(char *); 148*5d54f3d8Smuffin extern int rename(char *, char *); 149*5d54f3d8Smuffin extern void rewind(FILE *); 150*5d54f3d8Smuffin extern int scanf(char *, ...); 151*5d54f3d8Smuffin extern void setbuf(FILE *, char *); 152*5d54f3d8Smuffin extern int sprintf(char *, char *, ...); 153*5d54f3d8Smuffin extern int sscanf(char *, char *, ...); 154*5d54f3d8Smuffin extern FILE *tmpfile(void); 155*5d54f3d8Smuffin extern char *tmpnam(char *); 156*5d54f3d8Smuffin extern int ungetc(int, FILE *); 1577c478bd9Sstevel@tonic-gate 1587c478bd9Sstevel@tonic-gate #ifndef lint 1597c478bd9Sstevel@tonic-gate #define getc(p) (--(p)->_cnt >= 0 ? ((int) *(p)->_ptr++) : _filbuf(p)) 1607c478bd9Sstevel@tonic-gate #define putc(x, p) (--(p)->_cnt >= 0 ?\ 1617c478bd9Sstevel@tonic-gate (int)(*(p)->_ptr++ = (unsigned char)(x)) :\ 1627c478bd9Sstevel@tonic-gate (((p)->_flag & _IOLBF) && -(p)->_cnt < (p)->_bufsiz ?\ 1637c478bd9Sstevel@tonic-gate ((*(p)->_ptr = (unsigned char)(x)) != '\n' ?\ 1647c478bd9Sstevel@tonic-gate (int)(*(p)->_ptr++) :\ 1657c478bd9Sstevel@tonic-gate _flsbuf(*(unsigned char *)(p)->_ptr, p)) :\ 1667c478bd9Sstevel@tonic-gate _flsbuf((unsigned char)(x), p))) 1677c478bd9Sstevel@tonic-gate #define getchar() getc(stdin) 1687c478bd9Sstevel@tonic-gate #define putchar(x) putc((x), stdout) 1697c478bd9Sstevel@tonic-gate #define clearerr(p) ((void) ((p)->_flag &= ~(_IOERR | _IOEOF))) 1707c478bd9Sstevel@tonic-gate #define feof(p) (((p)->_flag & _IOEOF) != 0) 1717c478bd9Sstevel@tonic-gate #define ferror(p) (((p)->_flag & _IOERR) != 0) 1727c478bd9Sstevel@tonic-gate #endif 1737c478bd9Sstevel@tonic-gate 1747c478bd9Sstevel@tonic-gate extern FILE _iob[]; 1757c478bd9Sstevel@tonic-gate 176*5d54f3d8Smuffin #endif /* !__5include_stdio_h */ 177