Implemented bug #588: allrecords search. Using @attr 1=allrecords ""
[idzebra-moved-to-github.git] / index / extract.c
index 06b285a..de81472 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: extract.c,v 1.211 2006-05-10 13:54:01 adam Exp $
+/* $Id: extract.c,v 1.213 2006-05-17 17:46:45 adam Exp $
    Copyright (C) 1995-2006
    Index Data ApS
 
@@ -36,12 +36,19 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 #include <direntz.h>
 #include <charmap.h>
 
-#if _FILE_OFFSET_BITS == 64
-#define PRINTF_OFF_T "%Ld"
+#ifdef WIN32
+#define PRINTF_OFF_T "%I64d"
+#else
+/* !WIN32 */
+#if SIZEOF_OFF_T == SIZEOF_LONG_LONG
+#define PRINTF_OFF_T "%lld"
 #else
 #define PRINTF_OFF_T "%ld"
 #endif
 
+#endif
+
+
 #define USE_SHELLSORT 0
 
 #if USE_SHELLSORT
@@ -81,6 +88,8 @@ static void logRecord (ZebraHandle zh)
     }
 }
 
+static void extract_add_index_string (RecWord *p, const char *str, int length);
+
 static void extract_set_store_data_prepare(struct recExtractCtrl *p);
 
 static void extract_init (struct recExtractCtrl *p, RecWord *w)
@@ -379,6 +388,16 @@ static void init_extractCtrl(ZebraHandle zh, struct recExtractCtrl *ctrl)
     ctrl->flagShowRecords = !zh->m_flag_rw;
 }
 
+static void all_matches_add(struct recExtractCtrl *ctrl)
+{
+    RecWord word;
+    extract_init(ctrl, &word);
+    word.index_name = "allrecords";
+    word.index_type = 'w';
+    word.seqno = 1;
+    extract_add_index_string (&word, "", 0);
+}
+
 static ZEBRA_RES file_extract_record(ZebraHandle zh,
                                     SYSNO *sysno, const char *fname,
                                     int deleteFlag,
@@ -472,8 +491,9 @@ static ZEBRA_RES file_extract_record(ZebraHandle zh,
             }
             return ZEBRA_FAIL;
         }
+        all_matches_add(&extractCtrl);
         if (extractCtrl.match_criteria[0])
-            matchStr = extractCtrl.match_criteria;     
+            matchStr = extractCtrl.match_criteria;
     }
 
     /* if matchStr is set now - we assume it's printable .
@@ -984,6 +1004,8 @@ ZEBRA_RES buffer_extract_record(ZebraHandle zh,
        return ZEBRA_FAIL;
     }
 
+    all_matches_add(&extractCtrl);
+        
     if (extractCtrl.match_criteria[0])
        match_criteria = extractCtrl.match_criteria;
 
@@ -1681,7 +1703,7 @@ void print_rec_keys(ZebraHandle zh, zebra_rec_keys_t reckeys)
     }
 }
 
-void extract_add_index_string (RecWord *p, const char *str, int length)
+void extract_add_index_string(RecWord *p, const char *str, int length)
 {
     struct it_key key;