X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/disorder/blobdiff_plain/2d0a6606ee8899dfe372bbdc760fd15c14f3fceb..b3756e27b1e5022b680949631730b45977ac11df:/lib/configuration.c diff --git a/lib/configuration.c b/lib/configuration.c index 443d60b..88cfbf2 100644 --- a/lib/configuration.c +++ b/lib/configuration.c @@ -1,6 +1,6 @@ /* * This file is part of DisOrder. - * Copyright (C) 2004-2009 Richard Kettlewell + * Copyright (C) 2004-2010 Richard Kettlewell * Portions copyright (C) 2007 Mark Wooding * * This program is free software: you can redistribute it and/or modify @@ -52,7 +52,7 @@ /** @brief Path to config file * - * set_configfile() sets the deafult if it is null. + * set_configfile() sets the default if it is null. */ char *configfile; @@ -365,7 +365,7 @@ static int parse_sample_format(const struct config_state *cs, return -1; } if(t != 8 && t != 16) { - disorder_error(0, "%s:%d: bad bite-per-sample (%ld)", + disorder_error(0, "%s:%d: bad bits-per-sample (%ld)", cs->path, cs->line, t); return -1; } @@ -835,9 +835,7 @@ static int validate_positive(const struct config_state *cs, static int validate_isauser(const struct config_state *cs, int attribute((unused)) nvec, char **vec) { - struct passwd *pw; - - if(!(pw = getpwnam(vec[0]))) { + if(!getpwnam(vec[0])) { disorder_error(0, "%s:%d: no such user as '%s'", cs->path, cs->line, vec[0]); return -1; } @@ -1068,8 +1066,8 @@ static const struct conf conf[] = { { C(checkpoint_min), &type_integer, validate_non_negative }, { C(collection), &type_collections, validate_any }, { C(connect), &type_netaddress, validate_destaddr }, - { C(cookie_login_lifetime), &type_integer, validate_positive }, { C(cookie_key_lifetime), &type_integer, validate_positive }, + { C(cookie_login_lifetime), &type_integer, validate_positive }, { C(dbversion), &type_integer, validate_positive }, { C(default_rights), &type_rights, validate_any }, { C(device), &type_string, validate_any }, @@ -1080,6 +1078,7 @@ static const struct conf conf[] = { { C(lock), &type_boolean, validate_any }, { C(mail_sender), &type_string, validate_any }, { C(mixer), &type_string, validate_any }, + { C(mount_rescan), &type_boolean, validate_any }, { C(multicast_loop), &type_boolean, validate_any }, { C(multicast_ttl), &type_integer, validate_non_negative }, { C(namepart), &type_namepart, validate_any }, @@ -1099,10 +1098,11 @@ static const struct conf conf[] = { { C(plugins), &type_string_accum, validate_isdir }, { C(prefsync), &type_integer, validate_positive }, { C(queue_pad), &type_integer, validate_positive }, - { C(replay_min), &type_integer, validate_non_negative }, { C(refresh), &type_integer, validate_positive }, + { C(refresh_min), &type_integer, validate_non_negative }, { C(reminder_interval), &type_integer, validate_positive }, { C(remote_userman), &type_boolean, validate_any }, + { C(replay_min), &type_integer, validate_non_negative }, { C2(restrict, restrictions), &type_restrict, validate_any }, { C(rtp_delay_threshold), &type_integer, validate_positive }, { C(sample_format), &type_sample_format, validate_sample_format }, @@ -1337,6 +1337,7 @@ static struct config *config_default(void) { logname = pw->pw_name; c->username = xstrdup(logname); c->refresh = 15; + c->refresh_min = 1; c->prefsync = 0; c->signal = SIGKILL; c->alias = xstrdup("{/artist}{/album}{/title}{ext}"); @@ -1371,6 +1372,7 @@ static struct config *config_default(void) { c->sox_generation = DEFAULT_SOX_GENERATION; c->playlist_max = INT_MAX; /* effectively no limit */ c->playlist_lock_timeout = 10; /* 10s */ + c->mount_rescan = 1; /* Default stopwords */ if(config_set(&cs, (int)NDEFAULT_STOPWORDS, (char **)default_stopwords)) exit(1); @@ -1729,6 +1731,19 @@ static int namepartlist_compare(const struct namepartlist *a, return 0; } +/** @brief Verify configuration table. + * @return The number of problems found +*/ +int config_verify(void) { + int fails = 0; + for(size_t n = 1; n < sizeof conf / sizeof *conf; ++n) + if(strcmp(conf[n-1].name, conf[n].name) >= 0) { + fprintf(stderr, "%s >= %s\n", conf[n-1].name, conf[n].name); + ++fails; + } + return fails; +} + /* Local Variables: c-basic-offset:2