prime.o random.o realloc.o regex.o timer.o url.o wildmatch.o \
wordsplit.o str_ctype.o str_upper.o bucket.o conf.o object.o sorter.o \
finger.o proctitle.o ipaccess.o profile.o bitsig.o randomkey.o \
- hash-string.o hash-istring.o
+ hash-string.o hash-istring.o custom.o
obj/lib/libsh.a: $(addprefix obj/lib/,$(SHLIB_OBJS))
#ifndef _SHERLOCK_CONFIG_H
#define _SHERLOCK_CONFIG_H
-/* Custom configuration */
+/* Configuration switches */
#include "lib/autoconf.h"
-#include "lib/custom.h"
/* Version */
typedef u32 oid_t; /* Object ID */
+/* Custom stuff */
+
+#include "lib/custom.h"
+
/* Data types and functions for accessing file positions */
#ifdef SHERLOCK_CONFIG_LARGE_DB
--- /dev/null
+/*
+ * Sherlock: Custom Parts of Configuration
+ *
+ * (c) 2001--2002 Martin Mares <mj@ucw.cz>
+ */
+
+#include "lib/lib.h"
+#include "lib/index.h"
+
+#include <stdlib.h>
+
+#if 0 /* Example */
+
+void
+custom_get_lm(struct card_attr *ca, byte *attr)
+{
+ if (attr)
+ ca->lm = atol(attr);
+ else
+ ca->lm = 0;
+}
+
+byte *
+custom_parse_lm(u32 *dest, byte *value, uns intval)
+{
+ if (value)
+ return "LM is an integer, not a string";
+ *dest = intval;
+ return NULL;
+}
+
+#endif
/*
* Sherlock: Custom Parts of Configuration
*
- * (c) 2001 Martin Mares <mj@ucw.cz>
+ * (c) 2001--2002 Martin Mares <mj@ucw.cz>
*/
/* Name of this customization (version suffix) */
#define SHER_SUFFIX ""
-/* Features */
-
-#define SHERLOCK_CONFIG_LARGE_DB /* Support for DB files >4GB */
-#define SHERLOCK_CONFIG_LFS /* Large files on 32-bit systems */
-#define SHERLOCK_CONFIG_LFS_LIBC /* LFS supported directly by libc */
-
/* Word types */
enum word_type {
#define STRING_TYPES_URL ((1 << ST_URL) | (1 << ST_REF) | (1 << ST_BACKREF))
/* These must be indexed in lowercase form */
#define STRING_TYPES_CASE_INSENSITIVE ((1 << ST_HOST) | (1 << ST_DOMAIN))
+
+/*
+ * Definitions of custom attributes:
+ *
+ * INT_ATTR(type, id, oattr, keyword, get_func, parse_func)
+ *
+ * type data type used to hold the value
+ * id C identifier of the attribute
+ * oattr object attribute we get the value from
+ * keywd search server keyword for the attribute
+ * void get_func(struct card_attr *ca, byte *attr)
+ * parse object attribute (may be NULL)
+ * byte *parse_func(u32 *dest, byte *value, uns intval)
+ * parse value in query (returns error message or NULL)
+ * for KEYWD = "string", it gets value="string", intval=0
+ * for KEYWD = num, it gets value=NULL, intval=num.
+ *
+ * A good place for definitions of the functions is lib/custom.c.
+ *
+ * Please order the attributes by decreasing size to get optimum padding.
+ */
+
+#if 0 /* Example */
+
+#define CUSTOM_ATTRS INT_ATTR(u32, lm, 'L', LM, custom_get_lm, custom_parse_lm)
+
+struct card_attr;
+void custom_get_lm(struct card_attr *ca, byte *attr);
+byte *custom_parse_lm(u32 *dest, byte *value, uns intval);
+
+#else
+
+#define CUSTOM_ATTRS
+
+#endif
struct card_attr {
u32 card; /* Reference to card description (either oid or filepos) */
u32 site_id;
+#define INT_ATTR(t,i,o,k,g,p) t i;
+ CUSTOM_ATTRS /* Include all custom attributes */
+#undef INT_ATTR
byte weight;
byte flags;
- byte rfu[2];
+ // byte rfu[2]; /* If no custom attributes are defined */
};
enum card_flag {