2 * Copyright (C) 1997, Index Data I/S
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.2 1997-09-17 12:19:24 adam
8 * Zebra version corresponds to YAZ version 1.4.
9 * Changed Zebra server so that it doesn't depend on global common_resource.
13 * This utility implements a opendir/readdir/close on Windows.
26 WIN32_FIND_DATA find_data;
30 DIR *opendir (const char *name)
32 char fullName[MAX_PATH+1];
33 DIR *dd = malloc (sizeof(*dd));
37 strcpy (fullName, name);
38 strcat (fullName, "\\*.*");
39 dd->handle = FindFirstFile(fullName, &dd->find_data);
43 struct dirent *readdir (DIR *dd)
45 if (dd->handle == INVALID_HANDLE_VALUE)
47 strcpy (dd->entry.d_name, dd->find_data.cFileName);
48 if (!FindNextFile(dd->handle, &dd->find_data))
50 FindClose (dd->handle);
51 dd->handle = INVALID_HANDLE_VALUE;
56 void closedir(DIR *dd)
58 if (dd->handle != INVALID_HANDLE_VALUE)
59 FindClose (dd->handle);