1 /* config.c - ldbm backend configuration file routine */
11 #include "back-ldbm.h"
22 struct ldbminfo *li = (struct ldbminfo *) be->be_private;
25 fprintf( stderr, "%s: line %d: ldbm database info is null!\n",
30 /* directory where database files live */
31 if ( strcasecmp( argv[0], "directory" ) == 0 ) {
34 "%s: line %d: missing dir in \"directory <dir>\" line\n",
38 if ( li->li_directory )
39 free( li->li_directory );
40 li->li_directory = ch_strdup( argv[1] );
43 ch_malloc( strlen(li->li_directory) + sizeof("/NEXTID") + 1 );
45 strcpy(li->li_nextid_file, li->li_directory);
46 strcat(li->li_nextid_file, "/NEXTID");
48 /* mode with which to create new database files */
49 } else if ( strcasecmp( argv[0], "mode" ) == 0 ) {
52 "%s: line %d: missing mode in \"mode <mode>\" line\n",
56 li->li_mode = strtol( argv[1], NULL, 0 );
58 /* attribute to index */
59 } else if ( strcasecmp( argv[0], "index" ) == 0 ) {
62 "%s: line %d: missing attr in \"index <attr> [pres,eq,approx,sub]\" line\n",
65 } else if ( argc > 3 ) {
67 "%s: line %d: extra junk after \"index <attr> [pres,eq,approx,sub]\" line (ignored)\n",
70 attr_index_config( li, fname, lineno, argc - 1, &argv[1], 0 );
72 /* size of the cache in entries */
73 } else if ( strcasecmp( argv[0], "cachesize" ) == 0 ) {
76 "%s: line %d: missing size in \"cachesize <size>\" line\n",
80 li->li_cache.c_maxsize = atoi( argv[1] );
82 /* size of each dbcache in bytes */
83 } else if ( strcasecmp( argv[0], "dbcachesize" ) == 0 ) {
86 "%s: line %d: missing size in \"dbcachesize <size>\" line\n",
90 li->li_dbcachesize = atoi( argv[1] );
93 } else if ( strcasecmp( argv[0], "dbcachenowsync" ) == 0 ) {
94 li->li_dbcachewsync = 0;
99 "%s: line %d: unknown directive \"%s\" in ldbm database definition (ignored)\n",
100 fname, lineno, argv[0] );