1*7c478bd9Sstevel@tonic-gate /* 2*7c478bd9Sstevel@tonic-gate * CDDL HEADER START 3*7c478bd9Sstevel@tonic-gate * 4*7c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*7c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*7c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*7c478bd9Sstevel@tonic-gate * with the License. 8*7c478bd9Sstevel@tonic-gate * 9*7c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*7c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*7c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 12*7c478bd9Sstevel@tonic-gate * and limitations under the License. 13*7c478bd9Sstevel@tonic-gate * 14*7c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*7c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*7c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*7c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*7c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*7c478bd9Sstevel@tonic-gate * 20*7c478bd9Sstevel@tonic-gate * CDDL HEADER END 21*7c478bd9Sstevel@tonic-gate */ 22*7c478bd9Sstevel@tonic-gate /* Copyright (c) 1988 AT&T */ 23*7c478bd9Sstevel@tonic-gate /* All Rights Reserved */ 24*7c478bd9Sstevel@tonic-gate 25*7c478bd9Sstevel@tonic-gate 26*7c478bd9Sstevel@tonic-gate /* 27*7c478bd9Sstevel@tonic-gate * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 28*7c478bd9Sstevel@tonic-gate * Use is subject to license terms. 29*7c478bd9Sstevel@tonic-gate */ 30*7c478bd9Sstevel@tonic-gate 31*7c478bd9Sstevel@tonic-gate /* 32*7c478bd9Sstevel@tonic-gate * User-visible pieces of the ANSI C standard I/O package. 33*7c478bd9Sstevel@tonic-gate */ 34*7c478bd9Sstevel@tonic-gate 35*7c478bd9Sstevel@tonic-gate #ifndef _STDIO_H 36*7c478bd9Sstevel@tonic-gate #define _STDIO_H 37*7c478bd9Sstevel@tonic-gate 38*7c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 2.34.1.2 */ 39*7c478bd9Sstevel@tonic-gate 40*7c478bd9Sstevel@tonic-gate #include <sys/feature_tests.h> 41*7c478bd9Sstevel@tonic-gate 42*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 43*7c478bd9Sstevel@tonic-gate extern "C" { 44*7c478bd9Sstevel@tonic-gate #endif 45*7c478bd9Sstevel@tonic-gate 46*7c478bd9Sstevel@tonic-gate /* 47*7c478bd9Sstevel@tonic-gate * Do all of our 'redefine_extname' processing before 48*7c478bd9Sstevel@tonic-gate * declarations of the associated functions are seen. 49*7c478bd9Sstevel@tonic-gate * This is necessary to keep gcc happy. 50*7c478bd9Sstevel@tonic-gate */ 51*7c478bd9Sstevel@tonic-gate #if defined(__PRAGMA_REDEFINE_EXTNAME) 52*7c478bd9Sstevel@tonic-gate 53*7c478bd9Sstevel@tonic-gate /* large file compilation environment setup */ 54*7c478bd9Sstevel@tonic-gate #if !defined(_LP64) && _FILE_OFFSET_BITS == 64 55*7c478bd9Sstevel@tonic-gate #pragma redefine_extname fopen fopen64 56*7c478bd9Sstevel@tonic-gate #pragma redefine_extname freopen freopen64 57*7c478bd9Sstevel@tonic-gate #pragma redefine_extname tmpfile tmpfile64 58*7c478bd9Sstevel@tonic-gate #pragma redefine_extname fgetpos fgetpos64 59*7c478bd9Sstevel@tonic-gate #pragma redefine_extname fsetpos fsetpos64 60*7c478bd9Sstevel@tonic-gate #if defined(_LARGEFILE_SOURCE) 61*7c478bd9Sstevel@tonic-gate #pragma redefine_extname fseeko fseeko64 62*7c478bd9Sstevel@tonic-gate #pragma redefine_extname ftello ftello64 63*7c478bd9Sstevel@tonic-gate #endif /* _LARGEFILE_SOURCE */ 64*7c478bd9Sstevel@tonic-gate #endif /* !defined(_LP64) && _FILE_OFFSET_BITS == 64 */ 65*7c478bd9Sstevel@tonic-gate 66*7c478bd9Sstevel@tonic-gate /* In the LP64 compilation environment, all APIs are already large file */ 67*7c478bd9Sstevel@tonic-gate #if defined(_LP64) && defined(_LARGEFILE64_SOURCE) 68*7c478bd9Sstevel@tonic-gate #pragma redefine_extname fopen64 fopen 69*7c478bd9Sstevel@tonic-gate #pragma redefine_extname freopen64 freopen 70*7c478bd9Sstevel@tonic-gate #pragma redefine_extname tmpfile64 tmpfile 71*7c478bd9Sstevel@tonic-gate #pragma redefine_extname fgetpos64 fgetpos 72*7c478bd9Sstevel@tonic-gate #pragma redefine_extname fsetpos64 fsetpos 73*7c478bd9Sstevel@tonic-gate #if defined(_LARGEFILE_SOURCE) 74*7c478bd9Sstevel@tonic-gate #pragma redefine_extname fseeko64 fseeko 75*7c478bd9Sstevel@tonic-gate #pragma redefine_extname ftello64 ftello 76*7c478bd9Sstevel@tonic-gate #endif /* _LARGEFILE_SOURCE */ 77*7c478bd9Sstevel@tonic-gate #endif /* defined(_LP64) && defined(_LARGEFILE64_SOURCE) */ 78*7c478bd9Sstevel@tonic-gate 79*7c478bd9Sstevel@tonic-gate #endif /* __PRAGMA_REDEFINE_EXTNAME */ 80*7c478bd9Sstevel@tonic-gate 81*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 82*7c478bd9Sstevel@tonic-gate } 83*7c478bd9Sstevel@tonic-gate #endif 84*7c478bd9Sstevel@tonic-gate 85*7c478bd9Sstevel@tonic-gate #include <iso/stdio_iso.h> 86*7c478bd9Sstevel@tonic-gate 87*7c478bd9Sstevel@tonic-gate /* 88*7c478bd9Sstevel@tonic-gate * If feature test macros are set that enable interfaces that use types 89*7c478bd9Sstevel@tonic-gate * defined in <sys/types.h>, get those types by doing the include. 90*7c478bd9Sstevel@tonic-gate * 91*7c478bd9Sstevel@tonic-gate * Note that in asking for the interfaces associated with this feature test 92*7c478bd9Sstevel@tonic-gate * macro one also asks for definitions of the POSIX types. 93*7c478bd9Sstevel@tonic-gate */ 94*7c478bd9Sstevel@tonic-gate 95*7c478bd9Sstevel@tonic-gate /* 96*7c478bd9Sstevel@tonic-gate * Allow global visibility for symbols defined in 97*7c478bd9Sstevel@tonic-gate * C++ "std" namespace in <iso/stdio_iso.h>. 98*7c478bd9Sstevel@tonic-gate */ 99*7c478bd9Sstevel@tonic-gate #if __cplusplus >= 199711L 100*7c478bd9Sstevel@tonic-gate using std::FILE; 101*7c478bd9Sstevel@tonic-gate using std::size_t; 102*7c478bd9Sstevel@tonic-gate using std::fpos_t; 103*7c478bd9Sstevel@tonic-gate using std::remove; 104*7c478bd9Sstevel@tonic-gate using std::rename; 105*7c478bd9Sstevel@tonic-gate using std::tmpfile; 106*7c478bd9Sstevel@tonic-gate using std::tmpnam; 107*7c478bd9Sstevel@tonic-gate using std::fclose; 108*7c478bd9Sstevel@tonic-gate using std::fflush; 109*7c478bd9Sstevel@tonic-gate using std::fopen; 110*7c478bd9Sstevel@tonic-gate using std::freopen; 111*7c478bd9Sstevel@tonic-gate using std::setbuf; 112*7c478bd9Sstevel@tonic-gate using std::setvbuf; 113*7c478bd9Sstevel@tonic-gate using std::fprintf; 114*7c478bd9Sstevel@tonic-gate using std::fscanf; 115*7c478bd9Sstevel@tonic-gate using std::printf; 116*7c478bd9Sstevel@tonic-gate using std::scanf; 117*7c478bd9Sstevel@tonic-gate using std::sprintf; 118*7c478bd9Sstevel@tonic-gate using std::sscanf; 119*7c478bd9Sstevel@tonic-gate using std::vfprintf; 120*7c478bd9Sstevel@tonic-gate using std::vprintf; 121*7c478bd9Sstevel@tonic-gate using std::vsprintf; 122*7c478bd9Sstevel@tonic-gate using std::fgetc; 123*7c478bd9Sstevel@tonic-gate using std::fgets; 124*7c478bd9Sstevel@tonic-gate using std::fputc; 125*7c478bd9Sstevel@tonic-gate using std::fputs; 126*7c478bd9Sstevel@tonic-gate using std::getc; 127*7c478bd9Sstevel@tonic-gate using std::getchar; 128*7c478bd9Sstevel@tonic-gate using std::gets; 129*7c478bd9Sstevel@tonic-gate using std::putc; 130*7c478bd9Sstevel@tonic-gate using std::putchar; 131*7c478bd9Sstevel@tonic-gate using std::puts; 132*7c478bd9Sstevel@tonic-gate using std::ungetc; 133*7c478bd9Sstevel@tonic-gate using std::fread; 134*7c478bd9Sstevel@tonic-gate using std::fwrite; 135*7c478bd9Sstevel@tonic-gate using std::fgetpos; 136*7c478bd9Sstevel@tonic-gate using std::fseek; 137*7c478bd9Sstevel@tonic-gate using std::fsetpos; 138*7c478bd9Sstevel@tonic-gate using std::ftell; 139*7c478bd9Sstevel@tonic-gate using std::rewind; 140*7c478bd9Sstevel@tonic-gate using std::clearerr; 141*7c478bd9Sstevel@tonic-gate using std::feof; 142*7c478bd9Sstevel@tonic-gate using std::ferror; 143*7c478bd9Sstevel@tonic-gate using std::perror; 144*7c478bd9Sstevel@tonic-gate #ifndef _LP64 145*7c478bd9Sstevel@tonic-gate using std::__filbuf; 146*7c478bd9Sstevel@tonic-gate using std::__flsbuf; 147*7c478bd9Sstevel@tonic-gate #endif /* _LP64 */ 148*7c478bd9Sstevel@tonic-gate #endif /* __cplusplus >= 199711L */ 149*7c478bd9Sstevel@tonic-gate 150*7c478bd9Sstevel@tonic-gate /* 151*7c478bd9Sstevel@tonic-gate * This header needs to be included here because it relies on the global 152*7c478bd9Sstevel@tonic-gate * visibility of FILE and size_t in the C++ environment. 153*7c478bd9Sstevel@tonic-gate */ 154*7c478bd9Sstevel@tonic-gate #include <iso/stdio_c99.h> 155*7c478bd9Sstevel@tonic-gate 156*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 157*7c478bd9Sstevel@tonic-gate extern "C" { 158*7c478bd9Sstevel@tonic-gate #endif 159*7c478bd9Sstevel@tonic-gate 160*7c478bd9Sstevel@tonic-gate #if defined(_LARGEFILE_SOURCE) || defined(_XPG5) 161*7c478bd9Sstevel@tonic-gate #ifndef _OFF_T 162*7c478bd9Sstevel@tonic-gate #define _OFF_T 163*7c478bd9Sstevel@tonic-gate #if defined(_LP64) || _FILE_OFFSET_BITS == 32 164*7c478bd9Sstevel@tonic-gate typedef long off_t; 165*7c478bd9Sstevel@tonic-gate #else 166*7c478bd9Sstevel@tonic-gate typedef __longlong_t off_t; 167*7c478bd9Sstevel@tonic-gate #endif 168*7c478bd9Sstevel@tonic-gate #ifdef _LARGEFILE64_SOURCE 169*7c478bd9Sstevel@tonic-gate #ifdef _LP64 170*7c478bd9Sstevel@tonic-gate typedef off_t off64_t; 171*7c478bd9Sstevel@tonic-gate #else 172*7c478bd9Sstevel@tonic-gate typedef __longlong_t off64_t; 173*7c478bd9Sstevel@tonic-gate #endif 174*7c478bd9Sstevel@tonic-gate #endif /* _LARGEFILE64_SOURCE */ 175*7c478bd9Sstevel@tonic-gate #endif /* _OFF_T */ 176*7c478bd9Sstevel@tonic-gate #endif /* _LARGEFILE_SOURCE */ 177*7c478bd9Sstevel@tonic-gate 178*7c478bd9Sstevel@tonic-gate #ifdef _LARGEFILE64_SOURCE 179*7c478bd9Sstevel@tonic-gate #ifdef _LP64 180*7c478bd9Sstevel@tonic-gate typedef fpos_t fpos64_t; 181*7c478bd9Sstevel@tonic-gate #else 182*7c478bd9Sstevel@tonic-gate typedef __longlong_t fpos64_t; 183*7c478bd9Sstevel@tonic-gate #endif 184*7c478bd9Sstevel@tonic-gate #endif /* _LARGEFILE64_SOURCE */ 185*7c478bd9Sstevel@tonic-gate 186*7c478bd9Sstevel@tonic-gate /* 187*7c478bd9Sstevel@tonic-gate * XPG4 requires that va_list be defined in <stdio.h> "as described in 188*7c478bd9Sstevel@tonic-gate * <stdarg.h>". ANSI-C and POSIX require that the namespace of <stdio.h> 189*7c478bd9Sstevel@tonic-gate * not be polluted with this name. 190*7c478bd9Sstevel@tonic-gate */ 191*7c478bd9Sstevel@tonic-gate #if defined(_XPG4) && !defined(_VA_LIST) 192*7c478bd9Sstevel@tonic-gate #define _VA_LIST 193*7c478bd9Sstevel@tonic-gate typedef __va_list va_list; 194*7c478bd9Sstevel@tonic-gate #endif /* defined(_XPG4 && !defined(_VA_LIST) */ 195*7c478bd9Sstevel@tonic-gate 196*7c478bd9Sstevel@tonic-gate #if defined(__EXTENSIONS__) || !defined(_STRICT_STDC) || \ 197*7c478bd9Sstevel@tonic-gate defined(__XOPEN_OR_POSIX) 198*7c478bd9Sstevel@tonic-gate 199*7c478bd9Sstevel@tonic-gate #define L_ctermid 9 200*7c478bd9Sstevel@tonic-gate 201*7c478bd9Sstevel@tonic-gate /* Marked LEGACY in SUSv2 and removed in SUSv3 */ 202*7c478bd9Sstevel@tonic-gate #if !defined(_XPG6) || defined(__EXTENSIONS__) 203*7c478bd9Sstevel@tonic-gate #define L_cuserid 9 204*7c478bd9Sstevel@tonic-gate #endif 205*7c478bd9Sstevel@tonic-gate 206*7c478bd9Sstevel@tonic-gate #endif /* defined(__EXTENSIONS__) || !defined(_STRICT_STDC) ... */ 207*7c478bd9Sstevel@tonic-gate 208*7c478bd9Sstevel@tonic-gate #if defined(__EXTENSIONS__) || \ 209*7c478bd9Sstevel@tonic-gate (!defined(_STRICT_STDC) && !defined(_POSIX_C_SOURCE)) || \ 210*7c478bd9Sstevel@tonic-gate defined(_XOPEN_SOURCE) 211*7c478bd9Sstevel@tonic-gate 212*7c478bd9Sstevel@tonic-gate #define P_tmpdir "/var/tmp/" 213*7c478bd9Sstevel@tonic-gate #endif /* defined(__EXTENSIONS__) || (!defined(_STRICT_STDC) ... */ 214*7c478bd9Sstevel@tonic-gate 215*7c478bd9Sstevel@tonic-gate #ifndef _STDIO_ALLOCATE 216*7c478bd9Sstevel@tonic-gate extern unsigned char _sibuf[], _sobuf[]; 217*7c478bd9Sstevel@tonic-gate #endif 218*7c478bd9Sstevel@tonic-gate 219*7c478bd9Sstevel@tonic-gate /* large file compilation environment setup */ 220*7c478bd9Sstevel@tonic-gate #if !defined(_LP64) && _FILE_OFFSET_BITS == 64 221*7c478bd9Sstevel@tonic-gate #if !defined(__PRAGMA_REDEFINE_EXTNAME) 222*7c478bd9Sstevel@tonic-gate #if defined(__STDC__) 223*7c478bd9Sstevel@tonic-gate extern FILE *fopen64(const char *, const char *); 224*7c478bd9Sstevel@tonic-gate extern FILE *freopen64(const char *, const char *, FILE *); 225*7c478bd9Sstevel@tonic-gate extern FILE *tmpfile64(void); 226*7c478bd9Sstevel@tonic-gate extern int fgetpos64(FILE *, fpos_t *); 227*7c478bd9Sstevel@tonic-gate extern int fsetpos64(FILE *, const fpos_t *); 228*7c478bd9Sstevel@tonic-gate #else /* defined(__STDC__) */ 229*7c478bd9Sstevel@tonic-gate extern FILE *fopen64(); 230*7c478bd9Sstevel@tonic-gate extern FILE *freopen64(); 231*7c478bd9Sstevel@tonic-gate extern FILE *tmpfile64(); 232*7c478bd9Sstevel@tonic-gate extern int fgetpos64(); 233*7c478bd9Sstevel@tonic-gate extern int fsetpos64(); 234*7c478bd9Sstevel@tonic-gate #endif /* defined(__STDC__) */ 235*7c478bd9Sstevel@tonic-gate #define fopen fopen64 236*7c478bd9Sstevel@tonic-gate #define freopen freopen64 237*7c478bd9Sstevel@tonic-gate #define tmpfile tmpfile64 238*7c478bd9Sstevel@tonic-gate #define fgetpos fgetpos64 239*7c478bd9Sstevel@tonic-gate #define fsetpos fsetpos64 240*7c478bd9Sstevel@tonic-gate #ifdef _LARGEFILE_SOURCE 241*7c478bd9Sstevel@tonic-gate #define fseeko fseeko64 242*7c478bd9Sstevel@tonic-gate #define ftello ftello64 243*7c478bd9Sstevel@tonic-gate #endif 244*7c478bd9Sstevel@tonic-gate #endif /* !__PRAGMA_REDEFINE_EXTNAME */ 245*7c478bd9Sstevel@tonic-gate #endif /* !_LP64 && _FILE_OFFSET_BITS == 64 */ 246*7c478bd9Sstevel@tonic-gate 247*7c478bd9Sstevel@tonic-gate #ifndef _LP64 248*7c478bd9Sstevel@tonic-gate extern unsigned char *_bufendtab[]; 249*7c478bd9Sstevel@tonic-gate extern FILE *_lastbuf; 250*7c478bd9Sstevel@tonic-gate #endif 251*7c478bd9Sstevel@tonic-gate 252*7c478bd9Sstevel@tonic-gate /* In the LP64 compilation environment, all APIs are already large file */ 253*7c478bd9Sstevel@tonic-gate #if defined(_LP64) && defined(_LARGEFILE64_SOURCE) 254*7c478bd9Sstevel@tonic-gate #if !defined(__PRAGMA_REDEFINE_EXTNAME) 255*7c478bd9Sstevel@tonic-gate #define fopen64 fopen 256*7c478bd9Sstevel@tonic-gate #define freopen64 freopen 257*7c478bd9Sstevel@tonic-gate #define tmpfile64 tmpfile 258*7c478bd9Sstevel@tonic-gate #define fgetpos64 fgetpos 259*7c478bd9Sstevel@tonic-gate #define fsetpos64 fsetpos 260*7c478bd9Sstevel@tonic-gate #ifdef _LARGEFILE_SOURCE 261*7c478bd9Sstevel@tonic-gate #define fseeko64 fseeko 262*7c478bd9Sstevel@tonic-gate #define ftello64 ftello 263*7c478bd9Sstevel@tonic-gate #endif 264*7c478bd9Sstevel@tonic-gate #endif /* !__PRAGMA_REDEFINE_EXTNAME */ 265*7c478bd9Sstevel@tonic-gate #endif /* _LP64 && _LARGEFILE64_SOURCE */ 266*7c478bd9Sstevel@tonic-gate 267*7c478bd9Sstevel@tonic-gate #if defined(__STDC__) 268*7c478bd9Sstevel@tonic-gate 269*7c478bd9Sstevel@tonic-gate #if defined(__EXTENSIONS__) || \ 270*7c478bd9Sstevel@tonic-gate (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \ 271*7c478bd9Sstevel@tonic-gate defined(_REENTRANT) 272*7c478bd9Sstevel@tonic-gate extern char *tmpnam_r(char *); 273*7c478bd9Sstevel@tonic-gate #endif 274*7c478bd9Sstevel@tonic-gate 275*7c478bd9Sstevel@tonic-gate #if defined(__EXTENSIONS__) || \ 276*7c478bd9Sstevel@tonic-gate (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) 277*7c478bd9Sstevel@tonic-gate extern void setbuffer(FILE *, char *, size_t); 278*7c478bd9Sstevel@tonic-gate extern int setlinebuf(FILE *); 279*7c478bd9Sstevel@tonic-gate #endif 280*7c478bd9Sstevel@tonic-gate 281*7c478bd9Sstevel@tonic-gate /* 282*7c478bd9Sstevel@tonic-gate * The following are known to POSIX and XOPEN, but not to ANSI-C. 283*7c478bd9Sstevel@tonic-gate */ 284*7c478bd9Sstevel@tonic-gate #if defined(__EXTENSIONS__) || \ 285*7c478bd9Sstevel@tonic-gate !defined(_STRICT_STDC) || defined(__XOPEN_OR_POSIX) 286*7c478bd9Sstevel@tonic-gate 287*7c478bd9Sstevel@tonic-gate extern FILE *fdopen(int, const char *); 288*7c478bd9Sstevel@tonic-gate extern char *ctermid(char *); 289*7c478bd9Sstevel@tonic-gate extern int fileno(FILE *); 290*7c478bd9Sstevel@tonic-gate 291*7c478bd9Sstevel@tonic-gate #endif /* defined(__EXTENSIONS__) || !defined(_STRICT_STDC) ... */ 292*7c478bd9Sstevel@tonic-gate 293*7c478bd9Sstevel@tonic-gate /* 294*7c478bd9Sstevel@tonic-gate * The following are known to POSIX.1c, but not to ANSI-C or XOPEN. 295*7c478bd9Sstevel@tonic-gate */ 296*7c478bd9Sstevel@tonic-gate #if defined(__EXTENSIONS__) || defined(_REENTRANT) || \ 297*7c478bd9Sstevel@tonic-gate (_POSIX_C_SOURCE - 0 >= 199506L) 298*7c478bd9Sstevel@tonic-gate extern void flockfile(FILE *); 299*7c478bd9Sstevel@tonic-gate extern int ftrylockfile(FILE *); 300*7c478bd9Sstevel@tonic-gate extern void funlockfile(FILE *); 301*7c478bd9Sstevel@tonic-gate extern int getc_unlocked(FILE *); 302*7c478bd9Sstevel@tonic-gate extern int getchar_unlocked(void); 303*7c478bd9Sstevel@tonic-gate extern int putc_unlocked(int, FILE *); 304*7c478bd9Sstevel@tonic-gate extern int putchar_unlocked(int); 305*7c478bd9Sstevel@tonic-gate 306*7c478bd9Sstevel@tonic-gate #endif /* defined(__EXTENSIONS__) || defined(_REENTRANT).. */ 307*7c478bd9Sstevel@tonic-gate 308*7c478bd9Sstevel@tonic-gate /* 309*7c478bd9Sstevel@tonic-gate * The following are known to XOPEN, but not to ANSI-C or POSIX. 310*7c478bd9Sstevel@tonic-gate */ 311*7c478bd9Sstevel@tonic-gate #if defined(__EXTENSIONS__) || !defined(_STRICT_STDC) || \ 312*7c478bd9Sstevel@tonic-gate defined(_XOPEN_SOURCE) 313*7c478bd9Sstevel@tonic-gate extern FILE *popen(const char *, const char *); 314*7c478bd9Sstevel@tonic-gate extern char *tempnam(const char *, const char *); 315*7c478bd9Sstevel@tonic-gate extern int pclose(FILE *); 316*7c478bd9Sstevel@tonic-gate #if !defined(_XOPEN_SOURCE) 317*7c478bd9Sstevel@tonic-gate extern int getsubopt(char **, char *const *, char **); 318*7c478bd9Sstevel@tonic-gate #endif /* !defined(_XOPEN_SOURCE) */ 319*7c478bd9Sstevel@tonic-gate 320*7c478bd9Sstevel@tonic-gate /* Marked LEGACY in SUSv2 and removed in SUSv3 */ 321*7c478bd9Sstevel@tonic-gate #if !defined(_XPG6) || defined(__EXTENSIONS__) 322*7c478bd9Sstevel@tonic-gate extern char *cuserid(char *); 323*7c478bd9Sstevel@tonic-gate extern int getopt(int, char *const *, const char *); 324*7c478bd9Sstevel@tonic-gate extern char *optarg; 325*7c478bd9Sstevel@tonic-gate extern int optind, opterr, optopt; 326*7c478bd9Sstevel@tonic-gate extern int getw(FILE *); 327*7c478bd9Sstevel@tonic-gate extern int putw(int, FILE *); 328*7c478bd9Sstevel@tonic-gate #endif /* !defined(_XPG6) || defined(__EXTENSIONS__) */ 329*7c478bd9Sstevel@tonic-gate 330*7c478bd9Sstevel@tonic-gate #endif /* defined(__EXTENSIONS__) || !defined(_STRICT_STDC) ... */ 331*7c478bd9Sstevel@tonic-gate 332*7c478bd9Sstevel@tonic-gate /* 333*7c478bd9Sstevel@tonic-gate * The following are defined as part of the Large File Summit interfaces. 334*7c478bd9Sstevel@tonic-gate */ 335*7c478bd9Sstevel@tonic-gate #if defined(_LARGEFILE_SOURCE) || defined(_XPG5) 336*7c478bd9Sstevel@tonic-gate extern int fseeko(FILE *, off_t, int); 337*7c478bd9Sstevel@tonic-gate extern off_t ftello(FILE *); 338*7c478bd9Sstevel@tonic-gate #endif 339*7c478bd9Sstevel@tonic-gate 340*7c478bd9Sstevel@tonic-gate /* 341*7c478bd9Sstevel@tonic-gate * The following are defined as part of the transitional Large File Summit 342*7c478bd9Sstevel@tonic-gate * interfaces. 343*7c478bd9Sstevel@tonic-gate */ 344*7c478bd9Sstevel@tonic-gate #if defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \ 345*7c478bd9Sstevel@tonic-gate !defined(__PRAGMA_REDEFINE_EXTNAME)) 346*7c478bd9Sstevel@tonic-gate extern FILE *fopen64(const char *, const char *); 347*7c478bd9Sstevel@tonic-gate extern FILE *freopen64(const char *, const char *, FILE *); 348*7c478bd9Sstevel@tonic-gate extern FILE *tmpfile64(void); 349*7c478bd9Sstevel@tonic-gate extern int fgetpos64(FILE *, fpos64_t *); 350*7c478bd9Sstevel@tonic-gate extern int fsetpos64(FILE *, const fpos64_t *); 351*7c478bd9Sstevel@tonic-gate extern int fseeko64(FILE *, off64_t, int); 352*7c478bd9Sstevel@tonic-gate extern off64_t ftello64(FILE *); 353*7c478bd9Sstevel@tonic-gate #endif 354*7c478bd9Sstevel@tonic-gate 355*7c478bd9Sstevel@tonic-gate #else /* !defined __STDC__ */ 356*7c478bd9Sstevel@tonic-gate 357*7c478bd9Sstevel@tonic-gate #ifndef _LP64 358*7c478bd9Sstevel@tonic-gate #define _bufend(p) ((fileno(p) < _NFILE) ? _bufendtab[fileno(p)] : \ 359*7c478bd9Sstevel@tonic-gate (unsigned char *)_realbufend(p)) 360*7c478bd9Sstevel@tonic-gate #define _bufsiz(p) (_bufend(p) - (p)->_base) 361*7c478bd9Sstevel@tonic-gate #endif /* _LP64 */ 362*7c478bd9Sstevel@tonic-gate 363*7c478bd9Sstevel@tonic-gate #if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) || \ 364*7c478bd9Sstevel@tonic-gate defined(_REENTRANT) 365*7c478bd9Sstevel@tonic-gate extern char *tmpnam_r(); 366*7c478bd9Sstevel@tonic-gate #endif 367*7c478bd9Sstevel@tonic-gate 368*7c478bd9Sstevel@tonic-gate #if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) 369*7c478bd9Sstevel@tonic-gate extern void setbuffer(); 370*7c478bd9Sstevel@tonic-gate extern int setlinebuf(); 371*7c478bd9Sstevel@tonic-gate #endif 372*7c478bd9Sstevel@tonic-gate 373*7c478bd9Sstevel@tonic-gate #if defined(__EXTENSIONS__) || defined(__XOPEN_OR_POSIX) 374*7c478bd9Sstevel@tonic-gate extern FILE *fdopen(); 375*7c478bd9Sstevel@tonic-gate extern char *ctermid(); 376*7c478bd9Sstevel@tonic-gate extern int fileno(); 377*7c478bd9Sstevel@tonic-gate #endif /* defined(__EXTENSIONS__) || defined(__XOPEN_OR_POSIX) */ 378*7c478bd9Sstevel@tonic-gate 379*7c478bd9Sstevel@tonic-gate #if defined(__EXTENSIONS__) || defined(_REENTRANT) || \ 380*7c478bd9Sstevel@tonic-gate (_POSIX_C_SOURCE - 0 >= 199506L) 381*7c478bd9Sstevel@tonic-gate extern void flockfile(); 382*7c478bd9Sstevel@tonic-gate extern int ftrylockfile(); 383*7c478bd9Sstevel@tonic-gate extern void funlockfile(); 384*7c478bd9Sstevel@tonic-gate extern int getc_unlocked(); 385*7c478bd9Sstevel@tonic-gate extern int getchar_unlocked(); 386*7c478bd9Sstevel@tonic-gate extern int putc_unlocked(); 387*7c478bd9Sstevel@tonic-gate extern int putchar_unlocked(); 388*7c478bd9Sstevel@tonic-gate #endif /* defined(__EXTENSIONS__) || defined(_REENTRANT).. */ 389*7c478bd9Sstevel@tonic-gate 390*7c478bd9Sstevel@tonic-gate #if defined(__EXTENSIONS__) || defined(_XOPEN_SOURCE) 391*7c478bd9Sstevel@tonic-gate extern FILE *popen(); 392*7c478bd9Sstevel@tonic-gate extern char *tempnam(); 393*7c478bd9Sstevel@tonic-gate extern int pclose(); 394*7c478bd9Sstevel@tonic-gate 395*7c478bd9Sstevel@tonic-gate #if !defined(_XOPEN_SOURCE) 396*7c478bd9Sstevel@tonic-gate extern int getsubopt(); 397*7c478bd9Sstevel@tonic-gate #endif /* !defined(_XOPEN_SOURCE) */ 398*7c478bd9Sstevel@tonic-gate 399*7c478bd9Sstevel@tonic-gate #if !defined(_XPG6) || defined(__EXTENSIONS__) 400*7c478bd9Sstevel@tonic-gate extern char *cuserid(); 401*7c478bd9Sstevel@tonic-gate extern int getopt(); 402*7c478bd9Sstevel@tonic-gate extern char *optarg; 403*7c478bd9Sstevel@tonic-gate extern int optind, opterr, optopt; 404*7c478bd9Sstevel@tonic-gate extern int getw(); 405*7c478bd9Sstevel@tonic-gate extern int putw(); 406*7c478bd9Sstevel@tonic-gate #endif /* !defined(_XPG6) || defined(__EXTENSIONS__) */ 407*7c478bd9Sstevel@tonic-gate 408*7c478bd9Sstevel@tonic-gate #endif /* defined(__EXTENSIONS__) || defined(_XOPEN_SOURCE) */ 409*7c478bd9Sstevel@tonic-gate 410*7c478bd9Sstevel@tonic-gate #if defined(_LARGEFILE_SOURCE) || defined(_XPG5) 411*7c478bd9Sstevel@tonic-gate extern int fseeko(); 412*7c478bd9Sstevel@tonic-gate extern off_t ftello(); 413*7c478bd9Sstevel@tonic-gate #endif 414*7c478bd9Sstevel@tonic-gate 415*7c478bd9Sstevel@tonic-gate #if defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \ 416*7c478bd9Sstevel@tonic-gate !defined(__PRAGMA_REDEFINE_EXTNAME)) 417*7c478bd9Sstevel@tonic-gate extern FILE *fopen64(); 418*7c478bd9Sstevel@tonic-gate extern FILE *freopen64(); 419*7c478bd9Sstevel@tonic-gate extern FILE *tmpfile64(); 420*7c478bd9Sstevel@tonic-gate extern int fgetpos64(); 421*7c478bd9Sstevel@tonic-gate extern int fsetpos64(); 422*7c478bd9Sstevel@tonic-gate extern int fseeko64(); 423*7c478bd9Sstevel@tonic-gate extern off64_t ftello64(); 424*7c478bd9Sstevel@tonic-gate #endif 425*7c478bd9Sstevel@tonic-gate 426*7c478bd9Sstevel@tonic-gate #endif /* __STDC__ */ 427*7c478bd9Sstevel@tonic-gate 428*7c478bd9Sstevel@tonic-gate #if !defined(__lint) 429*7c478bd9Sstevel@tonic-gate 430*7c478bd9Sstevel@tonic-gate #if defined(__EXTENSIONS__) || defined(_REENTRANT) || \ 431*7c478bd9Sstevel@tonic-gate (_POSIX_C_SOURCE - 0 >= 199506L) 432*7c478bd9Sstevel@tonic-gate #ifndef _LP64 433*7c478bd9Sstevel@tonic-gate #ifdef __STDC__ 434*7c478bd9Sstevel@tonic-gate #define getc_unlocked(p) (--(p)->_cnt < 0 \ 435*7c478bd9Sstevel@tonic-gate ? __filbuf(p) \ 436*7c478bd9Sstevel@tonic-gate : (int)*(p)->_ptr++) 437*7c478bd9Sstevel@tonic-gate #define putc_unlocked(x, p) (--(p)->_cnt < 0 \ 438*7c478bd9Sstevel@tonic-gate ? __flsbuf((x), (p)) \ 439*7c478bd9Sstevel@tonic-gate : (int)(*(p)->_ptr++ = \ 440*7c478bd9Sstevel@tonic-gate (unsigned char) (x))) 441*7c478bd9Sstevel@tonic-gate #else 442*7c478bd9Sstevel@tonic-gate #define getc_unlocked(p) (--(p)->_cnt < 0 \ 443*7c478bd9Sstevel@tonic-gate ? _filbuf(p) \ 444*7c478bd9Sstevel@tonic-gate : (int)*(p)->_ptr++) 445*7c478bd9Sstevel@tonic-gate #define putc_unlocked(x, p) (--(p)->_cnt < 0 \ 446*7c478bd9Sstevel@tonic-gate ? _flsbuf((x), (p)) \ 447*7c478bd9Sstevel@tonic-gate : (int)(*(p)->_ptr++ = \ 448*7c478bd9Sstevel@tonic-gate (unsigned char) (x))) 449*7c478bd9Sstevel@tonic-gate #endif /* __STDC__ */ 450*7c478bd9Sstevel@tonic-gate #endif /* _LP64 */ 451*7c478bd9Sstevel@tonic-gate #define getchar_unlocked() getc_unlocked(stdin) 452*7c478bd9Sstevel@tonic-gate #define putchar_unlocked(x) putc_unlocked((x), stdout) 453*7c478bd9Sstevel@tonic-gate #endif /* defined(__EXTENSIONS__) || defined(_REENTRANT).. */ 454*7c478bd9Sstevel@tonic-gate 455*7c478bd9Sstevel@tonic-gate #endif /* !defined(__lint) */ 456*7c478bd9Sstevel@tonic-gate 457*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 458*7c478bd9Sstevel@tonic-gate } 459*7c478bd9Sstevel@tonic-gate #endif 460*7c478bd9Sstevel@tonic-gate 461*7c478bd9Sstevel@tonic-gate #endif /* _STDIO_H */ 462