Init winsock. Incorporate ICU. Pazpar2 runs on Windows.
[pazpar2-moved-to-github.git] / src / settings.c
index f616eb8..bea5da7 100644 (file)
@@ -1,7 +1,5 @@
-/* $Id: settings.c,v 1.27 2008-02-20 06:22:32 quinn Exp $
-   Copyright (c) 2006-2007, Index Data.
-
-This file is part of Pazpar2.
+/* This file is part of Pazpar2.
+   Copyright (C) 2006-2008 Index Data
 
 Pazpar2 is free software; you can redistribute it and/or modify it under
 the terms of the GNU General Public License as published by the Free
@@ -14,21 +12,25 @@ FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 for more details.
 
 You should have received a copy of the GNU General Public License
-along with Pazpar2; see the file LICENSE.  If not, write to the
-Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
-02111-1307, USA.
- */
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
+*/
 
 // This module implements a generic system of settings
 // (attribute-value) that can be associated with search targets. The
 // system supports both default values, per-target overrides, and
 // per-user settings.
 
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+
 #include <string.h>
 #include <stdio.h>
 #include <sys/types.h>
-#include <dirent.h>
+#include "direntz.h"
 #include <stdlib.h>
 #include <sys/stat.h>
 
@@ -247,7 +249,7 @@ static void read_settings(const char *path,
         }
         closedir(d);
     }
-    else if ((dot = rindex(path, '.')) && !strcmp(dot + 1, "xml"))
+    else if ((dot = strrchr(path, '.')) && !strcmp(dot + 1, "xml"))
         read_settings_file(path, fun);
 }
 
@@ -315,22 +317,6 @@ static void update_database(void *context, struct database *db)
     if (!match_zurl(db->url, set->target))
         return;
 
-#ifdef GAGA
-    // Initialize settings array if it doesn't exist.
-    // If so, also set the 'id' automatic setting
-    if (!db->settings)
-    {
-        struct setting *id = nmem_malloc(nmem, sizeof(struct setting));
-
-        db->settings = nmem_malloc(nmem, sizeof(struct settings*) * dictionary->num);
-        memset(db->settings, 0, sizeof(struct settings*) * dictionary->num);
-        id->precedence = 0;
-        id->name = "pz:id";
-        id->target = id->value = db->url;
-        id->next = 0;
-        db->settings[PZ_ID] = id;
-    }
-#endif
     if ((offset = settings_offset_cprefix(set->name)) < 0)
         abort(); // Should never get here