1 /* config.c - ldbm backend configuration file routine */
11 #include "back-ldbm.h"
13 int ldbm_ignore_nextid_file = 0;
25 struct ldbminfo *li = (struct ldbminfo *) be->be_private;
28 fprintf( stderr, "%s: line %d: ldbm database info is null!\n",
33 /* directory where database files live */
34 if ( strcasecmp( argv[0], "directory" ) == 0 ) {
37 "%s: line %d: missing dir in \"directory <dir>\" line\n",
41 if ( li->li_directory )
42 free( li->li_directory );
43 li->li_directory = ch_strdup( argv[1] );
45 if ( li->li_nextid_file )
46 free( li->li_nextid_file );
48 ch_malloc( strlen(li->li_directory) + sizeof("/NEXTID") + 1 );
50 strcpy(li->li_nextid_file, li->li_directory);
51 strcat(li->li_nextid_file, "/NEXTID");
53 /* mode with which to create new database files */
54 } else if ( strcasecmp( argv[0], "mode" ) == 0 ) {
57 "%s: line %d: missing mode in \"mode <mode>\" line\n",
61 li->li_mode = strtol( argv[1], NULL, 0 );
63 /* attribute to index */
64 } else if ( strcasecmp( argv[0], "index" ) == 0 ) {
67 "%s: line %d: missing attr in \"index <attr> [pres,eq,approx,sub]\" line\n",
70 } else if ( argc > 3 ) {
72 "%s: line %d: extra junk after \"index <attr> [pres,eq,approx,sub]\" line (ignored)\n",
75 attr_index_config( li, fname, lineno, argc - 1, &argv[1], 0 );
77 /* size of the cache in entries */
78 } else if ( strcasecmp( argv[0], "cachesize" ) == 0 ) {
81 "%s: line %d: missing size in \"cachesize <size>\" line\n",
85 li->li_cache.c_maxsize = atoi( argv[1] );
87 /* size of each dbcache in bytes */
88 } else if ( strcasecmp( argv[0], "dbcachesize" ) == 0 ) {
91 "%s: line %d: missing size in \"dbcachesize <size>\" line\n",
95 li->li_dbcachesize = atoi( argv[1] );
98 } else if ( strcasecmp( argv[0], "dbcachenowsync" ) == 0 ) {
99 li->li_dbcachewsync = 0;
104 "%s: line %d: unknown directive \"%s\" in ldbm database definition (ignored)\n",
105 fname, lineno, argv[0] );