2 * Copyright (C) 1997-1999, Index Data
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.4 2002-04-04 14:14:14 adam
8 * Multiple registers (alpha early)
10 * Revision 1.3 1999/02/02 14:51:38 adam
11 * Updated WIN32 code specific sections. Changed header.
13 * Revision 1.2 1997/09/17 12:19:24 adam
14 * Zebra version corresponds to YAZ version 1.4.
15 * Changed Zebra server so that it doesn't depend on global common_resource.
19 * This utility implements a opendir/readdir/close on Windows.
32 WIN32_FIND_DATA find_data;
36 DIR *opendir (const char *name)
38 char fullName[MAX_PATH+1];
39 DIR *dd = malloc (sizeof(*dd));
43 strcpy (fullName, name);
44 strcat (fullName, "\\*.*");
45 dd->handle = FindFirstFile(fullName, &dd->find_data);
49 struct dirent *readdir (DIR *dd)
51 if (dd->handle == INVALID_HANDLE_VALUE)
53 strcpy (dd->entry.d_name, dd->find_data.cFileName);
54 if (!FindNextFile(dd->handle, &dd->find_data))
56 FindClose (dd->handle);
57 dd->handle = INVALID_HANDLE_VALUE;
62 void closedir(DIR *dd)
64 if (dd->handle != INVALID_HANDLE_VALUE)
65 FindClose (dd->handle);
72 int zebra_is_abspath (const char *p)
79 if (*p && p[1] == ':' && isalpha(*p))