validator, assimilator: added --help and --version

svn path=/trunk/boinc/; revision=21966
This commit is contained in:
Bernd Machenschalk 2010-07-16 07:15:57 +00:00
parent 739e93ebc6
commit 5cb98247a3
3 changed files with 22 additions and 3 deletions

View File

@ -5171,3 +5171,11 @@ David 15 Jul 2010
client/
work_fetch.h
Bernd 15 July 2010
- validator, assimilator: added --help and --version
sched/
validator.cpp
assimilator.cpp

View File

@ -33,6 +33,7 @@
#include "util.h"
#include "error_numbers.h"
#include "str_util.h"
#include "svn_version.h"
#include "sched_config.h"
#include "sched_util.h"
@ -70,6 +71,8 @@ void usage(char** argv) {
" [-d | --debug_level N] Set verbosity level (1 to 4)\n"
" [--dont_update_db] Don't update DB (for testing)\n"
" [--noinsert] Don't insert records in app-specific DB\n",
" [-h | --help] Show this\n"
" [-v | --version] Show version information\n",
argv[0]
);
exit(0);
@ -236,6 +239,9 @@ int main(int argc, char** argv) {
wu_id_remainder = atoi(argv[++i]);
} else if (is_arg(argv[i], "help") || is_arg(argv[i], "h")) {
usage(argv);
} else if (is_arg(argv[i], "v") || is_arg(argv[i], "version")) {
printf("%s\n", SVN_VERSION);
exit(0);
} else {
log_messages.printf(MSG_CRITICAL, "Unrecognized arg: %s\n", argv[i]);
usage(argv);

View File

@ -40,6 +40,7 @@
#include "util.h"
#include "str_util.h"
#include "error_numbers.h"
#include "svn_version.h"
#include "credit.h"
#include "sched_config.h"
@ -654,14 +655,15 @@ int main(int argc, char** argv) {
" --update_credited_job Add record to credited_job table after granting credit\n"
" --credit_from_wu Credit is specified in WU XML\n"
" --sleep_interval n Set sleep-interval to n\n"
" -d n, --debug_level n Set log verbosity level, 1-4\n\n";
" -d n, --debug_level n Set log verbosity level, 1-4\n"
" -h | --help Show this\n"
" -v | --version Show version information\n";
if ((argc > 1) && (!strcmp(argv[1], "-h") || !strcmp(argv[1], "--help"))) {
printf (usage, argv[0] );
exit(1);
exit(0);
}
check_stop_daemons();
for (i=1; i<argc; i++) {
@ -691,6 +693,9 @@ int main(int argc, char** argv) {
update_credited_job = true;
} else if (is_arg(argv[i], "credit_from_wu")) {
credit_from_wu = true;
} else if (is_arg(argv[i], "v") || is_arg(argv[i], "version")) {
printf("%s\n", SVN_VERSION);
exit(0);
} else {
fprintf(stderr,
"Invalid option '%s'\nTry `%s --help` for more information\n",