1: Name: glob 2: Description: Directory Serivces 3: Version: $Id$ 4:
1: #line 26 "./lpsrc/flx_glob.pak" 2: 3: if WIN32: 4: GLOB_CPPS = [ 5: 'unixem/flx_glob', 6: 'unixem/unixem_util', 7: 8: ] 9: else: 10: GLOB_CPPS = [] 11: 12: GLOB_INTERFACES = ['unixem/flx_glob.hpp'] 13: 14: cpp_cpps = GLOB_CPPS 15: rtl_interfaces = GLOB_INTERFACES 16: lib_requires = ['libflx_gc'] 17: pkg_requires = ['flx_rtl'] # flx_rtl provides flx_rtl_config.hpp 18: iscr_source = ["lpsrc/flx_glob.pak"] 19: build_macro = "GLOB" 20: weaver_directory = 'doc/rtl/flx_glob/' 21: unit_tests = glob.glob('test/glob/glob-*.flx') 22:
1: #line 49 "./lpsrc/flx_glob.pak" 2: #ifndef __FLX_GLOB_CONFIG_H__ 3: #define __FLX_GLOB_CONFIG_H__ 4: #include "flx_rtl_config.hpp" 5: #ifdef BUILD_GLOB 6: #define GLOB_EXTERN FLX_EXPORT 7: #else 8: #define GLOB_EXTERN FLX_IMPORT 9: #endif 10: #endif 11:
1: /* ///////////////////////////////////////////////////////////////////////////// 2: * File: glob.c 3: * 4: * Purpose: Definition of the glob() API functions for the Win32 platform. 5: * 6: * Created: 13th November 2002 7: * Updated: 12th September 2006 8: * 9: * Home: http://synesis.com.au/software/ 10: * 11: * Copyright (c) 2002-2006, Matthew Wilson and Synesis Software 12: * All rights reserved. 13: * 14: * Redistribution and use in source and binary forms, with or without 15: * modification, are permitted provided that the following conditions are met: 16: * 17: * - Redistributions of source code must retain the above copyright notice, this 18: * list of conditions and the following disclaimer. 19: * - Redistributions in binary form must reproduce the above copyright notice, 20: * this list of conditions and the following disclaimer in the documentation 21: * and/or other materials provided with the distribution. 22: * - Neither the names of Matthew Wilson and Synesis Software nor the names of 23: * any contributors may be used to endorse or promote products derived from 24: * this software without specific prior written permission. 25: * 26: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 27: * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 28: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 29: * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 30: * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31: * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 32: * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 33: * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 34: * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 35: * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 36: * POSSIBILITY OF SUCH DAMAGE. 37: * 38: * ////////////////////////////////////////////////////////////////////////// */ 39:
1: #line 101 "./lpsrc/flx_glob.pak" 2: #ifndef __UNIXEM_UTIL_ 3: #define __UNIXEM_UTIL_ 4: 5: int errno_from_Win32(unsigned long w32Err); 6: char get_current_drive(void); 7: # define UNIXEM_NUM_ELEMENTS(x) (sizeof(x) / sizeof(0[x])) 8: #endif 9: 10:
1: #line 112 "./lpsrc/flx_glob.pak" 2: 3: #include "unixem_util.hpp" 4: 5: #include <assert.h> 6: #include <errno.h> 7: #include <limits.h> 8: #include <windows.h> 9: 10: #if !defined(ECURDIR) 11: # define ECURDIR EACCES 12: #endif /* !ECURDIR */ 13: #if !defined(ENOSYS) 14: # define ENOSYS EPERM 15: #endif /* !ENOSYS */ 16: 17: int errno_from_Win32(unsigned long w32Err) 18: { 19: struct errmap_t 20: { 21: unsigned long w32Err; 22: int eerrno; 23: }; 24: 25: static const struct errmap_t errmap[] = 26: { 27: /* 1 */ { ERROR_INVALID_FUNCTION , EINVAL } 28: /* 2 */ , { ERROR_FILE_NOT_FOUND , ENOENT } 29: /* 3 */ , { ERROR_PATH_NOT_FOUND , ENOENT } 30: /* 4 */ , { ERROR_TOO_MANY_OPEN_FILES , EMFILE } 31: /* 5 */ , { ERROR_ACCESS_DENIED , EACCES } 32: /* 6 */ , { ERROR_INVALID_HANDLE , EBADF } 33: /* 7 */ , { ERROR_ARENA_TRASHED , ENOMEM } 34: /* 8 */ , { ERROR_NOT_ENOUGH_MEMORY , ENOMEM } 35: /* 9 */ , { ERROR_INVALID_BLOCK , ENOMEM } 36: /* 10 */ , { ERROR_BAD_ENVIRONMENT , E2BIG } 37: /* 11 */ , { ERROR_BAD_FORMAT , ENOEXEC } 38: /* 12 */ , { ERROR_INVALID_ACCESS , EINVAL } 39: /* 13 */ , { ERROR_INVALID_DATA , EINVAL } 40: /* 14 */ , { ERROR_OUTOFMEMORY , ENOMEM } 41: /* 15 */ , { ERROR_INVALID_DRIVE , ENOENT } 42: /* 16 */ , { ERROR_CURRENT_DIRECTORY , ECURDIR } 43: /* 17 */ , { ERROR_NOT_SAME_DEVICE , EXDEV } 44: /* 18 */ , { ERROR_NO_MORE_FILES , ENOENT } 45: /* 19 */ , { ERROR_WRITE_PROTECT , EROFS } 46: /* 20 */ , { ERROR_BAD_UNIT , ENXIO } 47: /* 21 */ , { ERROR_NOT_READY , EBUSY } 48: /* 22 */ , { ERROR_BAD_COMMAND , EIO } 49: /* 23 */ , { ERROR_CRC , EIO } 50: /* 24 */ , { ERROR_BAD_LENGTH , EIO } 51: /* 25 */ , { ERROR_SEEK , EIO } 52: /* 26 */ , { ERROR_NOT_DOS_DISK , EIO } 53: /* 27 */ , { ERROR_SECTOR_NOT_FOUND , ENXIO } 54: /* 28 */ , { ERROR_OUT_OF_PAPER , EBUSY } 55: /* 29 */ , { ERROR_WRITE_FAULT , EIO } 56: /* 30 */ , { ERROR_READ_FAULT , EIO } 57: /* 31 */ , { ERROR_GEN_FAILURE , EIO } 58: /* 32 */ , { ERROR_SHARING_VIOLATION , EAGAIN } 59: /* 33 */ , { ERROR_LOCK_VIOLATION , EACCES } 60: /* 34 */ , { ERROR_WRONG_DISK , ENXIO } 61: /* 35 */ , { 35 , ENFILE } 62: /* 36 */ , { ERROR_SHARING_BUFFER_EXCEEDED , ENFILE } 63: /* 37 */ , { ERROR_HANDLE_EOF , EINVAL } 64: /* 38 */ , { ERROR_HANDLE_DISK_FULL , ENOSPC } 65: /* 39 */ , { 0 , 0 } 66: /* 40 */ , { 0 , 0 } 67: /* 41 */ , { 0 , 0 } 68: /* 42 */ , { 0 , 0 } 69: /* 43 */ , { 0 , 0 } 70: /* 44 */ , { 0 , 0 } 71: /* 45 */ , { 0 , 0 } 72: /* 46 */ , { 0 , 0 } 73: /* 47 */ , { 0 , 0 } 74: /* 48 */ , { 0 , 0 } 75: /* 49 */ , { 0 , 0 } 76: /* 50 */ , { ERROR_NOT_SUPPORTED , ENOSYS } 77: /* 51 */ , { 0 , 0 } 78: /* 52 */ , { 0 , 0 } 79: /* 53 */ , { ERROR_BAD_NETPATH , ENOENT } 80: /* 54 */ , { 0 , 0 } 81: /* 55 */ , { 0 , 0 } 82: /* 56 */ , { 0 , 0 } 83: /* 57 */ , { 0 , 0 } 84: /* 58 */ , { 0 , 0 } 85: /* 59 */ , { 0 , 0 } 86: /* 60 */ , { 0 , 0 } 87: /* 61 */ , { 0 , 0 } 88: /* 62 */ , { 0 , 0 } 89: /* 63 */ , { 0 , 0 } 90: /* 64 */ , { 0 , 0 } 91: /* 65 */ , { ERROR_NETWORK_ACCESS_DENIED , EACCES } 92: /* 66 */ , { 0 , 0 } 93: /* 67 */ , { ERROR_BAD_NET_NAME , ENOENT } 94: /* 68 */ , { 0 , 0 } 95: /* 69 */ , { 0 , 0 } 96: /* 70 */ , { 0 , 0 } 97: /* 71 */ , { 0 , 0 } 98: /* 72 */ , { 0 , 0 } 99: /* 73 */ , { 0 , 0 } 100: /* 74 */ , { 0 , 0 } 101: /* 75 */ , { 0 , 0 } 102: /* 76 */ , { 0 , 0 } 103: /* 77 */ , { 0 , 0 } 104: /* 78 */ , { 0 , 0 } 105: /* 79 */ , { 0 , 0 } 106: /* 80 */ , { ERROR_FILE_EXISTS , EEXIST } 107: /* 81 */ , { 0 , 0 } 108: /* 82 */ , { ERROR_CANNOT_MAKE , EACCES } 109: /* 83 */ , { ERROR_FAIL_I24 , EACCES } 110: /* 84 */ , { 0 , 0 } 111: /* 85 */ , { 0 , 0 } 112: /* 86 */ , { 0 , 0 } 113: /* 87 */ , { ERROR_INVALID_PARAMETER , EINVAL } 114: /* 88 */ , { 0 , 0 } 115: /* 89 */ , { ERROR_NO_PROC_SLOTS , EAGAIN } 116: /* 90 */ , { 0 , 0 } 117: /* 91 */ , { 0 , 0 } 118: /* 92 */ , { 0 , 0 } 119: /* 93 */ , { 0 , 0 } 120: /* 94 */ , { 0 , 0 } 121: /* 95 */ , { 0 , 0 } 122: /* 96 */ , { 0 , 0 } 123: /* 97 */ , { 0 , 0 } 124: /* 98 */ , { 0 , 0 } 125: /* 99 */ , { 0 , 0 } 126: /* 100 */ , { 0 , 0 } 127: /* 101 */ , { 0 , 0 } 128: /* 102 */ , { 0 , 0 } 129: /* 103 */ , { 0 , 0 } 130: /* 104 */ , { 0 , 0 } 131: /* 105 */ , { 0 , 0 } 132: /* 106 */ , { 0 , 0 } 133: /* 107 */ , { 0 , 0 } 134: /* 108 */ , { ERROR_DRIVE_LOCKED , EACCES } 135: /* 109 */ , { ERROR_BROKEN_PIPE , EPIPE } 136: /* 110 */ , { 0 , 0 } 137: /* 111 */ , { 0 , 0 } 138: /* 112 */ , { ERROR_DISK_FULL , ENOSPC } 139: /* 113 */ , { 0 , 0 } 140: /* 114 */ , { ERROR_INVALID_TARGET_HANDLE , EBADF } 141: /* 115 */ , { 0 , 0 } 142: /* 116 */ , { 0 , 0 } 143: /* 117 */ , { 0 , 0 } 144: /* 118 */ , { 0 , 0 } 145: /* 119 */ , { 0 , 0 } 146: /* 120 */ , { 0 , 0 } 147: /* 121 */ , { 0 , 0 } 148: /* 122 */ , { 0 , 0 } 149: /* 123 */ , { ERROR_INVALID_NAME , ENOENT } 150: /* 124 */ , { ERROR_INVALID_HANDLE , EINVAL } 151: /* 125 */ , { 0 , 0 } 152: /* 126 */ , { 0 , 0 } 153: /* 127 */ , { 0 , 0 } 154: /* 128 */ , { ERROR_WAIT_NO_CHILDREN , ECHILD } 155: /* 129 */ , { ERROR_CHILD_NOT_COMPLETE , ECHILD } 156: /* 130 */ , { ERROR_DIRECT_ACCESS_HANDLE , EBADF } 157: /* 131 */ , { ERROR_NEGATIVE_SEEK , EINVAL } 158: /* 132 */ , { ERROR_SEEK_ON_DEVICE , EACCES } 159: /* 133 */ , { 0 , 0 } 160: /* 134 */ , { 0 , 0 } 161: /* 135 */ , { 0 , 0 } 162: /* 136 */ , { 0 , 0 } 163: /* 137 */ , { 0 , 0 } 164: /* 138 */ , { 0 , 0 } 165: /* 139 */ , { 0 , 0 } 166: /* 140 */ , { 0 , 0 } 167: /* 141 */ , { 0 , 0 } 168: /* 142 */ , { 0 , 0 } 169: /* 143 */ , { 0 , 0 } 170: /* 144 */ , { 0 , 0 } 171: /* 145 */ , { ERROR_DIR_NOT_EMPTY , ENOTEMPTY } 172: /* 146 */ , { 0 , 0 } 173: /* 147 */ , { 0 , 0 } 174: /* 148 */ , { 0 , 0 } 175: /* 149 */ , { 0 , 0 } 176: /* 150 */ , { 0 , 0 } 177: /* 151 */ , { 0 , 0 } 178: /* 152 */ , { 0 , 0 } 179: /* 153 */ , { 0 , 0 } 180: /* 154 */ , { 0 , 0 } 181: /* 155 */ , { 0 , 0 } 182: /* 156 */ , { 0 , 0 } 183: /* 157 */ , { 0 , 0 } 184: /* 158 */ , { ERROR_NOT_LOCKED , EACCES } 185: /* 159 */ , { 0 , 0 } 186: /* 160 */ , { 0 , 0 } 187: /* 161 */ , { ERROR_BAD_PATHNAME , ENOENT } 188: /* 162 */ , { 0 , 0 } 189: /* 163 */ , { 0 , 0 } 190: /* 164 */ , { ERROR_MAX_THRDS_REACHED , EAGAIN } 191: /* 165 */ , { 0 , 0 } 192: /* 166 */ , { 0 , 0 } 193: /* 167 */ , { ERROR_LOCK_FAILED , EACCES } 194: /* 168 */ , { 0 , 0 } 195: /* 169 */ , { 0 , 0 } 196: /* 170 */ , { 0 , 0 } 197: /* 171 */ , { 0 , 0 } 198: /* 172 */ , { 0 , 0 } 199: /* 173 */ , { 0 , 0 } 200: /* 174 */ , { 0 , 0 } 201: /* 175 */ , { 0 , 0 } 202: /* 176 */ , { 0 , 0 } 203: /* 177 */ , { 0 , 0 } 204: /* 178 */ , { 0 , 0 } 205: /* 179 */ , { 0 , 0 } 206: /* 180 */ , { 0 , 0 } 207: /* 181 */ , { 0 , 0 } 208: /* 182 */ , { 0 , 0 } 209: /* 183 */ , { ERROR_ALREADY_EXISTS , EEXIST } 210: /* 184 */ , { 0 , 0 } 211: /* 185 */ , { 0 , 0 } 212: /* 186 */ , { 0 , 0 } 213: /* 187 */ , { 0 , 0 } 214: /* 188 */ , { 0 , 0 } 215: /* 189 */ , { 0 , 0 } 216: /* 190 */ , { 0 , 0 } 217: /* 191 */ , { 0 , 0 } 218: /* 192 */ , { 0 , 0 } 219: /* 193 */ , { 0 , 0 } 220: /* 194 */ , { 0 , 0 } 221: /* 195 */ , { 0 , 0 } 222: /* 196 */ , { 0 , 0 } 223: /* 197 */ , { 0 , 0 } 224: /* 198 */ , { 0 , 0 } 225: /* 199 */ , { 0 , 0 } 226: 227: /* 206 */ , { ERROR_FILENAME_EXCED_RANGE , ENAMETOOLONG } 228: 229: /* 215 */ , { ERROR_NESTING_NOT_ALLOWED , EAGAIN } 230: 231: /* 267 */ , { ERROR_DIRECTORY , ENOTDIR } 232: 233: #ifdef EINPROGRESS 234: /* 997 */ , { ERROR_IO_PENDING , EINPROGRESS } 235: #else /* ? EINPROGRESS */ 236: /* 997 */ , { ERROR_IO_PENDING , EBUSY } 237: #endif /* EINPROGRESS */ 238: 239: /* 1816 */ , { ERROR_NOT_ENOUGH_QUOTA , ENOMEM } 240: }; 241: 242: size_t i; 243: 244: for(i = 0; i < UNIXEM_NUM_ELEMENTS(errmap); ++i) 245: { 246: if(w32Err == errmap[i].w32Err) 247: { 248: return errmap[i].eerrno; 249: } 250: } 251: 252: assert(!"Unrecognised value"); 253: 254: return EINVAL; 255: } 256: 257: char get_current_drive(void) 258: { 259: char szDrive[1 + _MAX_PATH] = ""; 260: DWORD dw = GetCurrentDirectoryA(UNIXEM_NUM_ELEMENTS(szDrive), &szDrive[0]); 261: 262: if(dw < UNIXEM_NUM_ELEMENTS(szDrive)) 263: { 264: if( szDrive[0] < 'A' || 265: szDrive[0] > 'Z') 266: { 267: szDrive[0] = (char)('A' + (szDrive[0] - 'a')); 268: } 269: 270: return szDrive[0]; 271: } 272: else 273: { 274: errno = errno_from_Win32(GetLastError()); 275: 276: return '\0'; 277: } 278: } 279: 280:
1: #line 393 "./lpsrc/flx_glob.pak" 2: #ifndef SYNSOFT_UNIXEM_INCL_H_UNISTD 3: #define SYNSOFT_UNIXEM_INCL_H_UNISTD 4: 5: #include <stddef.h> /* for size_t */ 6: #include <sys/types.h> /* for mode_t */ 7: 8: /* Some of the functions declared here (and defined in unistd.c) may be 9: * provided by some Win32 compilers. So we discriminate for support here, 10: * and exclude definitions as appropriate. 11: */ 12: 13: #if defined(__BORLANDC__) 14: # include <dir.h> 15: # define UNIXEM_chdir_PROVIDED_BY_COMPILER 16: # define UNIXEM_getcwd_PROVIDED_BY_COMPILER 17: # define UNIXEM_mkdir_PROVIDED_BY_COMPILER 18: # define UNIXEM_rmdir_PROVIDED_BY_COMPILER 19: #elif defined(__DMC__) 20: # include <direct.h> 21: # define UNIXEM_chdir_PROVIDED_BY_COMPILER 22: # define UNIXEM_close_PROVIDED_BY_COMPILER 23: # define UNIXEM_getcwd_PROVIDED_BY_COMPILER 24: #elif defined(__GNUC__) 25: # include <io.h> 26: # define UNIXEM_chdir_PROVIDED_BY_COMPILER 27: # define UNIXEM_chmod_PROVIDED_BY_COMPILER 28: # define UNIXEM_getcwd_PROVIDED_BY_COMPILER 29: # define UNIXEM_mkdir_PROVIDED_BY_COMPILER 30: # define UNIXEM_rmdir_PROVIDED_BY_COMPILER 31: #elif defined(__INTEL_COMPILER) 32: # if defined(_WIN32) && \ 33: !defined(__STDC__) 34: # include <direct.h> 35: # define UNIXEM_chdir_PROVIDED_BY_COMPILER 36: # define UNIXEM_getcwd_PROVIDED_BY_COMPILER 37: # define UNIXEM_mkdir_PROVIDED_BY_COMPILER 38: # define UNIXEM_rmdir_PROVIDED_BY_COMPILER 39: # endif /* !__STDC__ */ 40: #elif defined(__MWERKS__) 41: # define UNIXEM_mkdir_PROVIDED_BY_COMPILER 42: #elif defined(__WATCOMC__) 43: # define UNIXEM_chdir_PROVIDED_BY_COMPILER 44: # define UNIXEM_getcwd_PROVIDED_BY_COMPILER 45: # define UNIXEM_mkdir_PROVIDED_BY_COMPILER 46: # define UNIXEM_rmdir_PROVIDED_BY_COMPILER 47: #elif defined(_MSC_VER) 48: # if !defined(__STDC__) 49: # include <direct.h> 50: # define UNIXEM_chdir_PROVIDED_BY_COMPILER 51: # define UNIXEM_getcwd_PROVIDED_BY_COMPILER 52: # define UNIXEM_mkdir_PROVIDED_BY_COMPILER 53: # define UNIXEM_rmdir_PROVIDED_BY_COMPILER 54: # endif /* !__STDC__ */ 55: #else 56: # error Compiler not discriminated 57: #endif /* compiler */ 58: 59: 60: #if defined(_MSC_VER) && \ 61: !defined(__STDC__) 62: # define UNIXEM_UNISTD_INCLUDING_MS_DIRECT_H 63: #endif /* compiler */ 64: 65: #ifndef _WIN32 66: # error This file is only currently defined for compilation on Win32 systems 67: #endif /* _WIN32 */ 68: 69: /* ///////////////////////////////////////////////////////////////////////////// 70: * Constants and definitions 71: */ 72: 73: //#ifndef PATH_MAX 74: //# define PATH_MAX (260) /*!< \brief The maximum number of characters (including null terminator) in a directory entry name */ 75: //#endif /* !PATH_MAX */ 76: 77: enum 78: { 79: _PC_LINK_MAX /*!< The maximum number of links to the file. */ 80: #define _PC_LINK_MAX _PC_LINK_MAX 81: , _PC_MAX_CANON /*!< Maximum number of bytes in canonical input line. Applicable only to terminal devices. */ 82: #define _PC_MAX_CANON _PC_MAX_CANON 83: , _PC_MAX_INPUT /*!< Maximum number of bytes allowed in an input queue. Applicable only to terminal devices. */ 84: #define _PC_MAX_INPUT _PC_MAX_INPUT 85: , _PC_NAME_MAX /*!< Maximum number of bytes in a file name, not including a nul terminator. This number can range from 14 through 255. This value is applicable only to a directory file. */ 86: #define _PC_NAME_MAX _PC_NAME_MAX 87: , _PC_PATH_MAX /*!< Maximum number of bytes in a path name, including a nul terminator. */ 88: #define _PC_PATH_MAX _PC_PATH_MAX 89: 90: , _PC_PIPE_BUF /*!< Maximum number of bytes guaranteed to be written atomically. This value is applicable only to a first-in-first-out (FIFO). */ 91: #define _PC_PIPE_BUF _PC_PIPE_BUF 92: , _PC_CHOWN_RESTRICTED /*!< Returns 0 if the use of the chown subroutine is restricted to a process with appropriate privileges, and if the chown subroutine is restricted to changing the group ID of a file only to the effective group ID of the process or to one of its supplementary group IDs. */ 93: #define _PC_CHOWN_RESTRICTED _PC_CHOWN_RESTRICTED 94: , _PC_NO_TRUNC /*!< Returns 0 if long component names are truncated. This value is applicable only to a directory file. */ 95: #define _PC_NO_TRUNC _PC_NO_TRUNC 96: , _PC_VDISABLE /*!< This is always 0. No disabling character is defined. This value is applicable only to a terminal device. */ 97: #define _PC_VDISABLE _PC_VDISABLE 98: , _PC_AIX_DISK_PARTITION /*!< Determines the physical partition size of the disk. 99: Note: 100: The _PC_AIX_DISK_PARTITION variable is available only to the root user. */ 101: #define _PC_AIX_DISK_PARTITION _PC_AIX_DISK_PARTITION 102: , _PC_AIX_DISK_SIZE /*!< Determines the disk size in megabytes. 103: Note: 104: The _PC_AIX_DISK_SIZE variable is available only to the root user. 105: Note: 106: The _PC_FILESIZEBITS and PC_SYNC_IO flags apply to AIX 4.3 and later releases. */ 107: #define _PC_AIX_DISK_SIZE _PC_AIX_DISK_SIZE 108: , _PC_FILESIZEBITS /*!< Returns the minimum number of bits required to hold the file system's maximum file size as a signed integer. The smallest value returned is 32. */ 109: #define _PC_FILESIZEBITS _PC_FILESIZEBITS 110: , _PC_SYNC_IO /*!< Returns -1 if the file system does not support the Synchronized Input and Output option. Any value other than -1 is returned if the file system supports the option. */ 111: #define _PC_SYNC_IO _PC_SYNC_IO 112: }; 113: 114: #ifdef __cplusplus 115: extern "C" { 116: #endif /* __cplusplus */ 117: 118: /** \brief Creates a hardlink. 119: * 120: * This function creates a link from \c originalFile to \c linkName. 121: * 122: * \param originalFile Path of the original file 123: * \param linkName Path of the link 124: * 125: * \return O on success, or -1 if there is an error 126: * 127: * \note Hardlink support is only available on Windows 2000 and later, and only 128: * works within a single drive. 129: */ 130: int link(const char *originalFile, const char *linkName); 131: 132: /** \brief Unlinks a file or directory 133: * 134: * \param path The path of the file or directory to unlink 135: * 136: * \return O on success, or -1 if there is an error 137: */ 138: int unlink(const char *path); 139: 140: 141: /** \brief Change the current working directory. 142: * 143: * This function changes the current working directory to the directory 144: * specified by dirName. dirName must refer to an existing directory. 145: * 146: * \param dirName Path of new working directory 147: * \return O on success, or -1 if there is an error 148: */ 149: #ifndef UNIXEM_chdir_PROVIDED_BY_COMPILER 150: int chdir(const char *dirName); 151: #endif /* !UNIXEM_chdir_PROVIDED_BY_COMPILER */ 152: 153: 154: /** \brief Get the current working directory 155: * 156: * This function gets the full path of the current working directory 157: * and stores it in buffer. 158: * 159: * \param buffer Storage location for the current working directory 160: * \param max_len Maximum length of path (in characters) 161: * \return buffer on success, or NULL to indicate error. 162: */ 163: #ifndef UNIXEM_getcwd_PROVIDED_BY_COMPILER 164: char *getcwd(char *buffer, size_t max_len); 165: #endif /* !UNIXEM_getcwd_PROVIDED_BY_COMPILER */ 166: 167: 168: /** \brief Creates the given directory 169: * 170: * This function creates the named directory. 171: * 172: * \param dirName Path of directory to remove 173: * \param mode The access permissions of the directory 174: * 175: * \return O on success, or -1 if there is an error 176: */ 177: #ifndef UNIXEM_mkdir_PROVIDED_BY_COMPILER 178: int mkdir(const char *dirName, unsigned mode); 179: #endif /* !UNIXEM_mkdir_PROVIDED_BY_COMPILER */ 180: 181: 182: /** \brief Removes the given directory 183: * 184: * This function removes the named directory. 185: * 186: * \param dirName Path of directory to remove 187: * \return O on success, or -1 if there is an error 188: */ 189: #ifndef UNIXEM_rmdir_PROVIDED_BY_COMPILER 190: int rmdir(const char *dirName); 191: #endif /* !UNIXEM_rmdir_PROVIDED_BY_COMPILER */ 192: 193: /** \brief Closes a file 194: * 195: * \param handle The handle of the file to be closed 196: * \return 0 on success, or -1 if there is an error 197: */ 198: #ifndef UNIXEM_close_PROVIDED_BY_COMPILER 199: int close(int handle); 200: #endif /* !UNIXEM_close_PROVIDED_BY_COMPILER */ 201: 202: /** \brief Creates a pipe 203: * 204: * \param handles An array of two handles. handles[0] will be set to the 205: * read stream. handels[1] will be set to the write stream 206: * \return 0 on success, or -1 if there is an error 207: */ 208: /* int pipe(int handles[2]); */ 209: 210: /** \brief Returns the size, in bytes, of the page size 211: */ 212: int getpagesize(void); 213: 214: /** \brief Provides access to various system limits not available at compile time 215: */ 216: long pathconf(char const *path, int name); 217: 218: 219: /** \brief Turns \c path into a fully qualified path, resolving all symbolic 220: * links, multiple /, /./ and /../ 221: * 222: * \param path The relative path to be converted into absolute form 223: * \param resolvedPath Pointer to a buffer to receive the path. This must contain 224: * sufficient storage for a valid path 225: */ 226: char *realpath(char const *path, char resolvedPath[]); 227: 228: /** \brief Suspends execution for the given internal 229: * 230: * \param microSeconds The number of microseconds in the sleep interval 231: */ 232: int usleep(unsigned long microSeconds); 233: 234: #ifdef __cplusplus 235: } /* extern "C" */ 236: #endif /* __cplusplus */ 237: 238: #endif /* SYNSOFT_UNIXEM_INCL_H_UNISTD */ 239: 240: