Print this page
remove support for non-ANSI compilation


   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 2005 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.
  25  */
  26 
  27 /*      Copyright (c) 1988 AT&T     */
  28 /*        All Rights Reserved   */
  29 
  30 /*
  31  * An application should not include this header directly.  Instead it
  32  * should be included only through the inclusion of other Sun headers.
  33  *
  34  * The contents of this header is limited to identifiers specified in the
  35  * C Standard.  Any new identifiers specified in future amendments to the
  36  * C Standard must be placed in this header.  If these new identifiers
  37  * are required to also be in the C++ Standard "std" namespace, then for
  38  * anything other than macro definitions, corresponding "using" directives
  39  * must also be added to <stdio.h>.
  40  */
  41 
  42 /*


 140 
 141 #define _IOREAD         0001    /* currently reading */
 142 #define _IOWRT          0002    /* currently writing */
 143 #define _IORW           0200    /* opened for reading and writing */
 144 #define _IOMYBUF        0010    /* stdio malloc()'d buffer */
 145 
 146 #ifndef EOF
 147 #define EOF     (-1)
 148 #endif
 149 
 150 #define FOPEN_MAX       _NFILE
 151 #define FILENAME_MAX    1024    /* max # of characters in a path name */
 152 
 153 #define SEEK_SET        0
 154 #define SEEK_CUR        1
 155 #define SEEK_END        2
 156 #define TMP_MAX         17576   /* 26 * 26 * 26 */
 157 
 158 #define L_tmpnam        25      /* (sizeof(P_tmpdir) + 15) */
 159 
 160 #if defined(__STDC__)
 161 extern __FILE   __iob[_NFILE];
 162 #define stdin   (&__iob[0])
 163 #define stdout  (&__iob[1])
 164 #define stderr  (&__iob[2])
 165 #else
 166 extern __FILE   _iob[_NFILE];
 167 #define stdin   (&_iob[0])
 168 #define stdout  (&_iob[1])
 169 #define stderr  (&_iob[2])
 170 #endif  /* __STDC__ */
 171 
 172 #if __cplusplus >= 199711L
 173 namespace std {
 174 #endif
 175 
 176 #if !defined(_LP64) && !defined(_LONGLONG_TYPE)
 177 
 178 #ifdef __PRAGMA_REDEFINE_EXTNAME
 179 #pragma redefine_extname fprintf        _fprintf_c89
 180 #pragma redefine_extname printf         _printf_c89
 181 #pragma redefine_extname sprintf        _sprintf_c89
 182 #pragma redefine_extname vfprintf       _vfprintf_c89
 183 #pragma redefine_extname vprintf        _vprintf_c89
 184 #pragma redefine_extname vsprintf       _vsprintf_c89
 185 #pragma redefine_extname fscanf         _fscanf_c89
 186 #pragma redefine_extname scanf          _scanf_c89
 187 #pragma redefine_extname sscanf         _sscanf_c89
 188 #else
 189 #define fprintf         _fprintf_c89
 190 #define printf          _printf_c89
 191 #define sprintf         _sprintf_c89
 192 #define vfprintf        _vfprintf_c89
 193 #define vprintf         _vprintf_c89
 194 #define vsprintf        _vsprintf_c89
 195 #define fscanf          _fscanf_c89
 196 #define scanf           _scanf_c89
 197 #define sscanf          _sscanf_c89
 198 #endif
 199 
 200 #endif /* !defined(_LP64) && !defined(_LONGLONG_TYPE) */
 201 
 202 #if defined(__STDC__)
 203 
 204 extern int      remove(const char *);
 205 extern int      rename(const char *, const char *);
 206 extern FILE     *tmpfile(void);
 207 extern char     *tmpnam(char *);
 208 extern int      fclose(FILE *);
 209 extern int      fflush(FILE *);
 210 extern FILE     *fopen(const char *_RESTRICT_KYWD, const char *_RESTRICT_KYWD);
 211 extern FILE     *freopen(const char *_RESTRICT_KYWD,
 212                         const char *_RESTRICT_KYWD, FILE *_RESTRICT_KYWD);
 213 extern void     setbuf(FILE *_RESTRICT_KYWD, char *_RESTRICT_KYWD);
 214 extern int      setvbuf(FILE *_RESTRICT_KYWD, char *_RESTRICT_KYWD, int,
 215                         size_t);
 216 /* PRINTFLIKE2 */
 217 extern int      fprintf(FILE *_RESTRICT_KYWD, const char *_RESTRICT_KYWD, ...);
 218 /* SCANFLIKE2 */
 219 extern int      fscanf(FILE *_RESTRICT_KYWD, const char *_RESTRICT_KYWD, ...);
 220 /* PRINTFLIKE1 */
 221 extern int      printf(const char *_RESTRICT_KYWD, ...);
 222 /* SCANFLIKE1 */
 223 extern int      scanf(const char *_RESTRICT_KYWD, ...);


 255 #if !defined(__lint) || defined(_LP64) || _FILE_OFFSET_BITS == 32
 256 extern int      fgetpos(FILE *_RESTRICT_KYWD, fpos_t *_RESTRICT_KYWD);
 257 extern int      fsetpos(FILE *, const fpos_t *);
 258 #endif
 259 extern int      fseek(FILE *, long, int);
 260 extern long     ftell(FILE *);
 261 extern void     rewind(FILE *);
 262 #if (__cplusplus >= 199711L && (defined(_LP64) || defined(_REENTRANT))) || \
 263         __cplusplus < 199711L
 264 extern void     clearerr(FILE *);
 265 extern int      feof(FILE *);
 266 extern int      ferror(FILE *);
 267 #endif
 268 extern void     perror(const char *);
 269 
 270 #ifndef _LP64
 271 extern int      __filbuf(FILE *);
 272 extern int      __flsbuf(int, FILE *);
 273 #endif  /*      _LP64   */
 274 
 275 #else   /* !defined __STDC__ */
 276 
 277 extern int      remove();
 278 extern int      rename();
 279 extern FILE     *tmpfile();
 280 extern char     *tmpnam();
 281 extern int      fclose();
 282 extern int      fflush();
 283 extern FILE     *fopen();
 284 extern FILE     *freopen();
 285 extern void     setbuf();
 286 extern int      setvbuf();
 287 extern int      fprintf();
 288 extern int      fscanf();
 289 extern int      printf();
 290 extern int      scanf();
 291 extern int      sprintf();
 292 extern int      sscanf();
 293 extern int      vfprintf();
 294 extern int      vprintf();
 295 extern int      vsprintf();
 296 extern int      fgetc();
 297 extern char     *fgets();
 298 extern int      fputc();
 299 extern int      fputs();
 300 extern int      getc();
 301 extern int      getchar();
 302 extern char     *gets();
 303 extern int      putc();
 304 extern int      putchar();
 305 extern int      puts();
 306 extern int      ungetc();
 307 extern size_t   fread();
 308 extern size_t   fwrite();
 309 extern int      fgetpos();
 310 extern int      fseek();
 311 extern int      fsetpos();
 312 extern long     ftell();
 313 extern void     rewind();
 314 extern void     clearerr();
 315 extern int      feof();
 316 extern int      ferror();
 317 extern void     perror();
 318 
 319 #ifndef _LP64
 320 extern int      _filbuf();
 321 extern int      _flsbuf();
 322 #endif  /*      _LP64   */
 323 
 324 #endif  /* __STDC__ */
 325 
 326 #if __cplusplus >= 199711L
 327 }
 328 #endif /* end of namespace std */
 329 
 330 #if !defined(__lint)
 331 
 332 #if     !defined(_REENTRANT) && !defined(_LP64)
 333 
 334 #ifdef  __STDC__
 335 #if __cplusplus >= 199711L
 336 namespace std {
 337 inline int getc(FILE *_p) {
 338         return (--_p->_cnt < 0 ? __filbuf(_p) : (int)*_p->_ptr++); }
 339 inline int putc(int _x, FILE *_p) {
 340         return (--_p->_cnt < 0 ? __flsbuf(_x, _p)
 341                 : (int)(*_p->_ptr++ = (unsigned char) _x)); }
 342 }
 343 #else /* __cplusplus >= 199711L */
 344 #define getc(p)         (--(p)->_cnt < 0 ? __filbuf(p) : (int)*(p)->_ptr++)
 345 #define putc(x, p)      (--(p)->_cnt < 0 ? __flsbuf((x), (p)) \
 346                                 : (int)(*(p)->_ptr++ = (unsigned char) (x)))
 347 #endif /* __cplusplus >= 199711L */
 348 #else /* __STDC__ */
 349 #define getc(p)         (--(p)->_cnt < 0 ? _filbuf(p) : (int)*(p)->_ptr++)
 350 #define putc(x, p)      (--(p)->_cnt < 0 ? _flsbuf((x), (p)) : \
 351                                 (int)(*(p)->_ptr++ = (unsigned char) (x)))
 352 #endif  /* __STDC__ */
 353 
 354 #endif /* !defined(_REENTRANT) && !defined(_LP64) */
 355 
 356 #ifndef _REENTRANT
 357 
 358 #if __cplusplus >= 199711L
 359 namespace std {
 360 inline int getchar() { return getc(stdin); }
 361 inline int putchar(int _x) { return putc(_x, stdout); }
 362 }
 363 #else
 364 #define getchar()       getc(stdin)
 365 #define putchar(x)      putc((x), stdout)
 366 #endif /* __cplusplus >= 199711L */
 367 
 368 #ifndef _LP64
 369 #if __cplusplus >= 199711L
 370 namespace std {
 371 inline void clearerr(FILE *_p) { _p->_flag &= ~(_IOERR | _IOEOF); }
 372 inline int feof(FILE *_p) { return _p->_flag & _IOEOF; }


   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 2014 Garrett D'Amore <garrett@damore.org>
  24  *
  25  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
  26  * Use is subject to license terms.
  27  */
  28 
  29 /*      Copyright (c) 1988 AT&T     */
  30 /*        All Rights Reserved   */
  31 
  32 /*
  33  * An application should not include this header directly.  Instead it
  34  * should be included only through the inclusion of other Sun headers.
  35  *
  36  * The contents of this header is limited to identifiers specified in the
  37  * C Standard.  Any new identifiers specified in future amendments to the
  38  * C Standard must be placed in this header.  If these new identifiers
  39  * are required to also be in the C++ Standard "std" namespace, then for
  40  * anything other than macro definitions, corresponding "using" directives
  41  * must also be added to <stdio.h>.
  42  */
  43 
  44 /*


 142 
 143 #define _IOREAD         0001    /* currently reading */
 144 #define _IOWRT          0002    /* currently writing */
 145 #define _IORW           0200    /* opened for reading and writing */
 146 #define _IOMYBUF        0010    /* stdio malloc()'d buffer */
 147 
 148 #ifndef EOF
 149 #define EOF     (-1)
 150 #endif
 151 
 152 #define FOPEN_MAX       _NFILE
 153 #define FILENAME_MAX    1024    /* max # of characters in a path name */
 154 
 155 #define SEEK_SET        0
 156 #define SEEK_CUR        1
 157 #define SEEK_END        2
 158 #define TMP_MAX         17576   /* 26 * 26 * 26 */
 159 
 160 #define L_tmpnam        25      /* (sizeof(P_tmpdir) + 15) */
 161 

 162 extern __FILE   __iob[_NFILE];
 163 #define stdin   (&__iob[0])
 164 #define stdout  (&__iob[1])
 165 #define stderr  (&__iob[2])






 166 
 167 #if __cplusplus >= 199711L
 168 namespace std {
 169 #endif
 170 
 171 #if !defined(_LP64) && !defined(_LONGLONG_TYPE)
 172 
 173 #ifdef __PRAGMA_REDEFINE_EXTNAME
 174 #pragma redefine_extname fprintf        _fprintf_c89
 175 #pragma redefine_extname printf         _printf_c89
 176 #pragma redefine_extname sprintf        _sprintf_c89
 177 #pragma redefine_extname vfprintf       _vfprintf_c89
 178 #pragma redefine_extname vprintf        _vprintf_c89
 179 #pragma redefine_extname vsprintf       _vsprintf_c89
 180 #pragma redefine_extname fscanf         _fscanf_c89
 181 #pragma redefine_extname scanf          _scanf_c89
 182 #pragma redefine_extname sscanf         _sscanf_c89
 183 #else
 184 #define fprintf         _fprintf_c89
 185 #define printf          _printf_c89
 186 #define sprintf         _sprintf_c89
 187 #define vfprintf        _vfprintf_c89
 188 #define vprintf         _vprintf_c89
 189 #define vsprintf        _vsprintf_c89
 190 #define fscanf          _fscanf_c89
 191 #define scanf           _scanf_c89
 192 #define sscanf          _sscanf_c89
 193 #endif
 194 
 195 #endif /* !defined(_LP64) && !defined(_LONGLONG_TYPE) */
 196 


 197 extern int      remove(const char *);
 198 extern int      rename(const char *, const char *);
 199 extern FILE     *tmpfile(void);
 200 extern char     *tmpnam(char *);
 201 extern int      fclose(FILE *);
 202 extern int      fflush(FILE *);
 203 extern FILE     *fopen(const char *_RESTRICT_KYWD, const char *_RESTRICT_KYWD);
 204 extern FILE     *freopen(const char *_RESTRICT_KYWD,
 205                         const char *_RESTRICT_KYWD, FILE *_RESTRICT_KYWD);
 206 extern void     setbuf(FILE *_RESTRICT_KYWD, char *_RESTRICT_KYWD);
 207 extern int      setvbuf(FILE *_RESTRICT_KYWD, char *_RESTRICT_KYWD, int,
 208                         size_t);
 209 /* PRINTFLIKE2 */
 210 extern int      fprintf(FILE *_RESTRICT_KYWD, const char *_RESTRICT_KYWD, ...);
 211 /* SCANFLIKE2 */
 212 extern int      fscanf(FILE *_RESTRICT_KYWD, const char *_RESTRICT_KYWD, ...);
 213 /* PRINTFLIKE1 */
 214 extern int      printf(const char *_RESTRICT_KYWD, ...);
 215 /* SCANFLIKE1 */
 216 extern int      scanf(const char *_RESTRICT_KYWD, ...);


 248 #if !defined(__lint) || defined(_LP64) || _FILE_OFFSET_BITS == 32
 249 extern int      fgetpos(FILE *_RESTRICT_KYWD, fpos_t *_RESTRICT_KYWD);
 250 extern int      fsetpos(FILE *, const fpos_t *);
 251 #endif
 252 extern int      fseek(FILE *, long, int);
 253 extern long     ftell(FILE *);
 254 extern void     rewind(FILE *);
 255 #if (__cplusplus >= 199711L && (defined(_LP64) || defined(_REENTRANT))) || \
 256         __cplusplus < 199711L
 257 extern void     clearerr(FILE *);
 258 extern int      feof(FILE *);
 259 extern int      ferror(FILE *);
 260 #endif
 261 extern void     perror(const char *);
 262 
 263 #ifndef _LP64
 264 extern int      __filbuf(FILE *);
 265 extern int      __flsbuf(int, FILE *);
 266 #endif  /*      _LP64   */
 267 



















































 268 #if __cplusplus >= 199711L
 269 }
 270 #endif /* end of namespace std */
 271 
 272 #if !defined(__lint)
 273 
 274 #if     !defined(_REENTRANT) && !defined(_LP64)
 275 

 276 #if __cplusplus >= 199711L
 277 namespace std {
 278 inline int getc(FILE *_p) {
 279         return (--_p->_cnt < 0 ? __filbuf(_p) : (int)*_p->_ptr++); }
 280 inline int putc(int _x, FILE *_p) {
 281         return (--_p->_cnt < 0 ? __flsbuf(_x, _p)
 282                 : (int)(*_p->_ptr++ = (unsigned char) _x)); }
 283 }
 284 #else /* __cplusplus >= 199711L */
 285 #define getc(p)         (--(p)->_cnt < 0 ? __filbuf(p) : (int)*(p)->_ptr++)
 286 #define putc(x, p)      (--(p)->_cnt < 0 ? __flsbuf((x), (p)) \
 287                                 : (int)(*(p)->_ptr++ = (unsigned char) (x)))
 288 #endif /* __cplusplus >= 199711L */





 289 
 290 #endif /* !defined(_REENTRANT) && !defined(_LP64) */
 291 
 292 #ifndef _REENTRANT
 293 
 294 #if __cplusplus >= 199711L
 295 namespace std {
 296 inline int getchar() { return getc(stdin); }
 297 inline int putchar(int _x) { return putc(_x, stdout); }
 298 }
 299 #else
 300 #define getchar()       getc(stdin)
 301 #define putchar(x)      putc((x), stdout)
 302 #endif /* __cplusplus >= 199711L */
 303 
 304 #ifndef _LP64
 305 #if __cplusplus >= 199711L
 306 namespace std {
 307 inline void clearerr(FILE *_p) { _p->_flag &= ~(_IOERR | _IOEOF); }
 308 inline int feof(FILE *_p) { return _p->_flag & _IOEOF; }