Partial port to WIN95/NT.
authorAdam Dickmeiss <adam@indexdata.dk>
Tue, 9 Sep 1997 13:37:52 +0000 (13:37 +0000)
committerAdam Dickmeiss <adam@indexdata.dk>
Tue, 9 Sep 1997 13:37:52 +0000 (13:37 +0000)
29 files changed:
bfile/bfile.c
bfile/mfile.c
dfa/agrep.c
dict/dclose.c
dict/dopen.c
dict/drdwr.c
include/direntz.h [new file with mode: 0644]
index/dir.c
index/dirs.c
index/extract.c
index/kdump.c
index/kinput.c
index/lockidx.c
index/lockutil.c
index/main.c
index/recstat.c
index/symtab.c
index/trav.c
isam/issh.c
isam/memory.c
isam/physical.c
recctrl/recgrs.c
rset/rsbool.c
rset/rsm_or.c
rset/rsrel.c
rset/rssbool.c
rset/rstemp.c
util/dirent.c [new file with mode: 0644]
util/res.c

index d1a684a..993f3b2 100644 (file)
@@ -4,7 +4,10 @@
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: bfile.c,v $
- * Revision 1.21  1996-10-29 13:56:13  adam
+ * Revision 1.22  1997-09-09 13:37:52  adam
+ * Partial port to WIN95/NT.
+ *
+ * Revision 1.21  1996/10/29 13:56:13  adam
  * Include of zebrautl.h instead of alexutil.h.
  *
  * Revision 1.20  1996/03/26 15:59:04  adam
 #include <stdlib.h>
 #include <string.h>
 #include <assert.h>
+#ifdef WINDOWS
+#include <io.h>
+#else
 #include <unistd.h>
+#endif
 
 #include <zebrautl.h>
 #include <bfile.h>
index b2f3012..a87ac69 100644 (file)
@@ -4,7 +4,10 @@
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: mfile.c,v $
- * Revision 1.22  1997-09-04 13:56:39  adam
+ * Revision 1.23  1997-09-09 13:37:53  adam
+ * Partial port to WIN95/NT.
+ *
+ * Revision 1.22  1997/09/04 13:56:39  adam
  * Added O_BINARY to open calls.
  *
  * Revision 1.21  1996/10/29 13:56:18  adam
 
 #include <sys/types.h>
 #include <fcntl.h>
+#ifdef WINDOWS
+#include <io.h>
+#else
 #include <unistd.h>
-#include <dirent.h>
+#endif
+#include <direntz.h>
+#include <string.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <assert.h>
index f63e7da..2214fb5 100644 (file)
@@ -4,7 +4,10 @@
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: agrep.c,v $
- * Revision 1.9  1996-10-29 13:57:18  adam
+ * Revision 1.10  1997-09-09 13:37:57  adam
+ * Partial port to WIN95/NT.
+ *
+ * Revision 1.9  1996/10/29 13:57:18  adam
  * Include of zebrautl.h instead of alexutil.h.
  *
  * Revision 1.8  1996/01/08 09:09:16  adam
 
 #include <sys/types.h>
 #include <sys/stat.h>
-#include <fcntl.h>
+#include <fcntl.h>\r
+#ifdef WINDOWS\r
+#include <io.h>\r
+#else
 #include <unistd.h>
-
+#endif
 
 #include <zebrautl.h>
 #include <dfa.h>
index 8120d90..eb2d1d2 100644 (file)
@@ -4,14 +4,16 @@
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: dclose.c,v $
- * Revision 1.3  1994-09-01 17:49:36  adam
+ * Revision 1.4  1997-09-09 13:38:01  adam
+ * Partial port to WIN95/NT.
+ *
+ * Revision 1.3  1994/09/01 17:49:36  adam
  * Removed stupid line. Work on insertion in dictionary. Not finished yet.
  *
  */
 
 #include <sys/types.h>
 #include <fcntl.h>
-#include <unistd.h>
 #include <stdio.h>
 #include <stdlib.h>
 
index 8418239..192a3ce 100644 (file)
@@ -4,14 +4,19 @@
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: dopen.c,v $
- * Revision 1.3  1994-09-01 17:49:37  adam
+ * Revision 1.4  1997-09-09 13:38:01  adam
+ * Partial port to WIN95/NT.
+ *
+ * Revision 1.3  1994/09/01 17:49:37  adam
  * Removed stupid line. Work on insertion in dictionary. Not finished yet.
  *
  */
 
 #include <sys/types.h>
 #include <fcntl.h>
+#ifndef WINDOWS
 #include <unistd.h>
+#endif
 #include <stdio.h>
 #include <stdlib.h>
 
index 42ca3b9..45015fb 100644 (file)
@@ -4,7 +4,10 @@
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: drdwr.c,v $
- * Revision 1.8  1995-01-24 11:25:11  adam
+ * Revision 1.9  1997-09-09 13:38:01  adam
+ * Partial port to WIN95/NT.
+ *
+ * Revision 1.8  1995/01/24 11:25:11  adam
  * Removed stupid assertion.
  *
  * Revision 1.7  1994/10/05  10:47:15  adam
@@ -22,7 +25,9 @@
 
 #include <sys/types.h>
 #include <fcntl.h>
+#ifndef WINDOWS
 #include <unistd.h>
+#endif
 #include <string.h>
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/include/direntz.h b/include/direntz.h
new file mode 100644 (file)
index 0000000..25477d5
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 1997, Index Data.
+ * See the file LICENSE for details.
+ * Sebastian Hammer, Adam Dickmeiss
+ *
+ * $Log: direntz.h,v $
+ * Revision 1.1  1997-09-09 13:38:03  adam
+ * Partial port to WIN95/NT.
+ *
+ *
+ */
+#ifdef WINDOWS
+#include <windows.h>
+struct dirent {
+    char d_name[MAX_PATH+1];
+};
+
+typedef struct DIR DIR;
+
+DIR *opendir (const char *path);
+struct dirent *readdir (DIR *dd);
+void closedir (DIR *dd);
+#else
+#include <dirent.h>
+#endif
index 490ec72..39332a4 100644 (file)
@@ -4,7 +4,10 @@
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: dir.c,v $
- * Revision 1.16  1996-10-29 14:06:45  adam
+ * Revision 1.17  1997-09-09 13:38:06  adam
+ * Partial port to WIN95/NT.
+ *
+ * Revision 1.16  1996/10/29 14:06:45  adam
  * Include zebrautl.h instead of alexutil.h.
  *
  * Revision 1.15  1996/06/04 10:18:58  adam
 #include <stdio.h>
 #include <string.h>
 #include <assert.h>
+#ifndef WINDOWS
 #include <unistd.h>
-#include <dirent.h>
+#endif
+#include <direntz.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <errno.h>
index c5636ee..4497e6a 100644 (file)
@@ -4,7 +4,10 @@
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: dirs.c,v $
- * Revision 1.12  1996-11-08 11:10:13  adam
+ * Revision 1.13  1997-09-09 13:38:06  adam
+ * Partial port to WIN95/NT.
+ *
+ * Revision 1.12  1996/11/08 11:10:13  adam
  * Buffers used during file match got bigger.
  * Compressed ISAM support everywhere.
  * Bug fixes regarding masking characters in queries.
@@ -47,6 +50,7 @@
  * Started work on virtual directory structure.
  */
 #include <stdio.h>
+#include <string.h>
 #include <assert.h>
 #include <errno.h>
 #include <fcntl.h>
index aa69550..4978551 100644 (file)
@@ -4,7 +4,10 @@
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: extract.c,v $
- * Revision 1.73  1997-09-04 13:57:20  adam
+ * Revision 1.74  1997-09-09 13:38:06  adam
+ * Partial port to WIN95/NT.
+ *
+ * Revision 1.73  1997/09/04 13:57:20  adam
  * New file extract/retrieve method tellf (added).
  * Added O_BINARY for open calls.
  *
  */
 #include <stdio.h>
 #include <assert.h>
+#ifdef WINDOWS
+#include <io.h>
+#else
 #include <unistd.h>
+#endif
 #include <fcntl.h>
 
 #include <recctrl.h>
index f3f242f..c4a7279 100644 (file)
@@ -4,7 +4,10 @@
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: kdump.c,v $
- * Revision 1.12  1997-09-05 09:52:32  adam
+ * Revision 1.13  1997-09-09 13:38:07  adam
+ * Partial port to WIN95/NT.
+ *
+ * Revision 1.12  1997/09/05 09:52:32  adam
  * Extra argument added to function chr_read_maptab (tab path).
  *
  * Revision 1.11  1996/10/29 14:06:49  adam
  *
  */
 #include <stdio.h>
+#include <string.h>
 #include <assert.h>
+#ifdef WINDOWS
+#include <io.h>
+#else
 #include <unistd.h>
+#endif
 #include <assert.h>
 
 #include <charmap.h>
index eb7b251..4da9460 100644 (file)
@@ -4,7 +4,10 @@
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: kinput.c,v $
- * Revision 1.23  1997-09-04 13:57:39  adam
+ * Revision 1.24  1997-09-09 13:38:07  adam
+ * Partial port to WIN95/NT.
+ *
+ * Revision 1.23  1997/09/04 13:57:39  adam
  * Added O_BINARY for open calls.
  *
  * Revision 1.22  1997/02/12 20:39:45  adam
  */
 
 #include <fcntl.h>
+#ifdef WINDOWS
+#include <io.h>
+#else
 #include <unistd.h>
+#endif
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
@@ -568,6 +575,10 @@ void progressFunc (struct key_file *keyp, void *info)
     p->totalOffset += keyp->buf_size;
 }
 
+#ifndef R_OK
+#define R_OK 4
+#endif
+
 void key_input (int nkeys, int cache)
                 
 {
index 1a0262c..f2c418c 100644 (file)
@@ -4,7 +4,10 @@
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: lockidx.c,v $
- * Revision 1.9  1997-09-04 13:58:04  adam
+ * Revision 1.10  1997-09-09 13:38:07  adam
+ * Partial port to WIN95/NT.
+ *
+ * Revision 1.9  1997/09/04 13:58:04  adam
  * Added O_BINARY for open calls.
  *
  * Revision 1.8  1997/02/12 20:39:46  adam
  */
 #include <stdio.h>
 #include <assert.h>
+#ifdef WINDOWS
+#include <io.h>
+#else
 #include <unistd.h>
+#endif
 #include <fcntl.h>
 #include <string.h>
 #include <errno.h>
index 5cd6f86..afed16d 100644 (file)
@@ -4,7 +4,10 @@
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: lockutil.c,v $
- * Revision 1.6  1996-10-29 14:08:14  adam
+ * Revision 1.7  1997-09-09 13:38:08  adam
+ * Partial port to WIN95/NT.
+ *
+ * Revision 1.6  1996/10/29 14:08:14  adam
  * Uses resource lockDir instead of lockPath.
  *
  * Revision 1.5  1996/03/26 16:01:13  adam
 #include <errno.h>
 #include <fcntl.h>
 #include <sys/types.h>
+#ifdef WINDOWS
+#include <io.h>
+#else
 #include <unistd.h>
+#endif
 
 #include "index.h"
 
index a4e72d4..d238bb9 100644 (file)
@@ -4,7 +4,10 @@
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: main.c,v $
- * Revision 1.47  1997-02-12 20:39:46  adam
+ * Revision 1.48  1997-09-09 13:38:08  adam
+ * Partial port to WIN95/NT.
+ *
+ * Revision 1.47  1997/02/12 20:39:46  adam
  * Implemented options -f <n> that limits the log to the first <n>
  * records.
  * Changed some log messages also.
  */
 #include <stdio.h>
 #include <assert.h>
+#ifdef WINDOWS
+#include <io.h>
+#else
 #include <unistd.h>
+#endif
 
 #include <data1.h>
 #include "index.h"
index c5cd78d..882f228 100644 (file)
@@ -4,7 +4,10 @@
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: recstat.c,v $
- * Revision 1.3  1996-06-04 10:19:00  adam
+ * Revision 1.4  1997-09-09 13:38:08  adam
+ * Partial port to WIN95/NT.
+ *
+ * Revision 1.3  1996/06/04 10:19:00  adam
  * Minor changes - removed include of ctype.h.
  *
  * Revision 1.2  1996/05/14  14:04:34  adam
@@ -22,8 +25,9 @@
 #include <assert.h>
 #include <string.h>
 #include <fcntl.h>
+#ifndef WINDOWS
 #include <unistd.h>
-
+#endif
 #include "recindxp.h"
 
 void rec_prstat (void)
index 1e8238d..1ed1e57 100644 (file)
@@ -4,7 +4,10 @@
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: symtab.c,v $
- * Revision 1.3  1996-10-29 14:06:54  adam
+ * Revision 1.4  1997-09-09 13:38:09  adam
+ * Partial port to WIN95/NT.
+ *
+ * Revision 1.3  1996/10/29 14:06:54  adam
  * Include zebrautl.h instead of alexutil.h.
  *
  * Revision 1.2  1995/09/28 09:19:44  adam
@@ -17,6 +20,7 @@
  */
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <assert.h>
 
 #include "index.h"
index b3ffb45..9b5ecec 100644 (file)
@@ -4,7 +4,10 @@
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: trav.c,v $
- * Revision 1.29  1997-02-12 20:39:47  adam
+ * Revision 1.30  1997-09-09 13:38:09  adam
+ * Partial port to WIN95/NT.
+ *
+ * Revision 1.29  1997/02/12 20:39:47  adam
  * Implemented options -f <n> that limits the log to the first <n>
  * records.
  * Changed some log messages also.
  */
 #include <stdio.h>
 #include <assert.h>
+#ifdef WINDOWS
+#include <io.h>
+#else
 #include <unistd.h>
-#include <dirent.h>
-#include <sys/stat.h>
+#endif
+#include <direntz.h>
 #include <sys/types.h>
+#include <sys/stat.h>
 #include <fcntl.h>
 #include <time.h>
 
index 5f6181e..b511e72 100644 (file)
@@ -4,7 +4,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
-#include <strings.h>
+#include <string.h>
 #include <assert.h>
 
 #include <isam.h>
index c6b7ed0..898465d 100644 (file)
@@ -4,7 +4,10 @@
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: memory.c,v $
- * Revision 1.14  1996-10-29 13:56:56  adam
+ * Revision 1.15  1997-09-09 13:38:11  adam
+ * Partial port to WIN95/NT.
+ *
+ * Revision 1.14  1996/10/29 13:56:56  adam
  * Include of zebrautl.h instead of alexutil.h.
  *
  * Revision 1.13  1996/03/20 13:29:16  quinn
@@ -56,6 +59,8 @@
 
 #include <assert.h>
 #include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
 
 #include <zebrautl.h>
 #include <isam.h>
index f10f23b..9837e00 100644 (file)
@@ -4,7 +4,10 @@
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: physical.c,v $
- * Revision 1.13  1996-10-29 13:56:57  adam
+ * Revision 1.14  1997-09-09 13:38:12  adam
+ * Partial port to WIN95/NT.
+ *
+ * Revision 1.13  1996/10/29 13:56:57  adam
  * Include of zebrautl.h instead of alexutil.h.
  *
  * Revision 1.12  1996/03/20 16:17:11  quinn
@@ -52,6 +55,7 @@
 
 #include <assert.h>
 #include <stdio.h>
+#include <string.h>
 
 #include <log.h>
 #include <isam.h>
index 3ca02e7..1531b04 100644 (file)
@@ -4,7 +4,10 @@
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: recgrs.c,v $
- * Revision 1.7  1997-09-05 15:30:10  adam
+ * Revision 1.8  1997-09-09 13:38:14  adam
+ * Partial port to WIN95/NT.
+ *
+ * Revision 1.7  1997/09/05 15:30:10  adam
  * Changed prototype for chr_map_input - added const.
  * Added support for C++, headers uses extern "C" for public definitions.
  *
 #include <stdio.h>
 #include <assert.h>
 #include <sys/types.h>
+#ifndef WINDOWS
 #include <unistd.h>
+#endif
 
 #include <log.h>
 #include <oid.h>
index 2a72743..2a363f1 100644 (file)
@@ -4,7 +4,10 @@
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: rsbool.c,v $
- * Revision 1.10  1996-10-29 13:55:20  adam
+ * Revision 1.11  1997-09-09 13:38:15  adam
+ * Partial port to WIN95/NT.
+ *
+ * Revision 1.10  1996/10/29 13:55:20  adam
  * Include of zebrautl.h instead of alexutil.h.
  *
  * Revision 1.9  1995/12/11 09:15:22  adam
@@ -45,6 +48,8 @@
  */
 
 #include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
 #include <assert.h>
 
 #include <rsbool.h>
index 2ecf7e0..69d0ca5 100644 (file)
@@ -4,7 +4,10 @@
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: rsm_or.c,v $
- * Revision 1.2  1996-12-23 15:30:49  adam
+ * Revision 1.3  1997-09-09 13:38:16  adam
+ * Partial port to WIN95/NT.
+ *
+ * Revision 1.2  1996/12/23 15:30:49  adam
  * Work on truncation.
  *
  * Revision 1.1  1996/12/20 11:07:21  adam
  *
  */
 
+#include <assert.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include <assert.h>
+#include <string.h>
 
 #include <isam.h>
 #include <isamc.h>
index cf945f4..a2e87a9 100644 (file)
@@ -4,7 +4,10 @@
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: rsrel.c,v $
- * Revision 1.14  1996-11-08 11:15:58  adam
+ * Revision 1.15  1997-09-09 13:38:16  adam
+ * Partial port to WIN95/NT.
+ *
+ * Revision 1.14  1996/11/08 11:15:58  adam
  * Compressed isam fully supported.
  *
  * Revision 1.13  1996/10/29 13:55:26  adam
@@ -54,6 +57,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <assert.h>
 
 #include <isam.h>
index 235b104..c640952 100644 (file)
@@ -4,7 +4,10 @@
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: rssbool.c,v $
- * Revision 1.4  1996-10-29 13:55:27  adam
+ * Revision 1.5  1997-09-09 13:38:16  adam
+ * Partial port to WIN95/NT.
+ *
+ * Revision 1.4  1996/10/29 13:55:27  adam
  * Include of zebrautl.h instead of alexutil.h.
  *
  * Revision 1.3  1996/10/08 13:00:41  adam
@@ -23,8 +26,9 @@
  *
  */
 
-#include <stdio.h>
 #include <assert.h>
+#include <stdio.h>
+#include <string.h>
 
 #include <rsbool.h>
 #include <zebrautl.h>
index 8e3ff84..aa7b9b1 100644 (file)
@@ -4,7 +4,10 @@
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: rstemp.c,v $
- * Revision 1.19  1997-09-04 13:58:57  adam
+ * Revision 1.20  1997-09-09 13:38:17  adam
+ * Partial port to WIN95/NT.
+ *
+ * Revision 1.19  1997/09/04 13:58:57  adam
  * Added O_BINARY for open calls.
  *
  * Revision 1.18  1996/10/29 13:54:52  adam
 
 #include <fcntl.h>
 #include <assert.h>
+#ifdef WINDOWS
+#include <io.h>
+#else
 #include <unistd.h>
+#endif
+#include <string.h>
 #include <sys/types.h>
 #include <stdio.h>
 
diff --git a/util/dirent.c b/util/dirent.c
new file mode 100644 (file)
index 0000000..047c930
--- /dev/null
@@ -0,0 +1,50 @@
+
+#ifdef WINDOWS
+#include <assert.h>
+#include <io.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <direntz.h>
+
+struct DIR {
+    HANDLE handle;
+    WIN32_FIND_DATA find_data;
+    struct dirent entry;
+};
+
+DIR *opendir (const char *name)
+{
+    char fullName[MAX_PATH+1];
+    DIR *dd = malloc (sizeof(*dd));
+
+    if (!dd)
+        return NULL;
+    strcpy (fullName, name);
+    strcat (fullName, "\\*.*");
+    dd->handle = FindFirstFile(fullName, &dd->find_data);
+    return dd;
+}
+                                                          
+struct dirent *readdir (DIR *dd)
+{
+    if (dd->handle == INVALID_HANDLE_VALUE)
+        return NULL;
+    strcpy (dd->entry.d_name, dd->find_data.cFileName);
+    if (!FindNextFile(dd->handle, &dd->find_data))
+    {
+        FindClose (dd->handle);
+        dd->handle = INVALID_HANDLE_VALUE;
+    }
+    return &dd->entry;
+}
+
+void closedir(DIR *dd)
+{
+    if (dd->handle != INVALID_HANDLE_VALUE)
+        FindClose (dd->handle);
+    if (dd)
+        free (dd);
+}
+
+#endif
index 10b600e..78457d5 100644 (file)
@@ -4,7 +4,10 @@
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: res.c,v $
- * Revision 1.16  1996-10-29 13:47:49  adam
+ * Revision 1.17  1997-09-09 13:38:19  adam
+ * Partial port to WIN95/NT.
+ *
+ * Revision 1.16  1996/10/29 13:47:49  adam
  * Implemented res_get_match. Updated to use zebrautl instead of alexpath.
  *
  * Revision 1.15  1996/05/22 08:23:43  adam
 #include <stdlib.h>
 #include <string.h>
 #include <assert.h>
+#ifdef WINDOWS
+#include <io.h>
+#else
 #include <unistd.h>
+#endif
 
 #include <zebrautl.h>
 #include <yaz-util.h>
@@ -189,7 +196,11 @@ static void reread (Res r)
 Res res_open (const char *name)
 {
     Res r;
+#ifdef WINDOWS
+    if (access (name, 4))
+#else
     if (access (name, R_OK))
+#endif
         logf (LOG_LOG|LOG_ERRNO, "Cannot access `%s'", name);
     r = xmalloc (sizeof(*r));
     r->init = 0;