]> git.sur5r.net Git - openldap/blob - servers/slapd/back-ldbm/config.c
fix SIGUNUSED typo
[openldap] / servers / slapd / back-ldbm / config.c
1 /* config.c - ldbm backend configuration file routine */
2
3 #include <stdio.h>
4 #include <string.h>
5 #include <sys/types.h>
6 #include <sys/socket.h>
7 #include "slap.h"
8 #include "back-ldbm.h"
9
10 ldbm_back_config(
11     Backend     *be,
12     char        *fname,
13     int         lineno,
14     int         argc,
15     char        **argv
16 )
17 {
18         struct ldbminfo *li = (struct ldbminfo *) be->be_private;
19
20         if ( li == NULL ) {
21                 fprintf( stderr, "%s: line %d: ldbm backend info is null!\n",
22                     fname, lineno );
23                 exit( 1 );
24         }
25
26         /* directory where database files live */
27         if ( strcasecmp( argv[0], "directory" ) == 0 ) {
28                 if ( argc < 2 ) {
29                         fprintf( stderr,
30                 "%s: line %d: missing dir in \"directory <dir>\" line\n",
31                             fname, lineno );
32                         exit( 1 );
33                 }
34                 li->li_directory = strdup( argv[1] );
35
36         /* mode with which to create new database files */
37         } else if ( strcasecmp( argv[0], "mode" ) == 0 ) {
38                 if ( argc < 2 ) {
39                         fprintf( stderr,
40                         "%s: line %d: missing mode in \"mode <mode>\" line\n",
41                             fname, lineno );
42                         exit( 1 );
43                 }
44                 li->li_mode = strtol( argv[1], NULL, 0 );
45
46         /* attribute to index */
47         } else if ( strcasecmp( argv[0], "index" ) == 0 ) {
48                 if ( argc < 2 ) {
49                         fprintf( stderr,
50 "%s: line %d: missing attr in \"index <attr> [pres,eq,approx,sub]\" line\n",
51                             fname, lineno );
52                         exit( 1 );
53                 } else if ( argc > 3 ) {
54                         fprintf( stderr,
55 "%s: line %d: extra junk after \"index <attr> [pres,eq,approx,sub]\" line (ignored)\n",
56                             fname, lineno );
57                 }
58                 attr_index_config( li, fname, lineno, argc - 1, &argv[1], 0 );
59
60         /* size of the cache in entries */
61         } else if ( strcasecmp( argv[0], "cachesize" ) == 0 ) {
62                 if ( argc < 2 ) {
63                         fprintf( stderr,
64                 "%s: line %d: missing size in \"cachesize <size>\" line\n",
65                             fname, lineno );
66                         exit( 1 );
67                 }
68                 li->li_cache.c_maxsize = atoi( argv[1] );
69
70         /* size of each dbcache in bytes */
71         } else if ( strcasecmp( argv[0], "dbcachesize" ) == 0 ) {
72                 if ( argc < 2 ) {
73                         fprintf( stderr,
74                 "%s: line %d: missing size in \"dbcachesize <size>\" line\n",
75                             fname, lineno );
76                         exit( 1 );
77                 }
78                 li->li_dbcachesize = atoi( argv[1] );
79
80         /* anything else */
81         } else {
82                 fprintf( stderr,
83 "%s: line %d: unknown directive \"%s\" in ldbm database definition (ignored)\n",
84                     fname, lineno, argv[0] );
85         }
86 }