2 * Copyright (C) 1997-1999, Index Data
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.3 1999-02-02 14:51:38 adam
8 * Updated WIN32 code specific sections. Changed header.
10 * Revision 1.2 1997/09/17 12:19:24 adam
11 * Zebra version corresponds to YAZ version 1.4.
12 * Changed Zebra server so that it doesn't depend on global common_resource.
16 * This utility implements a opendir/readdir/close on Windows.
29 WIN32_FIND_DATA find_data;
33 DIR *opendir (const char *name)
35 char fullName[MAX_PATH+1];
36 DIR *dd = malloc (sizeof(*dd));
40 strcpy (fullName, name);
41 strcat (fullName, "\\*.*");
42 dd->handle = FindFirstFile(fullName, &dd->find_data);
46 struct dirent *readdir (DIR *dd)
48 if (dd->handle == INVALID_HANDLE_VALUE)
50 strcpy (dd->entry.d_name, dd->find_data.cFileName);
51 if (!FindNextFile(dd->handle, &dd->find_data))
53 FindClose (dd->handle);
54 dd->handle = INVALID_HANDLE_VALUE;
59 void closedir(DIR *dd)
61 if (dd->handle != INVALID_HANDLE_VALUE)
62 FindClose (dd->handle);