Email gateway obeys 'Reply-To:' in header.
[egate.git] / kernel / persist.c
index 176b17f..bea7f4b 100644 (file)
@@ -1,8 +1,63 @@
+/*
+ * Copyright (c) 1995, the EUROPAGATE consortium (see below).
+ *
+ * The EUROPAGATE consortium members are:
+ *
+ *    University College Dublin
+ *    Danmarks Teknologiske Videnscenter
+ *    An Chomhairle Leabharlanna
+ *    Consejo Superior de Investigaciones Cientificas
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and
+ * its documentation, in whole or in part, for any purpose, is hereby granted,
+ * provided that:
+ *
+ * 1. This copyright and permission notice appear in all copies of the
+ * software and its documentation. Notices of copyright or attribution
+ * which appear at the beginning of any file must remain unchanged.
+ *
+ * 2. The names of EUROPAGATE or the project partners may not be used to
+ * endorse or promote products derived from this software without specific
+ * prior written permission.
+ *
+ * 3. Users of this software (implementors and gateway operators) agree to
+ * inform the EUROPAGATE consortium of their use of the software. This
+ * information will be used to evaluate the EUROPAGATE project and the
+ * software, and to plan further developments. The consortium may use
+ * the information in later publications.
+ * 
+ * 4. Users of this software agree to make their best efforts, when
+ * documenting their use of the software, to acknowledge the EUROPAGATE
+ * consortium, and the role played by the software in their work.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS, IMPLIED, OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+ * IN NO EVENT SHALL THE EUROPAGATE CONSORTIUM OR ITS MEMBERS BE LIABLE
+ * FOR ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF
+ * ANY KIND, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA
+ * OR PROFITS, WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND
+ * ON ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
+ * USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
 /* Gateway kernel - Z39.50 Persistence
  * Europagate, 1995
  *
  * $Log: persist.c,v $
- * Revision 1.6  1995/05/03 07:37:44  adam
+ * Revision 1.10  1995/07/20 08:16:38  adam
+ * Bug fix in persist.c: Double referenced result-sets weren't recovered.
+ *
+ * Revision 1.9  1995/05/19  13:26:00  adam
+ * Bug fixes. Better command line options.
+ *
+ * Revision 1.8  1995/05/16  09:40:43  adam
+ * LICENSE. Setting of CCL token names (and/or/not/set) in read_kernel_res.
+ *
+ * Revision 1.7  1995/05/03  16:34:19  adam
+ * CCL def command, i.e. user definitions - saved as resource files.
+ *
+ * Revision 1.6  1995/05/03  07:37:44  adam
  * CCL commands stop/continue implemented. New functions gw_res_{int,bool}
  * are used when possible.
  *
@@ -53,7 +108,8 @@ static int set_change;
 static int obtain_set (ZASS zass, struct gw_user_set *set)
 {
     const struct zass_searchent *p;
-
+    
+    gw_log (GW_LOG_DEBUG, KERNEL_LOG, "Set %s must be obtained", set->name);
     p = zass_search (zass, set->rpn, set->name, set->database, NULL);
     if (!p)
         return 2;
@@ -99,6 +155,7 @@ static int obtain_sets (ZASS zass, struct ccl_rpn_node *rpn,
            return 0;
         }
     }
+    obtain_sets (zass, set->rpn, sets);
     return obtain_set (zass, set);
 }
 
@@ -210,7 +267,7 @@ int load_p_state (int userid)
     int hits;
     struct gw_user_set *set;
 
-    sprintf (fname, "persist.%d", userid);
+    sprintf (fname, "user.%d.p", userid);
 
     inf = fopen (fname, "r");
     if (!inf)
@@ -248,9 +305,6 @@ int load_p_state (int userid)
         return -1;
     gw_log (GW_LOG_DEBUG, KERNEL_LOG, 
            "Reading persistence file %s (2)", fname);
-#if 0
-    reopen_target ();
-#endif
     while (fgetsx (fline, 1024, inf))
     {
         gw_log (GW_LOG_DEBUG, KERNEL_LOG, 
@@ -265,7 +319,9 @@ int load_p_state (int userid)
        gw_log (GW_LOG_DEBUG, KERNEL_LOG, "Search string %s", fline);
        set = user_set_add (resultname, hits, database, NULL, 0, fline);
        set->rpn = load_rpn (fline, inf);
+#if 0
        ccl_pr_tree (set->rpn, stderr);
+#endif
        fgetsx (fline, 1024, inf);
     }
     fclose (inf);
@@ -326,7 +382,7 @@ int save_p_state (int userid)
     FILE *of;
     char fname[128];
 
-    sprintf (fname, "persist.%d", userid);
+    sprintf (fname, "user.%d.p", userid);
 
     of = fopen (fname, "w");
     if (!of)
@@ -347,7 +403,7 @@ void del_p_state (int userid)
 {
     char fname[128];
 
-    sprintf (fname, "persist.%d", userid);
+    sprintf (fname, "user.%d.p", userid);
     unlink (fname);
 }