/*
Copyright (C) 1991, Marcus J. Ranum. All rights reserved.
*/
/* configure all options BEFORE including system stuff. */
#include "config.h"
#ifdef DB_DIRHASH
#include "mud.h"
/*
binding to the command level interface. this just parses and calls
lower level configuration code in the db layer.
*/
/* ARGSUSED */
int cmd__dhdbconfig (int argc, char *argv[], char *who, char *aswho)
{
/* configure database hash size */
if (!strcmp (argv[1], "hashsize")) {
int tmpx;
if (dhdb_initted ()) {
log_printf ("database is already active.\n", (char *) 0);
return (1);
}
if (argc < 3 || (tmpx = atoi (argv[2])) <= 0) {
log_printf ("invalid directory hash size.\n", (char *) 0);
return (1);
}
dhdb_sethsiz (tmpx);
log_printf ("directory hash size ", argv[2], " dirs.\n", (char *) 0);
return (0);
}
/* configure database hash directory */
if (!strcmp (argv[1], "hashpath")) {
if (dhdb_initted ()) {
log_printf ("database is already active.\n", (char *) 0);
return (1);
}
if (argc < 3) {
log_printf ("must provide directory name.\n", (char *) 0);
return (1);
}
dhdb_sethpath (argv[2]);
log_printf ("database hash path now ", argv[2], "\n", (char *) 0);
return (0);
}
if (!strcmp (argv[1], "help")) {
say (who, argv[0], " hashsize number-of-directories\n", (char *) 0);
say (who, argv[0], " hashpath directory-name\n", (char *) 0);
return (0);
}
log_printf ("_dbconfig: I don't understand ", argv[1], "\n", (char *) 0);
return (0);
}
#endif // DB_DIRHASH