X-Git-Url: https://git.distorted.org.uk/~mdw/disorder/blobdiff_plain/0f55e9050dd26ab8804934a188f1ee8ab8b55ffe..0ddbd899ed1c089dba7bac4c925ae1451120ea63:/clients/disorder.c diff --git a/clients/disorder.c b/clients/disorder.c index 3413791..2088bc4 100644 --- a/clients/disorder.c +++ b/clients/disorder.c @@ -1,6 +1,6 @@ /* * This file is part of DisOrder. - * Copyright (C) 2004, 2005, 2006, 2007 Richard Kettlewell + * Copyright (C) 2004-2008 Richard Kettlewell * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -53,6 +53,7 @@ #include "defs.h" #include "authorize.h" #include "vector.h" +#include "version.h" static disorder_client *client; @@ -84,13 +85,6 @@ static void help(void) { exit(0); } -/* display version number and terminate */ -static void version(void) { - xprintf("%s", disorder_version_string); - xfclose(stdout); - exit(0); -} - static disorder_client *getclient(void) { if(!client) { if(!(client = disorder_new(1))) exit(EXIT_FAILURE); @@ -467,6 +461,8 @@ static void cf_setup_guest(char **argv) { default: fatal(0, "invalid option"); } } + if(online_registration && !config->mail_sender) + fatal(0, "you MUST set mail_sender if you want online registration"); if(disorder_adduser(getclient(), "guest", "", online_registration ? "read,register" : "read")) exit(EXIT_FAILURE); @@ -479,22 +475,22 @@ static const struct command { int (*isarg)(const char *); const char *argstr, *desc; } commands[] = { - { "adduser", 2, 3, cf_adduser, isarg_rights, "USER PASSWORD [RIGHTS]", + { "adduser", 2, 3, cf_adduser, isarg_rights, "USERNAME PASSWORD [RIGHTS]", "Create a new user" }, { "allfiles", 1, 2, cf_allfiles, isarg_regexp, "DIR [~REGEXP]", "List all files and directories in DIR" }, - { "authorize", 1, 2, cf_authorize, isarg_rights, "USER [RIGHTS]", - "Authorize USER to connect to the server" }, - { "deluser", 1, 1, cf_deluser, 0, "USER", - "Delete a user" }, + { "authorize", 1, 2, cf_authorize, isarg_rights, "USERNAME [RIGHTS]", + "Authorize user USERNAME to connect to the server" }, + { "deluser", 1, 1, cf_deluser, 0, "USERNAME", + "Delete user USERNAME" }, { "dirs", 1, 2, cf_dirs, isarg_regexp, "DIR [~REGEXP]", "List directories in DIR" }, { "disable", 0, 0, cf_disable, 0, "", "Disable play" }, { "disable-random", 0, 0, cf_random_disable, 0, "", "Disable random play" }, - { "edituser", 3, 3, cf_edituser, 0, "USER PROPERTY VALUE", - "Set a property of a user" }, + { "edituser", 3, 3, cf_edituser, 0, "USERNAME PROPERTY VALUE", + "Set a property of user USERNAME" }, { "enable", 0, 0, cf_enable, 0, "", "Enable play" }, { "enable-random", 0, 0, cf_random_enable, 0, "", @@ -570,8 +566,8 @@ static const struct command { "Unset a preference" }, { "unset-global", 1, 1, cf_unset_global, 0, "NAME", "Unset a global preference" }, - { "userinfo", 2, 2, cf_userinfo, 0, "USER PROPERTY", - "Get a property of as user" }, + { "userinfo", 2, 2, cf_userinfo, 0, "USERNAME PROPERTY", + "Get a property of a user" }, { "users", 0, 0, cf_users, 0, "", "List all users" }, { "version", 0, 0, cf_version, 0, "", @@ -616,11 +612,11 @@ int main(int argc, char **argv) { pcre_malloc = xmalloc; pcre_free = xfree; if(!setlocale(LC_CTYPE, "")) fatal(errno, "error calling setlocale"); - while((n = getopt_long(argc, argv, "hVc:dHlNu:p:", options, 0)) >= 0) { + while((n = getopt_long(argc, argv, "+hVc:dHlNu:p:", options, 0)) >= 0) { switch(n) { case 'h': help(); case 'H': help_commands(); - case 'V': version(); + case 'V': version("disorder"); case 'c': configfile = optarg; break; case 'd': debugging = 1; break; case 'l': local = 1; break;