1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License, Version 1.0 only 6 * (the "License"). You may not use this file except in compliance 7 * with the License. 8 * 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 * or http://www.opensolaris.org/os/licensing. 11 * See the License for the specific language governing permissions 12 * and limitations under the License. 13 * 14 * When distributing Covered Code, include this CDDL HEADER in each 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 * If applicable, add the following below this CDDL HEADER, with the 17 * fields enclosed by brackets "[]" replaced with your own identifying 18 * information: Portions Copyright [yyyy] [name of copyright owner] 19 * 20 * CDDL HEADER END 21 */ 22 /* 23 * Copyright 1988 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27 /* Copyright (c) 1984 AT&T */ 28 /* All Rights Reserved */ 29 30 #pragma ident "%Z%%M% %I% %E% SMI" 31 /* from S5R2 2.7 */ 32 33 #ifdef comment /* ======================================================= */ 34 35 "Standard" header file definition. See the C style paper for 36 full explanations. Note that this reorganization has been 37 forced upon us by ANSI C; please abide by it. This file, aside 38 from this comment, is supposed to be a good example. 39 40 /* sccs id stuff */ 41 42 #ifndef __dir_filename_h 43 #define __dir_filename_h 44 45 /*#include */ /* all includes come first */ 46 47 #define /* all defines other than function like macros */ 48 49 structs 50 unions 51 enums 52 53 function prototypes 54 55 /* 56 * macros that are supplied as C functions have to be defined after 57 * the C prototype. 58 */ 59 #define /* all function like macros */ 60 61 extern variables 62 63 #endif __dir_filename_h 64 65 #endif /* comment ======================================================= */ 66 67 #ifndef __stdio_h 68 #define __stdio_h 69 70 #include <sys/stdtypes.h> /* for size_t */ 71 72 #if pdp11 73 #define BUFSIZ 512 74 #elif u370 75 #define BUFSIZ 4096 76 #else /* just about every other UNIX system in existence */ 77 #define BUFSIZ 1024 78 #endif 79 #ifndef EOF 80 #define EOF (-1) 81 #endif 82 #define L_ctermid 9 83 #define L_cuserid 9 84 #define L_tmpnam 25 /* (sizeof (_tmpdir) + 15) */ 85 #define _tmpdir "/usr/tmp/" 86 #define FILENAME_MAX 1025 87 #define TMP_MAX 17576 88 89 /* 90 * ANSI C requires definitions of SEEK_CUR, SEEK_END, and SEEK_SET here. 91 * They must be kept in sync with SEEK_* in <sys/unistd.h> (as required 92 * by POSIX.1) and L_* in <sys/file.h>. 93 * FOPEN_MAX should follow definition of _POSIX_OPEN_MAX in <sys/unistd.h>. 94 */ 95 96 #ifndef SEEK_SET 97 #define SEEK_SET 0 98 #define SEEK_CUR 1 99 #define SEEK_END 2 100 #endif 101 102 #define FOPEN_MAX 16 103 104 #ifndef _POSIX_SOURCE 105 #define P_tmpdir _tmpdir 106 #endif 107 #ifndef NULL 108 #define NULL 0 109 #endif 110 #define stdin (&_iob[0]) 111 #define stdout (&_iob[1]) 112 #define stderr (&_iob[2]) 113 /* 114 * _IOLBF means that a file's output will be buffered line by line 115 * In addition to being flags, _IONBF, _IOLBF and _IOFBF are possible 116 * values for "type" in setvbuf. 117 */ 118 #define _IOFBF 0000 119 #define _IOREAD 0001 120 #define _IOWRT 0002 121 #define _IONBF 0004 122 #define _IOMYBUF 0010 123 #define _IOEOF 0020 124 #define _IOERR 0040 125 #define _IOSTRG 0100 126 #define _IOLBF 0200 127 #define _IORW 0400 128 /* 129 * buffer size for multi-character output to unbuffered files 130 */ 131 #define _SBFSIZ 8 132 133 typedef struct { 134 #if pdp11 || u370 135 unsigned char *_ptr; 136 int _cnt; 137 #else /* just about every other UNIX system in existence */ 138 int _cnt; 139 unsigned char *_ptr; 140 #endif 141 unsigned char *_base; 142 int _bufsiz; 143 short _flag; 144 unsigned char _file; /* should be short */ 145 } FILE; 146 147 #ifndef _POSIX_SOURCE 148 extern char *ctermid(/* char *s */); /* unistd.h */ 149 extern char *cuserid(/* char *s */); /* unistd.h */ 150 extern FILE *popen(/* char *prog, char *mode */); 151 extern char *tempnam(/* char *d, char *s */); 152 #endif 153 154 extern void clearerr(/* FILE *stream */); 155 extern int fclose(/* FILE *f */); 156 extern FILE *fdopen(/* int fd, char *type */); 157 extern int feof(/* FILE *f */); 158 extern int ferror(/* FILE *f */); 159 extern int fflush(/* FILE *f */); 160 extern int fgetc(/* FILE *f */); 161 extern int fileno(/* FILE *f */); 162 extern FILE *fopen(/* const char *path, const char *mode */); 163 extern char *fgets(/* char *s, int n, FILE *f */); 164 extern int fprintf(/* FILE *f, const char *fmt, ... */); 165 extern int fputc(/* int c, FILE *f */); 166 extern int fputs(/* const char *s, FILE *f */); 167 extern size_t fread(/* void *ptr, size_t size, size_t nmemb, FILE *f */); 168 extern FILE *freopen(/* const char *filename, const char *mode, FILE *f */); 169 extern int fscanf(/* FILE *f, const char *format, ... */); 170 extern int fseek(/* FILE *f, long int offset, int whence */); 171 extern long ftell(/* FILE *f */); 172 extern size_t fwrite(/* const void *p, size_t size, size_t nmemb, FILE *f */); 173 extern int getc(/* FILE *f */); 174 extern int getchar(/* void */); 175 extern char *gets(/* char *s */); 176 extern void perror(/* const char *s */); 177 extern int printf(/* const char *fmt, ... */); 178 extern int putc(/* int c, FILE *f */); 179 extern int putchar(/* int c */); 180 extern int puts(/* const char *s */); 181 extern int remove(/* const char *filename */); 182 extern int rename(/* char *old, char *new */); 183 extern void rewind(/* FILE *f */); 184 extern int scanf(/* const char *format, ... */); 185 extern void setbuf(/* FILE *f, char *b */); 186 extern int sprintf(/* char *s, const char *fmt, ... */); 187 extern int sscanf(/* const char *s, const char *format, ... */); 188 extern FILE *tmpfile(/* void */); 189 extern char *tmpnam(/* char *s */); 190 extern int ungetc(/* int c, FILE *f */); 191 192 #ifndef lint 193 #define getc(p) (--(p)->_cnt >= 0 ? ((int) *(p)->_ptr++) : _filbuf(p)) 194 #define putc(x, p) (--(p)->_cnt >= 0 ?\ 195 (int)(*(p)->_ptr++ = (unsigned char)(x)) :\ 196 (((p)->_flag & _IOLBF) && -(p)->_cnt < (p)->_bufsiz ?\ 197 ((*(p)->_ptr = (unsigned char)(x)) != '\n' ?\ 198 (int)(*(p)->_ptr++) :\ 199 _flsbuf(*(unsigned char *)(p)->_ptr, p)) :\ 200 _flsbuf((unsigned char)(x), p))) 201 #define getchar() getc(stdin) 202 #define putchar(x) putc((x), stdout) 203 #define clearerr(p) ((void) ((p)->_flag &= ~(_IOERR | _IOEOF))) 204 #define feof(p) (((p)->_flag & _IOEOF) != 0) 205 #define ferror(p) (((p)->_flag & _IOERR) != 0) 206 #endif 207 208 extern FILE _iob[]; 209 210 #endif /* !__stdio_h */ 211