-/* Replacement for POSIX fnmatch() (partial functionality only) */
-int
-fnmatch(const wchar_t *pattern, const wchar_t *string, int flags)
-{
- if (PathMatchSpecW(string, pattern))
- return 0;
- else
- return FNM_NOMATCH;
-}
-
-/* truncate() replacement */
-int
-win32_truncate_replacement(const wchar_t *path, off_t size)
-{
- DWORD err = NO_ERROR;
- LARGE_INTEGER liOffset;
-
- HANDLE h = win32_open_existing_file(path, GENERIC_WRITE);
- if (h == INVALID_HANDLE_VALUE)
- goto fail;
-
- liOffset.QuadPart = size;
- if (!SetFilePointerEx(h, liOffset, NULL, FILE_BEGIN))
- goto fail_close_handle;
-
- if (!SetEndOfFile(h))
- goto fail_close_handle;
- CloseHandle(h);
- return 0;
-
-fail_close_handle:
- err = GetLastError();
- CloseHandle(h);
-fail:
- if (err == NO_ERROR)
- err = GetLastError();
- set_errno_from_win32_error(err);
- return -1;
-}
-
-