| 1 | /* | 
 
 
 
 
 | 2 | * io.h | 
 
 
 
 
 | 3 | * | 
 
 
 
 
 | 4 | * System level I/O functions and types. | 
 
 
 
 
 | 5 | * | 
 
 
 
 
 | 6 | * $Id: io.h,v 0e4f78dbc1ba 2016/06/17 14:16:01 keithmarshall $ | 
 
 
 
 
 | 7 | * | 
 
 
 
 
 | 8 | * Written by Colin Peters <colin@bird.fu.is.saga-u.ac.jp> | 
 
 
 
 
 | 9 | * Copyright (C) 1997-2004, 2007, 2009, 2010, 2014-2016, MinGW.org Project. | 
 
 
 
 
 | 10 | * | 
 
 
 
 
 | 11 | * | 
 
 
 
 
 | 12 | * Permission is hereby granted, free of charge, to any person obtaining a | 
 
 
 
 
 | 13 | * copy of this software and associated documentation files (the "Software"), | 
 
 
 
 
 | 14 | * to deal in the Software without restriction, including without limitation | 
 
 
 
 
 | 15 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | 
 
 
 
 
 | 16 | * and/or sell copies of the Software, and to permit persons to whom the | 
 
 
 
 
 | 17 | * Software is furnished to do so, subject to the following conditions: | 
 
 
 
 
 | 18 | * | 
 
 
 
 
 | 19 | * The above copyright notice, this permission notice, and the following | 
 
 
 
 
 | 20 | * disclaimer shall be included in all copies or substantial portions of | 
 
 
 
 
 | 21 | * the Software. | 
 
 
 
 
 | 22 | * | 
 
 
 
 
 | 23 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | 
 
 
 
 
 | 24 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 
 
 
 
 
 | 25 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL | 
 
 
 
 
 | 26 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | 
 
 
 
 
 | 27 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | 
 
 
 
 
 | 28 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OF OR OTHER | 
 
 
 
 
 | 29 | * DEALINGS IN THE SOFTWARE. | 
 
 
 
 
 | 30 | * | 
 
 
 
 
 | 31 | * | 
 
 
 
 
 | 32 | * NOTE: The file manipulation functions provided by Microsoft seem to | 
 
 
 
 
 | 33 | * work with either slash (/) or backslash (\) as the directory separator; | 
 
 
 
 
 | 34 | * (this is consistent with Microsoft's own documentation, on MSDN). | 
 
 
 
 
 | 35 | * | 
 
 
 
 
 | 36 | */ | 
 
 
 
 
 | 37 | #ifndef _IO_H | 
 
 
 
 
 | 38 | #pragma GCC system_header | 
 
 
 
 
 | 39 |  | 
 
 
 
 
 | 40 | /* Defer definition of the _IO_H multiple inclusion guard, to allow | 
 
 
 
 
 | 41 | * for selective inclusion by <wchar.h>, (in which case we should | 
 
 
 
 
 | 42 | * NOT define it). | 
 
 
 
 
 | 43 | */ | 
 
 
 
 
 | 44 | #ifndef __WCHAR_H_SOURCED__ | 
 
 
 
 
 | 45 | #define _IO_H | 
 
 
 
 
 | 46 |  | 
 
 
 
 
 | 47 | /* All MinGW headers must include <_mingw.h>; we may do it here, | 
 
 
 
 
 | 48 | * assuming that <wchar.h> will have already take care to do so in | 
 
 
 
 
 | 49 | * the selective inclusion case. | 
 
 
 
 
 | 50 | */ | 
 
 
 
 
 | 51 | #include <_mingw.h> | 
 
 
 
 
 | 52 |  | 
 
 
 
 
 | 53 | /* We also need time_t, and off_t, (and their variants); although | 
 
 
 
 
 | 54 | * it gives us more than we really need, this will provide them... | 
 
 
 
 
 | 55 | */ | 
 
 
 
 
 | 56 | #include <sys/types.h> | 
 
 
 
 
 | 57 |  | 
 
 
 
 
 | 58 | #endif  /* !__WCHAR_H_SOURCED__ */ | 
 
 
 
 
 | 59 |  | 
 
 
 
 
 | 60 | /* This will give us intptr_t, which we need in ALL cases, whether | 
 
 
 
 
 | 61 | * including <io.h> directly, or selectively via <wchar.h>; (note: we | 
 
 
 
 
 | 62 | * use the #include "..." form here, to ensure that we read the type | 
 
 
 
 
 | 63 | * definition directly from the stdint.h header located in the same | 
 
 
 
 
 | 64 | * directory as this <io.h> file). | 
 
 
 
 
 | 65 | */ | 
 
 
 
 
 | 66 | #define __need_intptr_t | 
 
 
 
 
 | 67 | #include "stdint.h" | 
 
 
 
 
 | 68 |  | 
 
 
 
 
 | 69 | /* Attributes of files as returned by _findfirst() et al.  MSDN is not | 
 
 
 
 
 | 70 | * explicit about whether or not these should be defined when including | 
 
 
 
 
 | 71 | * <wchar.h>, but since they complement the _wfindfirst() API, which is | 
 
 
 
 
 | 72 | * declared there, it seems logical to make them visible in all cases | 
 
 
 
 
 | 73 | * of <io.h> inclusion. | 
 
 
 
 
 | 74 | */ | 
 
 
 
 
 | 75 | #define _A_NORMAL       0x00000000 | 
 
 
 
 
 | 76 | #define _A_RDONLY       0x00000001 | 
 
 
 
 
 | 77 | #define _A_HIDDEN       0x00000002 | 
 
 
 
 
 | 78 | #define _A_SYSTEM       0x00000004 | 
 
 
 
 
 | 79 | #define _A_VOLID        0x00000008 | 
 
 
 
 
 | 80 | #define _A_SUBDIR       0x00000010 | 
 
 
 
 
 | 81 | #define _A_ARCH         0x00000020 | 
 
 
 
 
 | 82 |  | 
 
 
 
 
 | 83 | #ifndef RC_INVOKED | 
 
 
 
 
 | 84 |  | 
 
 
 
 
 | 85 | /* The maximum length of a file name.  It may be better to use the Windows' | 
 
 
 
 
 | 86 | * GetVolumeInformation() function in preference to this constant, but hey, | 
 
 
 
 
 | 87 | * this works!  In any case, we use this manifest constant when we declare | 
 
 
 
 
 | 88 | * the _findfirst() API, so its definition must be visible in all places | 
 
 
 
 
 | 89 | * where this, or any of its variants, is declared. | 
 
 
 
 
 | 90 | * | 
 
 
 
 
 | 91 | * Note that <stdio.h> also defines this, but we don't guard it, so that | 
 
 
 
 
 | 92 | * the compiler has a chance to catch inconsistencies. | 
 
 
 
 
 | 93 | */ | 
 
 
 
 
 | 94 | #define FILENAME_MAX    (260) | 
 
 
 
 
 | 95 |  | 
 
 
 
 
 | 96 | /* We must define _fsize_t, but some compilers (including GCC prior to | 
 
 
 
 
 | 97 | * version 4.0), may choke if we try to do so more than once... | 
 
 
 
 
 | 98 | */ | 
 
 
 
 
 | 99 | #if ! (defined _IO_H && defined _WCHAR_H) | 
 
 
 
 
 | 100 | /* ...so DO NOT define it during direct <io.h> inclusion, (i.e. _IO_H | 
 
 
 
 
 | 101 | * is defined), if <wchar.h> has already caused it to be defined, (i.e. | 
 
 
 
 
 | 102 | * _WCHAR_H is ALSO defined). | 
 
 
 
 
 | 103 | */ | 
 
 
 
 
 | 104 | typedef unsigned long   _fsize_t; | 
 
 
 
 
 | 105 | #endif  /* ! (_IO_H && _WCHAR_H) */ | 
 
 
 
 
 | 106 |  | 
 
 
 
 
 | 107 | /* Functions for searching for files: _findfirst() sets errno to ENOENT, | 
 
 
 
 
 | 108 | * and returns -1 if no match is found; otherwise it returns a handle to | 
 
 
 
 
 | 109 | * be used in _findnext() and _findclose() calls. _findnext() may then be | 
 
 
 
 
 | 110 | * used to identify further matches; it updates the search data, returning | 
 
 
 
 
 | 111 | * zero, each time a further match is found, ultimately setting errno to | 
 
 
 
 
 | 112 | * ENOENT, and returning -1 when no further match can be found.  When all | 
 
 
 
 
 | 113 | * expected matches have been identified, _findclose() should be called, | 
 
 
 
 
 | 114 | * to release the resources allocated to the search data. | 
 
 
 
 
 | 115 | * | 
 
 
 
 
 | 116 | * The API comprises several variants of the _findfirst() and _findnext() | 
 
 
 
 
 | 117 | * functions, conforming generally to the usage model: | 
 
 
 
 
 | 118 | * | 
 
 
 
 
 | 119 | *  intptr_t handle = _findfirst (filespec, &search_data ); | 
 
 
 
 
 | 120 | *  if (handle >= (intptr_t)(0)) do { process search_data; | 
 
 
 
 
 | 121 | *   } while (_findnext (handle, &search_data)); | 
 
 
 
 
 | 122 | * | 
 
 
 
 
 | 123 | * where "filespec" represents a char *, or a wchar_t * specification, | 
 
 
 
 
 | 124 | * (which may include wild cards), for a file name pattern to be matched, | 
 
 
 
 
 | 125 | * and "search_data" represents a variant of the structure: | 
 
 
 
 
 | 126 | */ | 
 
 
 
 
 | 127 | #define __struct_finddata_t(__fd_time_t, __fd_size_t)                   \ | 
 
 
 
 
 | 128 | { unsigned      attrib;         /* Attributes, see constants above. */  \ | 
 
 
 
 
 | 129 | __fd_time_t   time_create;                                            \ | 
 
 
 
 
 | 130 | __fd_time_t   time_access;    /* always midnight local time */        \ | 
 
 
 
 
 | 131 | __fd_time_t   time_write;                                             \ | 
 
 
 
 
 | 132 | __fd_size_t   size;                                                   \ | 
 
 
 
 
 | 133 | __fd_name_t   name[FILENAME_MAX];     /* may include spaces. */       \ | 
 
 
 
 
 | 134 | } | 
 
 
 
 
 | 135 |  | 
 
 
 
 
 | 136 | /* Time type and file size variations for __struct_finddata_t apply, for the | 
 
 
 
 
 | 137 | * various functions comprising the file name search API, as tabulated below: | 
 
 
 
 
 | 138 | * | 
 
 
 
 
 | 139 | * Note: this is a reproduction of reference data as published in the MSDN | 
 
 
 
 
 | 140 | * online documentation for the file name search API; it applies, specifically, | 
 
 
 
 
 | 141 | * to the implementation of this API in the non-free run-time library versions | 
 
 
 
 
 | 142 | * from MSVCR80.DLL onwards, (i.e. when __MSVCRT_VERSION__ is defined, and is | 
 
 
 
 
 | 143 | * assigned a value >= 0x800).  When linking to the freely available MSVCRT.DLL | 
 
 
 
 
 | 144 | * runtime, (__MSVCRT_VERSION__ should not be defined), or any earlier version | 
 
 
 
 
 | 145 | * of the non-free run-time, the _USE_32BIT_TIME_T feature test is irrelevant; | 
 
 
 
 
 | 146 | * the information presented in this table should be interpreted as if this | 
 
 
 
 
 | 147 | * feature is always implicitly enabled. | 
 
 
 
 
 | 148 | * | 
 
 
 
 
 | 149 | *  Functions          _USE_32BIT_TIME_T defined?    __fd_time_t     __fd_size_t | 
 
 
 
 
 | 150 | * | 
 
 
 
 
 | 151 | * _findfirst(),        Not defined                     64-bit          32-bit | 
 
 
 
 
 | 152 | * _wfindfirst() | 
 
 
 
 
 | 153 | * _findfirst(),        Defined                         32-bit          32-bit | 
 
 
 
 
 | 154 | * _wfindfirst() | 
 
 
 
 
 | 155 | * | 
 
 
 
 
 | 156 | * _findfirst32(),      Not affected by the macro       32-bit          32-bit | 
 
 
 
 
 | 157 | * _wfindfirst32()      definition | 
 
 
 
 
 | 158 | * | 
 
 
 
 
 | 159 | * _findfirst64(),      Not affected by the macro       64-bit          64-bit | 
 
 
 
 
 | 160 | * _wfindfirst64()      definition | 
 
 
 
 
 | 161 | * | 
 
 
 
 
 | 162 | * _findfirsti64(),     Not defined                     64-bit          64-bit | 
 
 
 
 
 | 163 | * _wfindfirsti64() | 
 
 
 
 
 | 164 | * _findfirsti64(),     Defined                         32-bit          64-bit | 
 
 
 
 
 | 165 | * _wfindfirsti64() | 
 
 
 
 
 | 166 | * | 
 
 
 
 
 | 167 | * _findfirst32i64(),   Not affected by the macro       32-bit          64-bit | 
 
 
 
 
 | 168 | * _wfindfirst32i64()   definition | 
 
 
 
 
 | 169 | * | 
 
 
 
 
 | 170 | * _findfirst64i32(),   Not affected by the macro       64-bit          32-bit | 
 
 
 
 
 | 171 | * _wfindfirst64i32()   definition | 
 
 
 
 
 | 172 | * | 
 
 
 
 
 | 173 | */ | 
 
 
 
 
 | 174 | _BEGIN_C_DECLS | 
 
 
 
 
 | 175 |  | 
 
 
 
 
 | 176 | #ifdef _IO_H | 
 
 
 
 
 | 177 | #define __fd_name_t  char | 
 
 
 
 
 | 178 |  | 
 
 
 
 
 | 179 | /* The most universally available variants of the file name search | 
 
 
 
 
 | 180 | * API employ either a generic representation of the related data, or | 
 
 
 
 
 | 181 | * a variant in which the time stamps are represented generically, but | 
 
 
 
 
 | 182 | * the file size is explicitly expressed as a 64-bit value. | 
 
 
 
 
 | 183 | */ | 
 
 
 
 
 | 184 | struct _finddata_t __struct_finddata_t (time_t, _fsize_t); | 
 
 
 
 
 | 185 | struct _finddatai64_t __struct_finddata_t (time_t, __int64); | 
 
 
 
 
 | 186 |  | 
 
 
 
 
 | 187 | /* Functions to manipulate data in either of these representations are | 
 
 
 
 
 | 188 | * provided, as physical entities, in ALL versions of MSVCRT.DLL, and | 
 
 
 
 
 | 189 | * in the non-free variants predating MSVCR80.DLL; (each such physical | 
 
 
 
 
 | 190 | * function implementation interprets "generic" as 32-bit for both the | 
 
 
 
 
 | 191 | * time_t and _fsize_t data fields).  From MSVCR80.DLL onward, there is | 
 
 
 
 
 | 192 | * no physical implementation of these functions; they are emulated by | 
 
 
 
 
 | 193 | * inline replacements (implemented below), which introduce ambiguity | 
 
 
 
 
 | 194 | * in the interpretation of "generic", (noted as applicable): thus... | 
 
 
 
 
 | 195 | */ | 
 
 
 
 
 | 196 | #if __MSVCRT_VERSION__ < __MSVCR80_DLL | 
 
 
 
 
 | 197 | /* ...these physical function APIs are declared only when it is NOT | 
 
 
 
 
 | 198 | * specified that MSVCR80.DLL or later is to be used. | 
 
 
 
 
 | 199 | */ | 
 
 
 
 
 | 200 | _CRTIMP __cdecl __MINGW_NOTHROW | 
 
 
 
 
 | 201 | intptr_t _findfirst (const char *, struct _finddata_t *); | 
 
 
 
 
 | 202 |  | 
 
 
 
 
 | 203 | _CRTIMP __cdecl __MINGW_NOTHROW | 
 
 
 
 
 | 204 | int _findnext (intptr_t, struct _finddata_t *); | 
 
 
 
 
 | 205 |  | 
 
 
 
 
 | 206 | _CRTIMP __cdecl __MINGW_NOTHROW | 
 
 
 
 
 | 207 | intptr_t _findfirsti64 (const char *, struct _finddatai64_t *); | 
 
 
 
 
 | 208 |  | 
 
 
 
 
 | 209 | _CRTIMP __cdecl __MINGW_NOTHROW | 
 
 
 
 
 | 210 | int _findnexti64 (intptr_t, struct _finddatai64_t *); | 
 
 
 
 
 | 211 |  | 
 
 
 
 
 | 212 | #endif  /* __MSVCRT_VERSION__ < __MSVCR80_DLL */ | 
 
 
 
 
 | 213 |  | 
 
 
 
 
 | 214 | #if _WIN32_WINNT >= _WIN32_WINNT_WIN2K || __MSVCRT_VERSION__ >= __MSVCR61_DLL | 
 
 
 
 
 | 215 | /* The Win2K release of MSVCRT.DLL added a third variant of the API, | 
 
 
 
 
 | 216 | * which had originally been introduced in MSVCR61.DLL; this variant | 
 
 
 
 
 | 217 | * uses a data representation having both 64-bit time stamp values, | 
 
 
 
 
 | 218 | * and 64-bit file size values.  (Note that there was no explictly | 
 
 
 
 
 | 219 | * all 32-bit variant added at this point in the evolution of the | 
 
 
 
 
 | 220 | * API; had there been, it would have been identically equivalent | 
 
 
 
 
 | 221 | * to the original generic _findfirst()/_findnext() implementation). | 
 
 
 
 
 | 222 | */ | 
 
 
 
 
 | 223 | struct __finddata64_t __struct_finddata_t (__time64_t, __int64); | 
 
 
 
 
 | 224 |  | 
 
 
 
 
 | 225 | _CRTIMP __cdecl __MINGW_NOTHROW | 
 
 
 
 
 | 226 | intptr_t _findfirst64 (const char *, struct __finddata64_t *); | 
 
 
 
 
 | 227 |  | 
 
 
 
 
 | 228 | _CRTIMP __cdecl __MINGW_NOTHROW | 
 
 
 
 
 | 229 | int _findnext64 (intptr_t, struct __finddata64_t *); | 
 
 
 
 
 | 230 |  | 
 
 
 
 
 | 231 | #if __MSVCRT_VERSION__ >= __MSVCR80_DLL | 
 
 
 
 
 | 232 | /* MSVCR80.DLL introduced three new data structures, with explicitly | 
 
 
 
 
 | 233 | * sized elements; in the order specified below, the first and second | 
 
 
 
 
 | 234 | * of these three are identically equivalent to the representations of | 
 
 
 
 
 | 235 | * struct _finddata_t, and struct _finddatai64_t, as they are required | 
 
 
 
 
 | 236 | * to be implemented to match the implementations of the corresponding | 
 
 
 
 
 | 237 | * functions in ALL versions of MSVCRT.DLL, whereas the third has no | 
 
 
 
 
 | 238 | * counterpart, in ANY version of MSVCRT.DLL. | 
 
 
 
 
 | 239 | */ | 
 
 
 
 
 | 240 | struct _finddata32_t __struct_finddata_t (__time32_t, __int32); | 
 
 
 
 
 | 241 | struct _finddata32i64_t __struct_finddata_t (__time32_t, __int64); | 
 
 
 
 
 | 242 | struct _finddata64i32_t __struct_finddata_t (__time64_t, __int32); | 
 
 
 
 
 | 243 |  | 
 
 
 
 
 | 244 | /* The actual functions implemented in MSVCR80.DLL, and its derivatives, | 
 
 
 
 
 | 245 | * corresponding to each of these three data structures are: | 
 
 
 
 
 | 246 | */ | 
 
 
 
 
 | 247 | _CRTIMP __cdecl __MINGW_NOTHROW | 
 
 
 
 
 | 248 | intptr_t _findfirst32 (const char *, struct _finddata32_t *); | 
 
 
 
 
 | 249 |  | 
 
 
 
 
 | 250 | _CRTIMP __cdecl __MINGW_NOTHROW | 
 
 
 
 
 | 251 | int _findnext32 (intptr_t, struct _finddata32_t *); | 
 
 
 
 
 | 252 |  | 
 
 
 
 
 | 253 | _CRTIMP __cdecl __MINGW_NOTHROW | 
 
 
 
 
 | 254 | intptr_t _findfirst32i64 (const char *, struct _finddata32i64_t *); | 
 
 
 
 
 | 255 |  | 
 
 
 
 
 | 256 | _CRTIMP __cdecl __MINGW_NOTHROW | 
 
 
 
 
 | 257 | int _findnext32i64 (intptr_t, struct _finddata32i64_t *); | 
 
 
 
 
 | 258 |  | 
 
 
 
 
 | 259 | _CRTIMP __cdecl __MINGW_NOTHROW | 
 
 
 
 
 | 260 | intptr_t _findfirst64i32 (const char *, struct _finddata64i32_t *); | 
 
 
 
 
 | 261 |  | 
 
 
 
 
 | 262 | _CRTIMP __cdecl __MINGW_NOTHROW | 
 
 
 
 
 | 263 | int _findnext64i32 (intptr_t, struct _finddata64i32_t *); | 
 
 
 
 
 | 264 |  | 
 
 
 
 
 | 265 | /* Since MSVCR80.DLL, and its later derivatives, provide no physical | 
 
 
 
 
 | 266 | * implementations of the original file name search API functions, we | 
 
 
 
 
 | 267 | * must emulate them, (as Microsoft do), by providing replacements in | 
 
 
 
 
 | 268 | * the form of inline functions; in doing so, we also need to contend | 
 
 
 
 
 | 269 | * with the insane ambiguity of Microsoft's _USE_32BIT_TIME_T feature | 
 
 
 
 
 | 270 | * test; thus... | 
 
 
 
 
 | 271 | */ | 
 
 
 
 
 | 272 | #if defined _USE_32BIT_TIME_T | 
 
 
 
 
 | 273 | /* ...when the user has defined the _USE_32BIT_TIME_T macro, we provide | 
 
 
 
 
 | 274 | * inline implementations which remain fully compatible with the actual | 
 
 
 
 
 | 275 | * functions, as provided by MSVCRT.DLL; (note that we do not provide | 
 
 
 
 
 | 276 | * __JMPSTUB__ or __LIBIMPL__ references here, since we have no basis | 
 
 
 
 
 | 277 | * for a rational choice between ambiguous alternatives). | 
 
 
 
 
 | 278 | */ | 
 
 
 
 
 | 279 | __CRT_ALIAS __cdecl __MINGW_NOTHROW | 
 
 
 
 
 | 280 | intptr_t _findfirst (const char *__filespec, struct _finddata_t *__search) | 
 
 
 
 
 | 281 | { return _findfirst32 (__filespec, (struct _finddata32_t *)(__search)); } | 
 
 
 
 
 | 282 |  | 
 
 
 
 
 | 283 | __CRT_ALIAS __cdecl __MINGW_NOTHROW | 
 
 
 
 
 | 284 | int _findnext (intptr_t __handle, struct _finddata_t *__search) | 
 
 
 
 
 | 285 | { return _findnext32 (__handle, (struct _finddata32_t *)(__search)); } | 
 
 
 
 
 | 286 |  | 
 
 
 
 
 | 287 | __CRT_ALIAS __cdecl __MINGW_NOTHROW | 
 
 
 
 
 | 288 | intptr_t _findfirsti64 (const char *__filespec, struct _finddatai64_t *__search) | 
 
 
 
 
 | 289 | { return _findfirst32i64 (__filespec, (struct _finddata32i64_t *)(__search)); } | 
 
 
 
 
 | 290 |  | 
 
 
 
 
 | 291 | __CRT_ALIAS __cdecl __MINGW_NOTHROW | 
 
 
 
 
 | 292 | int _findnexti64 (intptr_t __handle, struct _finddatai64_t *__search) | 
 
 
 
 
 | 293 | { return _findnext32i64 (__handle, (struct _finddata32i64_t *)(__search)); } | 
 
 
 
 
 | 294 |  | 
 
 
 
 
 | 295 | #else   /* !_USE_32BIT_TIME_T */ | 
 
 
 
 
 | 296 | /* ...but, when the user has NOT defined _USE_32BIT_TIME_T, we emulate | 
 
 
 
 
 | 297 | * the brain damaged default behaviour of Microsoft's own SDKs.  This | 
 
 
 
 
 | 298 | * accommodates an extended range of valid time stamp values, but it | 
 
 
 
 
 | 299 | * utterly destroys compatibility with MSVCRT.DLL! | 
 
 
 
 
 | 300 | */ | 
 
 
 
 
 | 301 | __CRT_ALIAS __cdecl __MINGW_NOTHROW | 
 
 
 
 
 | 302 | intptr_t _findfirst (const char *__filespec, struct _finddata_t *__search) | 
 
 
 
 
 | 303 | { return _findfirst64i32 (__filespec, (struct _finddata64i32_t *)(__search)); } | 
 
 
 
 
 | 304 |  | 
 
 
 
 
 | 305 | __CRT_ALIAS __cdecl __MINGW_NOTHROW | 
 
 
 
 
 | 306 | int _findnext (intptr_t __handle, struct _finddata_t *__search) | 
 
 
 
 
 | 307 | { return _findnext64i32 (__handle, (struct _finddata64i32_t *)(__search)); } | 
 
 
 
 
 | 308 |  | 
 
 
 
 
 | 309 | __CRT_ALIAS __cdecl __MINGW_NOTHROW | 
 
 
 
 
 | 310 | intptr_t _findfirsti64 (const char *__filespec, struct _finddatai64_t *__search) | 
 
 
 
 
 | 311 | { return _findfirst64 (__filespec, (struct __finddata64_t *)(__search)); } | 
 
 
 
 
 | 312 |  | 
 
 
 
 
 | 313 | __CRT_ALIAS __cdecl __MINGW_NOTHROW | 
 
 
 
 
 | 314 | int _findnexti64 (intptr_t __handle, struct _finddatai64_t *__search) | 
 
 
 
 
 | 315 | { return _findnext64 (__handle, (struct __finddata64_t *)(__search)); } | 
 
 
 
 
 | 316 |  | 
 
 
 
 
 | 317 | #endif  /* !_USE_32BIT_TIME_T */ | 
 
 
 
 
 | 318 | #endif  /* __MSVCRT_VERSION__ >= __MSVCR80_DLL */ | 
 
 
 
 
 | 319 | #endif  /* >= WIN2K || >= MSVCR61.DLL */ | 
 
 
 
 
 | 320 |  | 
 
 
 
 
 | 321 | #undef  __fd_name_t | 
 
 
 
 
 | 322 | #endif  /* _IO_H */ | 
 
 
 
 
 | 323 |  | 
 
 
 
 
 | 324 | #if ! (defined _IO_H && defined _WCHAR_H) | 
 
 
 
 
 | 325 | /* Wide character file name analogue of the file name search API; | 
 
 
 
 
 | 326 | * declared both here, in <io.h>, and via selective inclusion from | 
 
 
 
 
 | 327 | * <wchar.h>, it mirrors all aspects of the preceding API declarations, | 
 
 
 
 
 | 328 | * except that all file names are expressed as wchar_t. | 
 
 
 
 
 | 329 | */ | 
 
 
 
 
 | 330 | #define __fd_name_t  wchar_t | 
 
 
 
 
 | 331 |  | 
 
 
 
 
 | 332 | /* Thus, the original API comprised this pair of generically specified | 
 
 
 
 
 | 333 | * data structures... | 
 
 
 
 
 | 334 | */ | 
 
 
 
 
 | 335 | struct _wfinddata_t __struct_finddata_t (time_t, _fsize_t); | 
 
 
 
 
 | 336 | struct _wfinddatai64_t __struct_finddata_t (time_t, __int64); | 
 
 
 
 
 | 337 |  | 
 
 
 
 
 | 338 | #if __MSVCRT_VERSION__ < __MSVCR80_DLL | 
 
 
 
 
 | 339 | /* ...with corresponding functions to manipulate them; once again, there | 
 
 
 
 
 | 340 | * is no physical implementation of these in MSVCR80.DLL or later, so we | 
 
 
 
 
 | 341 | * declare them only when it is NOT specified that one of these run-time | 
 
 
 
 
 | 342 | * library versions is to be used. | 
 
 
 
 
 | 343 | */ | 
 
 
 
 
 | 344 | _CRTIMP __cdecl __MINGW_NOTHROW | 
 
 
 
 
 | 345 | intptr_t _wfindfirst (const wchar_t *, struct _wfinddata_t *); | 
 
 
 
 
 | 346 |  | 
 
 
 
 
 | 347 | _CRTIMP __cdecl __MINGW_NOTHROW | 
 
 
 
 
 | 348 | int _wfindnext (intptr_t, struct _wfinddata_t *); | 
 
 
 
 
 | 349 |  | 
 
 
 
 
 | 350 | _CRTIMP __cdecl __MINGW_NOTHROW | 
 
 
 
 
 | 351 | intptr_t _wfindfirsti64 (const wchar_t *, struct _wfinddatai64_t *); | 
 
 
 
 
 | 352 |  | 
 
 
 
 
 | 353 | _CRTIMP __cdecl __MINGW_NOTHROW | 
 
 
 
 
 | 354 | int _wfindnexti64 (intptr_t, struct _wfinddatai64_t *); | 
 
 
 
 
 | 355 |  | 
 
 
 
 
 | 356 | #endif  /* __MSVCRT_VERSION__ < __MSVCR80_DLL */ | 
 
 
 
 
 | 357 |  | 
 
 
 
 
 | 358 | #if _WIN32_WINNT >= _WIN32_WINNT_WIN2K || __MSVCRT_VERSION__ >= __MSVCR61_DLL | 
 
 
 
 
 | 359 | /* Win2K also added an all-64-bit variant of the _wfinddata API to | 
 
 
 
 
 | 360 | * MSVCRT.DLL, after it originally appeared in MSVCR61.DLL. | 
 
 
 
 
 | 361 | */ | 
 
 
 
 
 | 362 | struct __wfinddata64_t __struct_finddata_t (__time64_t, __int64); | 
 
 
 
 
 | 363 |  | 
 
 
 
 
 | 364 | _CRTIMP __cdecl __MINGW_NOTHROW | 
 
 
 
 
 | 365 | intptr_t _wfindfirst64 (const wchar_t *, struct __wfinddata64_t *); | 
 
 
 
 
 | 366 |  | 
 
 
 
 
 | 367 | _CRTIMP __cdecl __MINGW_NOTHROW | 
 
 
 
 
 | 368 | int _wfindnext64 (intptr_t, struct __wfinddata64_t *); | 
 
 
 
 
 | 369 |  | 
 
 
 
 
 | 370 | #if __MSVCRT_VERSION__ >= __MSVCR80_DLL | 
 
 
 
 
 | 371 | /* MSVCR80.DLL introduced a further three variants, which remain | 
 
 
 
 
 | 372 | * exclusive to it and its later derivatives; none of these are | 
 
 
 
 
 | 373 | * available in any version of MSVCRT.DLL. | 
 
 
 
 
 | 374 | */ | 
 
 
 
 
 | 375 | struct __wfinddata32_t __struct_finddata_t (__time32_t, __int32); | 
 
 
 
 
 | 376 | struct _wfinddata32i64_t __struct_finddata_t (__time32_t, __int64); | 
 
 
 
 
 | 377 | struct _wfinddata64i32_t __struct_finddata_t (__time64_t, __int32); | 
 
 
 
 
 | 378 |  | 
 
 
 
 
 | 379 | _CRTIMP __cdecl __MINGW_NOTHROW | 
 
 
 
 
 | 380 | intptr_t _wfindfirst32 (const wchar_t *, struct __wfinddata32_t *); | 
 
 
 
 
 | 381 |  | 
 
 
 
 
 | 382 | _CRTIMP __cdecl __MINGW_NOTHROW | 
 
 
 
 
 | 383 | int _wfindnext32 (intptr_t, struct __wfinddata32_t *); | 
 
 
 
 
 | 384 |  | 
 
 
 
 
 | 385 | _CRTIMP __cdecl __MINGW_NOTHROW | 
 
 
 
 
 | 386 | intptr_t _wfindfirst32i64 (const wchar_t *, struct _wfinddata32i64_t *); | 
 
 
 
 
 | 387 |  | 
 
 
 
 
 | 388 | _CRTIMP __cdecl __MINGW_NOTHROW | 
 
 
 
 
 | 389 | int _wfindnext32i64 (intptr_t, struct _wfinddata32i64_t *); | 
 
 
 
 
 | 390 |  | 
 
 
 
 
 | 391 | _CRTIMP __cdecl __MINGW_NOTHROW | 
 
 
 
 
 | 392 | intptr_t _wfindfirst64i32 (const wchar_t *, struct _wfinddata64i32_t *); | 
 
 
 
 
 | 393 |  | 
 
 
 
 
 | 394 | _CRTIMP __cdecl __MINGW_NOTHROW | 
 
 
 
 
 | 395 | int _wfindnext64i32 (intptr_t, struct _wfinddata64i32_t *); | 
 
 
 
 
 | 396 |  | 
 
 
 
 
 | 397 | /* Once again, the variants of this API with generic time_t data | 
 
 
 
 
 | 398 | * fields are NOT supported by any physical function implementation | 
 
 
 
 
 | 399 | * in MSVCR80.DLL and later, so must be emulated; (again, we do not | 
 
 
 
 
 | 400 | * provide any __JMPSTUB__ or __LIBIMPL__ references). | 
 
 
 
 
 | 401 | */ | 
 
 
 
 
 | 402 | #ifdef _USE_32BIT_TIME_T | 
 
 
 
 
 | 403 | /* First, we provide inline implementations which retain compatibility | 
 
 
 
 
 | 404 | * with the physical implementations in MSVCRT.DLL; they require the | 
 
 
 
 
 | 405 | * user to define the _USE_32BIT_TIME_T feature test macro... | 
 
 
 
 
 | 406 | */ | 
 
 
 
 
 | 407 | __CRT_ALIAS __cdecl __MINGW_NOTHROW | 
 
 
 
 
 | 408 | intptr_t _wfindfirst (const wchar_t *__filespec, struct _wfinddata_t *__search) | 
 
 
 
 
 | 409 | { return _wfindfirst32 (__filespec, (struct __wfinddata32_t *)(__search)); } | 
 
 
 
 
 | 410 |  | 
 
 
 
 
 | 411 | __CRT_ALIAS __cdecl __MINGW_NOTHROW | 
 
 
 
 
 | 412 | int _wfindnext (intptr_t __handle, struct _wfinddata_t *__search) | 
 
 
 
 
 | 413 | { return _wfindnext32 (__handle, (struct __wfinddata32_t *)(__search)); } | 
 
 
 
 
 | 414 |  | 
 
 
 
 
 | 415 | __CRT_ALIAS __cdecl __MINGW_NOTHROW | 
 
 
 
 
 | 416 | intptr_t _wfindfirsti64 (const wchar_t *__filespec, struct _wfinddatai64_t *__search) | 
 
 
 
 
 | 417 | { return _wfindfirst32i64 (__filespec, (struct _wfinddata32i64_t *)(__search)); } | 
 
 
 
 
 | 418 |  | 
 
 
 
 
 | 419 | __CRT_ALIAS __cdecl __MINGW_NOTHROW | 
 
 
 
 
 | 420 | int _wfindnexti64 (intptr_t __handle, struct _wfinddatai64_t *__search) | 
 
 
 
 
 | 421 | { return _wfindnext32i64 (__handle, (struct _wfinddata32i64_t *)(__search)); } | 
 
 
 
 
 | 422 |  | 
 
 
 
 
 | 423 | #else   /* !_USE_32BIT_TIME_T */ | 
 
 
 
 
 | 424 | /* ...whereas the brain damaged Microsoft defaults, which apply when | 
 
 
 
 
 | 425 | * _USE_32BIT_TIME_T is not defined, break MSVCRT.DLL compatibility. | 
 
 
 
 
 | 426 | */ | 
 
 
 
 
 | 427 | __CRT_ALIAS __cdecl __MINGW_NOTHROW | 
 
 
 
 
 | 428 | intptr_t _wfindfirst (const wchar_t *__filespec, struct _wfinddata_t *__search) | 
 
 
 
 
 | 429 | { return _wfindfirst64i32 (__filespec, (struct _wfinddata64i32_t *)(__search)); } | 
 
 
 
 
 | 430 |  | 
 
 
 
 
 | 431 | __CRT_ALIAS __cdecl __MINGW_NOTHROW | 
 
 
 
 
 | 432 | int _wfindnext (intptr_t __handle, struct _wfinddata_t *__search) | 
 
 
 
 
 | 433 | { return _wfindnext64i32 (__handle, (struct _wfinddata64i32_t *)(__search)); } | 
 
 
 
 
 | 434 |  | 
 
 
 
 
 | 435 | __CRT_ALIAS __cdecl __MINGW_NOTHROW | 
 
 
 
 
 | 436 | intptr_t _wfindfirsti64 (const wchar_t *__filespec, struct _wfinddatai64_t *__search) | 
 
 
 
 
 | 437 | { return _wfindfirst64 (__filespec, (struct __wfinddata64_t *)(__search)); } | 
 
 
 
 
 | 438 |  | 
 
 
 
 
 | 439 | __CRT_ALIAS __cdecl __MINGW_NOTHROW | 
 
 
 
 
 | 440 | int _wfindnexti64 (intptr_t __handle, struct _wfinddatai64_t *__search) | 
 
 
 
 
 | 441 | { return _wfindnext64 (__handle, (struct __wfinddata64_t *)(__search)); } | 
 
 
 
 
 | 442 |  | 
 
 
 
 
 | 443 | #endif  /* !_USE_32BIT_TIME_T */ | 
 
 
 
 
 | 444 | #endif  /* __MSVCRT_VERSION__ >= MSVCR80.DLL */ | 
 
 
 
 
 | 445 | #endif  /* >= _WIN2K || >= MSVCR61.DLL */ | 
 
 
 
 
 | 446 |  | 
 
 
 
 
 | 447 | #undef __fd_name_t | 
 
 
 
 
 | 448 | #endif  /* ! (_IO_H && _WCHAR_H) */ | 
 
 
 
 
 | 449 |  | 
 
 
 
 
 | 450 | /* We have no further use for the __struct_finddata_t macro; delete it! | 
 
 
 
 
 | 451 | */ | 
 
 
 
 
 | 452 | #undef __struct_finddata_t | 
 
 
 
 
 | 453 |  | 
 
 
 
 
 | 454 | /* MSDN documents that <io.h> must be included to get a prototype for | 
 
 
 
 
 | 455 | * _findclose(), which kind of negates the usefulness of declaring the | 
 
 
 
 
 | 456 | * wchar_t variants of the file name search API in <wchar.h>; mitigate | 
 
 
 
 
 | 457 | * this anomaly, by declaring _findclose() such that either <io.h> or | 
 
 
 
 
 | 458 | * <wchar.h> will provide it. | 
 
 
 
 
 | 459 | */ | 
 
 
 
 
 | 460 | _CRTIMP __cdecl __MINGW_NOTHROW  int _findclose (intptr_t); | 
 
 
 
 
 | 461 |  | 
 
 
 
 
 | 462 | #ifdef _IO_H | 
 
 
 
 
 | 463 | /* The following declarations are to be exposed only when <io.h> is | 
 
 
 
 
 | 464 | * included directly. | 
 
 
 
 
 | 465 | */ | 
 
 
 
 
 | 466 | _CRTIMP __cdecl __MINGW_NOTHROW  int _chdir (const char *); | 
 
 
 
 
 | 467 | _CRTIMP __cdecl __MINGW_NOTHROW  char *_getcwd (char *, int); | 
 
 
 
 
 | 468 | _CRTIMP __cdecl __MINGW_NOTHROW  int _mkdir (const char *); | 
 
 
 
 
 | 469 | _CRTIMP __cdecl __MINGW_NOTHROW  char *_mktemp (char *); | 
 
 
 
 
 | 470 | _CRTIMP __cdecl __MINGW_NOTHROW  int _rmdir (const char *); | 
 
 
 
 
 | 471 | _CRTIMP __cdecl __MINGW_NOTHROW  int _chmod (const char *, int); | 
 
 
 
 
 | 472 |  | 
 
 
 
 
 | 473 | #ifdef __MSVCRT__ | 
 
 
 
 
 | 474 | _CRTIMP __cdecl __MINGW_NOTHROW  __int64 _filelengthi64 (int); | 
 
 
 
 
 | 475 | _CRTIMP __cdecl __MINGW_NOTHROW  __int64 _lseeki64 (int, __int64, int); | 
 
 
 
 
 | 476 | _CRTIMP __cdecl __MINGW_NOTHROW  __int64 _telli64 (int); | 
 
 
 
 
 | 477 |  | 
 
 
 
 
 | 478 | #ifndef __NO_MINGW_LFS | 
 
 
 
 
 | 479 | __CRT_INLINE __off64_t lseek64 (int, __off64_t, int); | 
 
 
 
 
 | 480 | __CRT_INLINE __JMPSTUB__(( FUNCTION = lseek64, REMAPPED = _lseeki64 )) | 
 
 
 
 
 | 481 | __off64_t lseek64 (int fd, __off64_t offset, int whence) | 
 
 
 
 
 | 482 | { return _lseeki64 (fd, (__int64)(offset), whence); } | 
 
 
 
 
 | 483 | #endif | 
 
 
 
 
 | 484 |  | 
 
 
 
 
 | 485 | #endif /* __MSVCRT__ */ | 
 
 
 
 
 | 486 |  | 
 
 
 
 
 | 487 | #ifndef _NO_OLDNAMES | 
 
 
 
 
 | 488 |  | 
 
 
 
 
 | 489 | #ifndef _UWIN | 
 
 
 
 
 | 490 | _CRTIMP __cdecl __MINGW_NOTHROW  int chdir (const char *); | 
 
 
 
 
 | 491 | _CRTIMP __cdecl __MINGW_NOTHROW  char *getcwd (char *, int); | 
 
 
 
 
 | 492 | _CRTIMP __cdecl __MINGW_NOTHROW  int mkdir (const char *); | 
 
 
 
 
 | 493 | _CRTIMP __cdecl __MINGW_NOTHROW  char *mktemp (char *); | 
 
 
 
 
 | 494 | _CRTIMP __cdecl __MINGW_NOTHROW  int rmdir (const char *); | 
 
 
 
 
 | 495 | _CRTIMP __cdecl __MINGW_NOTHROW  int chmod (const char *, int); | 
 
 
 
 
 | 496 | #endif /* _UWIN */ | 
 
 
 
 
 | 497 |  | 
 
 
 
 
 | 498 | #endif /* !_NO_OLDNAMES */ | 
 
 
 
 
 | 499 | #endif  /* _IO_H */ | 
 
 
 
 
 | 500 |  | 
 
 
 
 
 | 501 | _END_C_DECLS | 
 
 
 
 
 | 502 |  | 
 
 
 
 
 | 503 | #endif  /* ! RC_INVOKED */ | 
 
 
 
 
 | 504 |  | 
 
 
 
 
 | 505 | #ifdef _IO_H | 
 
 
 
 
 | 506 | /* Still applicable only when <io.h> is included directly, but we also | 
 
 
 
 
 | 507 | * allow the resource compiler to see these. | 
 
 
 
 
 | 508 | * | 
 
 
 
 
 | 509 | * TODO: Maximum number of open handles has not been tested; we just set | 
 
 
 
 
 | 510 | * it the same as FOPEN_MAX. | 
 
 
 
 
 | 511 | */ | 
 
 
 
 
 | 512 | #define HANDLE_MAX      FOPEN_MAX | 
 
 
 
 
 | 513 |  | 
 
 
 
 
 | 514 | /* Some defines for _access() mode checking: (Microsoft doesn't define | 
 
 
 
 
 | 515 | * them, but it doesn't seem to hurt to add them ... or perhaps it does | 
 
 
 
 
 | 516 | * hurt; on newer versions of MSVCRT.DLL, an access mode of 1 may raise | 
 
 
 
 
 | 517 | * an invalid parameter error! | 
 
 
 
 
 | 518 | */ | 
 
 
 
 
 | 519 | #define F_OK    0       /* Check for file existence */ | 
 
 
 
 
 | 520 | #define X_OK    1       /* MS access() doesn't check for execute permission. */ | 
 
 
 
 
 | 521 | #define W_OK    2       /* Check for write permission */ | 
 
 
 
 
 | 522 | #define R_OK    4       /* Check for read permission */ | 
 
 
 
 
 | 523 | #endif  /* _IO_H */ | 
 
 
 
 
 | 524 |  | 
 
 
 
 
 | 525 | #ifndef RC_INVOKED | 
 
 
 
 
 | 526 |  | 
 
 
 
 
 | 527 | _BEGIN_C_DECLS | 
 
 
 
 
 | 528 |  | 
 
 
 
 
 | 529 | #ifdef _IO_H | 
 
 
 
 
 | 530 | /* Again, specific to <io.h>, but not applicable to resources. | 
 
 
 
 
 | 531 | */ | 
 
 
 
 
 | 532 | _CRTIMP __cdecl __MINGW_NOTHROW  int _access (const char *, int); | 
 
 
 
 
 | 533 | _CRTIMP __cdecl __MINGW_NOTHROW  int _chsize (int, long); | 
 
 
 
 
 | 534 | _CRTIMP __cdecl __MINGW_NOTHROW  int _close (int); | 
 
 
 
 
 | 535 | _CRTIMP __cdecl __MINGW_NOTHROW  int _commit (int); | 
 
 
 
 
 | 536 |  | 
 
 
 
 
 | 537 | /* NOTE: The only significant permissions bit appears to be | 
 
 
 
 
 | 538 | * bit 7 (0x80), the "owner write permission" bit (on FAT). | 
 
 
 
 
 | 539 | */ | 
 
 
 
 
 | 540 | _CRTIMP __cdecl __MINGW_NOTHROW  int _creat (const char *, int); | 
 
 
 
 
 | 541 |  | 
 
 
 
 
 | 542 | _CRTIMP __cdecl __MINGW_NOTHROW  int _dup (int); | 
 
 
 
 
 | 543 | _CRTIMP __cdecl __MINGW_NOTHROW  int _dup2 (int, int); | 
 
 
 
 
 | 544 | _CRTIMP __cdecl __MINGW_NOTHROW  long _filelength (int); | 
 
 
 
 
 | 545 | _CRTIMP __cdecl __MINGW_NOTHROW  long _get_osfhandle (int); | 
 
 
 
 
 | 546 | _CRTIMP __cdecl __MINGW_NOTHROW  int _isatty (int); | 
 
 
 
 
 | 547 |  | 
 
 
 
 
 | 548 | #ifndef _STREAM_COMPAT | 
 
 
 
 
 | 549 | /* In a very odd turn of events this function is excluded from those | 
 
 
 
 
 | 550 | * files which define _STREAM_COMPAT. This is required in order to | 
 
 
 
 
 | 551 | * build GNU libio because of a conflict with _eof in streambuf.h | 
 
 
 
 
 | 552 | * line 107. Actually I might just be able to change the name of | 
 
 
 
 
 | 553 | * the enum member in streambuf.h ... we'll see. TODO | 
 
 
 
 
 | 554 | */ | 
 
 
 
 
 | 555 | _CRTIMP __cdecl __MINGW_NOTHROW  int _eof (int); | 
 
 
 
 
 | 556 | #endif | 
 
 
 
 
 | 557 |  | 
 
 
 
 
 | 558 | /* Locking files: attribute constants are defined in <sys/locking.h>, | 
 
 
 
 
 | 559 | * which users are expected to include. | 
 
 
 
 
 | 560 | */ | 
 
 
 
 
 | 561 | _CRTIMP __cdecl __MINGW_NOTHROW  int _locking (int, int, long); | 
 
 
 
 
 | 562 |  | 
 
 
 
 
 | 563 | _CRTIMP __cdecl __MINGW_NOTHROW  long _lseek (int, long, int); | 
 
 
 
 
 | 564 |  | 
 
 
 
 
 | 565 | /* Opening files, (or streams); manifest constants for construction of | 
 
 
 
 
 | 566 | * the mode flags are defined in <fctl.h>, which users are expected to | 
 
 
 
 
 | 567 | * include.  The "optional" third argument is an unsigned int; it is | 
 
 
 
 
 | 568 | * REQUIRED, when creating a new file, to specify the permissions to | 
 
 
 
 
 | 569 | * apply when said file is released by the creating process. | 
 
 
 
 
 | 570 | */ | 
 
 
 
 
 | 571 | _CRTIMP __cdecl __MINGW_NOTHROW  int _open (const char *, int, ...); | 
 
 
 
 
 | 572 |  | 
 
 
 
 
 | 573 | _CRTIMP __cdecl __MINGW_NOTHROW  int _open_osfhandle (intptr_t, int); | 
 
 
 
 
 | 574 | _CRTIMP __cdecl __MINGW_NOTHROW  int _pipe (int *, unsigned int, int); | 
 
 
 
 
 | 575 | _CRTIMP __cdecl __MINGW_NOTHROW  int _read (int, void *, unsigned int); | 
 
 
 
 
 | 576 | _CRTIMP __cdecl __MINGW_NOTHROW  int _setmode (int, int); | 
 
 
 
 
 | 577 |  | 
 
 
 
 
 | 578 | /* Microsoft declares remove() & rename(), (but not their wchar_t | 
 
 
 
 
 | 579 | * counterparts), in <io.h> as well as in <stdio.h>; these should be | 
 
 
 
 
 | 580 | * consistent with <stdio.h>, but we trust the compiler to alert us | 
 
 
 
 
 | 581 | * (eventually) if not. | 
 
 
 
 
 | 582 | */ | 
 
 
 
 
 | 583 | _CRTIMP __cdecl __MINGW_NOTHROW  int remove (const char *); | 
 
 
 
 
 | 584 | _CRTIMP __cdecl __MINGW_NOTHROW  int rename (const char *, const char *); | 
 
 
 
 
 | 585 |  | 
 
 
 
 
 | 586 | /* Open files with specified sharing attributes; manifest constants | 
 
 
 
 
 | 587 | * for constructing the sharing mode argument are in <share.h>, which | 
 
 
 
 
 | 588 | * users must include.  The optional fourth argument is an unsigned | 
 
 
 
 
 | 589 | * int, specifing permissions to apply after closing a new file. | 
 
 
 
 
 | 590 | */ | 
 
 
 
 
 | 591 | _CRTIMP __cdecl __MINGW_NOTHROW  int _sopen (const char *, int, int, ...); | 
 
 
 
 
 | 592 |  | 
 
 
 
 
 | 593 | _CRTIMP __cdecl __MINGW_NOTHROW  long _tell (int); | 
 
 
 
 
 | 594 |  | 
 
 
 
 
 | 595 | /* FIXME: POSIX wants umask() in <sys/stat.h>, and, although vague, | 
 
 
 
 
 | 596 | * Microsoft may agree; we declare it here as well! | 
 
 
 
 
 | 597 | */ | 
 
 
 
 
 | 598 | _CRTIMP __cdecl __MINGW_NOTHROW  int _umask (int); | 
 
 
 
 
 | 599 | _CRTIMP __cdecl __MINGW_NOTHROW  int _unlink (const char *); | 
 
 
 
 
 | 600 | _CRTIMP __cdecl __MINGW_NOTHROW  int _write (int, const void *, unsigned int); | 
 
 
 
 
 | 601 | #endif  /* _IO_H */ | 
 
 
 
 
 | 602 |  | 
 
 
 
 
 | 603 | #if defined __MSVCRT__ && ! (defined _IO_H && defined _WCHAR_H) | 
 
 
 
 
 | 604 | /* These wchar_t functions are made available for selective inclusion | 
 
 
 
 
 | 605 | * by <wchar.h>, in addition to direct inclusion of <io.h>, but they | 
 
 
 
 
 | 606 | * are only supported by MSVCRT.DLL and derivatives; they don't exist | 
 
 
 
 
 | 607 | * in CRTDLL.DLL.  Furthermore, if both _IO_H and _WCHAR_H have been | 
 
 
 
 
 | 608 | * defined, by the time we get here, then this must be direct <io.h> | 
 
 
 
 
 | 609 | * inclusion, and we've already declared these by prior inclusion of | 
 
 
 
 
 | 610 | * <wchar.h>; there is no need to declare them again. | 
 
 
 
 
 | 611 | */ | 
 
 
 
 
 | 612 | _CRTIMP __cdecl __MINGW_NOTHROW  int _waccess (const wchar_t *, int); | 
 
 
 
 
 | 613 | _CRTIMP __cdecl __MINGW_NOTHROW  int _wchmod (const wchar_t *, int); | 
 
 
 
 
 | 614 | _CRTIMP __cdecl __MINGW_NOTHROW  int _wcreat (const wchar_t *, int); | 
 
 
 
 
 | 615 | _CRTIMP __cdecl __MINGW_NOTHROW  int _wunlink (const wchar_t *); | 
 
 
 
 
 | 616 | _CRTIMP __cdecl __MINGW_NOTHROW  int _wopen (const wchar_t *, int, ...); | 
 
 
 
 
 | 617 | _CRTIMP __cdecl __MINGW_NOTHROW  int _wsopen (const wchar_t *, int, int, ...); | 
 
 
 
 
 | 618 | _CRTIMP __cdecl __MINGW_NOTHROW  wchar_t *_wmktemp (wchar_t *); | 
 
 
 
 
 | 619 | #endif /* __MSVCRT__ && ! (_IO_H && _WCHAR_H) */ | 
 
 
 
 
 | 620 |  | 
 
 
 
 
 | 621 | #if defined _IO_H && ! defined _NO_OLDNAMES | 
 
 
 
 
 | 622 | /* Non-underscored versions of non-ANSI functions to improve portability; | 
 
 
 
 
 | 623 | * these are implemented in libmoldname.a, and once again are declared | 
 
 
 
 
 | 624 | * only when <io.h> is included directly. | 
 
 
 
 
 | 625 | */ | 
 
 
 
 
 | 626 | #ifndef _UWIN | 
 
 
 
 
 | 627 | _CRTIMP __cdecl __MINGW_NOTHROW  int access (const char*, int); | 
 
 
 
 
 | 628 | _CRTIMP __cdecl __MINGW_NOTHROW  int chsize (int, long ); | 
 
 
 
 
 | 629 | _CRTIMP __cdecl __MINGW_NOTHROW  int close (int); | 
 
 
 
 
 | 630 | _CRTIMP __cdecl __MINGW_NOTHROW  int creat (const char*, int); | 
 
 
 
 
 | 631 | _CRTIMP __cdecl __MINGW_NOTHROW  int dup (int); | 
 
 
 
 
 | 632 | _CRTIMP __cdecl __MINGW_NOTHROW  int dup2 (int, int); | 
 
 
 
 
 | 633 | _CRTIMP __cdecl __MINGW_NOTHROW  int eof (int); | 
 
 
 
 
 | 634 | _CRTIMP __cdecl __MINGW_NOTHROW  long filelength (int); | 
 
 
 
 
 | 635 | _CRTIMP __cdecl __MINGW_NOTHROW  int isatty (int); | 
 
 
 
 
 | 636 | _CRTIMP __cdecl __MINGW_NOTHROW  long lseek (int, long, int); | 
 
 
 
 
 | 637 | _CRTIMP __cdecl __MINGW_NOTHROW  int open (const char*, int, ...); | 
 
 
 
 
 | 638 | _CRTIMP __cdecl __MINGW_NOTHROW  int read (int, void*, unsigned int); | 
 
 
 
 
 | 639 | _CRTIMP __cdecl __MINGW_NOTHROW  int setmode (int, int); | 
 
 
 
 
 | 640 | _CRTIMP __cdecl __MINGW_NOTHROW  int sopen (const char*, int, int, ...); | 
 
 
 
 
 | 641 | _CRTIMP __cdecl __MINGW_NOTHROW  long tell (int); | 
 
 
 
 
 | 642 | _CRTIMP __cdecl __MINGW_NOTHROW  int umask (int); | 
 
 
 
 
 | 643 | _CRTIMP __cdecl __MINGW_NOTHROW  int unlink (const char*); | 
 
 
 
 
 | 644 | _CRTIMP __cdecl __MINGW_NOTHROW  int write (int, const void*, unsigned int); | 
 
 
 
 
 | 645 | #endif /* !_UWIN */ | 
 
 
 
 
 | 646 |  | 
 
 
 
 
 | 647 | #ifdef __USE_MINGW_ACCESS | 
 
 
 
 
 | 648 | /* Old versions of MSVCRT.DLL's access() just ignored X_OK, while the | 
 
 
 
 
 | 649 | * version shipped with Vista fails; this inline implementation of the | 
 
 
 
 
 | 650 | * portably named access() function protects against such failure. | 
 
 
 
 
 | 651 | */ | 
 
 
 
 
 | 652 | #define access(__fname,__mode)  __mingw_access (__fname, __mode) | 
 
 
 
 
 | 653 | static __inline__ int __mingw_access (const char* __fname, int __mode) | 
 
 
 
 
 | 654 | { return  _access (__fname, __mode & ~X_OK); } | 
 
 
 
 
 | 655 | #endif  /* _USE_MINGW_ACCESS */ | 
 
 
 
 
 | 656 |  | 
 
 
 
 
 | 657 | #if 0 | 
 
 
 
 
 | 658 | /* FIXME: | 
 
 
 
 
 | 659 | * Wide character versions: may also be declared in <wchar.h>. | 
 
 
 
 
 | 660 | * Where do these live?  Not in libmoldname.a nor in libmsvcrt.a; | 
 
 
 
 
 | 661 | * do they exist at all? | 
 
 
 
 
 | 662 | */ | 
 
 
 
 
 | 663 | int             waccess(const wchar_t *, int); | 
 
 
 
 
 | 664 | int             wchmod(const wchar_t *, int); | 
 
 
 
 
 | 665 | int             wcreat(const wchar_t *, int); | 
 
 
 
 
 | 666 | long            wfindfirst(wchar_t *, struct _wfinddata_t *); | 
 
 
 
 
 | 667 | int             wfindnext(long, struct _wfinddata_t *); | 
 
 
 
 
 | 668 | int             wunlink(const wchar_t *); | 
 
 
 
 
 | 669 | int             wrename(const wchar_t *, const wchar_t *); | 
 
 
 
 
 | 670 | int             wopen(const wchar_t *, int, ...); | 
 
 
 
 
 | 671 | int             wsopen(const wchar_t *, int, int, ...); | 
 
 
 
 
 | 672 | wchar_t *       wmktemp(wchar_t *); | 
 
 
 
 
 | 673 | #endif | 
 
 
 
 
 | 674 |  | 
 
 
 
 
 | 675 | #endif  /* !_NO_OLDNAMES */ | 
 
 
 
 
 | 676 |  | 
 
 
 
 
 | 677 | _END_C_DECLS | 
 
 
 
 
 | 678 |  | 
 
 
 
 
 | 679 | #endif  /* ! RC_INVOKED */ | 
 
 
 
 
 | 680 | #endif  /* !_IO_H: $RCSfile: io.h,v $: end of file */ |