--- mstools/h/stdio.h 2018/08/09 18:20:01 1.1 +++ mstools/h/stdio.h 2018/08/09 18:20:32 1.1.1.2 @@ -1,7 +1,7 @@ /*** *stdio.h - definitions/declarations for standard I/O routines * -* Copyright (c) 1985-1991, Microsoft Corporation. All rights reserved. +* Copyright (c) 1985-1992, Microsoft Corporation. All rights reserved. * *Purpose: * This file defines the structures, values, macros, and functions @@ -17,15 +17,22 @@ extern "C" { #endif +#ifndef MIPS #if (_MSC_VER <= 600) #define __cdecl _cdecl #endif +#endif #ifndef _SIZE_T_DEFINED typedef unsigned int size_t; #define _SIZE_T_DEFINED #endif +#ifndef _WCHAR_T_DEFINED +typedef unsigned short wchar_t; +#define _WCHAR_T_DEFINED +#endif + #ifndef _VA_LIST_DEFINED typedef char * va_list; #define _VA_LIST_DEFINED @@ -35,11 +42,19 @@ typedef char * va_list; /* buffered I/O macros */ #define BUFSIZ 512 + +/* + * Number of supported streams. _NFILE is confusing and obsolete, but + * supported anyway for backwards compatibility. + */ +#define _NFILE _NSTREAM_ #ifdef _MT -#define _NFILE 40 +#define _NSTREAM_ 40 #else -#define _NFILE 20 +#define _NSTREAM_ 20 #endif + + #define EOF (-1) #ifndef _FILE_DEFINED @@ -51,21 +66,22 @@ struct _iobuf { int _file; int _charbuf; int _bufsiz; - int __tmpnum; + char *_tmpfname; }; typedef struct _iobuf FILE; #define _FILE_DEFINED #endif -/* P_tmpnam: Directory where temporary files may be created. - * L_tmpnam size = size of P_tmpdir - * + 1 (in case P_tmpdir does not end in "\\") - * + 6 (for the temp number string) - * + 1 (for the null terminator) +/* Directory where temporary files may be created. */ +#define _P_tmpdir "\\" + +/* L_tmpnam = size of P_tmpdir + * + 1 (in case P_tmpdir does not end in "\\") + * + 12 (for the filename string) + * + 1 (for the null terminator) */ +#define L_tmpnam sizeof(_P_tmpdir)+12 -#define _P_tmpdir "\\" -#define L_tmpnam sizeof(_P_tmpdir)+8 #define SEEK_CUR 1 #define SEEK_END 2 @@ -91,8 +107,12 @@ typedef struct _iobuf FILE; /* declare _iob[] array */ #ifndef _STDIO_DEFINED +#ifdef _DLL +extern FILE * _iob; +#else extern FILE _iob[]; #endif +#endif /* define file position type */ @@ -120,18 +140,30 @@ typedef long fpos_t; #define _IOERR 0x0020 #define _IOSTRG 0x0040 #define _IORW 0x0080 - +#ifdef _POSIX_ +#define _IOAPPEND 0x0100 +#endif /* function prototypes */ #ifndef _STDIO_DEFINED int _filbuf(FILE *); int _flsbuf(int, FILE *); + +#ifdef _POSIX_ +FILE * _fsopen(const char *, const char *); +#else FILE * _fsopen(const char *, const char *, int); +#endif + void clearerr(FILE *); int fclose(FILE *); int _fcloseall(void); +#ifdef _POSIX_ +FILE * fdopen(int, const char *); +#else FILE * _fdopen(int, const char *); +#endif int feof(FILE *); int ferror(FILE *); int fflush(FILE *); @@ -139,7 +171,11 @@ int fgetc(FILE *); int _fgetchar(void); int fgetpos(FILE *, fpos_t *); char * fgets(char *, int, FILE *); +#ifdef _POSIX_ +int fileno(FILE *); +#else int _fileno(FILE *); +#endif int _flushall(void); FILE * fopen(const char *, const char *); int fprintf(FILE *, const char *, ...); @@ -184,6 +220,20 @@ int vfprintf(FILE *, const char *, va_li int vprintf(const char *, va_list); int _vsnprintf(char *, size_t, const char *, va_list); int vsprintf(char *, const char *, va_list); +#ifndef __STDC__ +#ifndef _WSTDIO_DEFINED +/* declared in wchar.h, officially */ +int fwprintf(FILE *, const wchar_t *, ...); +int wprintf(const wchar_t *, ...); +int _snwprintf(wchar_t *, size_t, const wchar_t *, ...); +int swprintf(wchar_t *, const wchar_t *, ...); +int vfwprintf(FILE *, const wchar_t *, va_list); +int vwprintf(const wchar_t *, va_list); +int _vsnwprintf(wchar_t *, size_t, const wchar_t *, va_list); +int vswprintf(wchar_t *, const wchar_t *, va_list); +#define _WSTDIO_DEFINED +#endif +#endif /* !__STDC__ */ #define _STDIO_DEFINED #endif @@ -207,7 +257,7 @@ int vsprintf(char *, const char *, va_li #undef putchar #endif -#if !__STDC__ +#if !__STDC__ && !defined(_POSIX_) /* Non-ANSI names for compatibility */ #define P_tmpdir _P_tmpdir