From: Arvin Schnell Date: Fri, 17 Aug 2012 12:52:10 +0000 (+0200) Subject: - work on dbus interface X-Git-Tag: v0.1.3~144 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=975bd8db5b8aaceb1549077e47b5ed57aea4148f;p=thirdparty%2Fsnapper.git - work on dbus interface --- diff --git a/client/snapper.cc b/client/snapper.cc index e16c8814..9bc1d83b 100644 --- a/client/snapper.cc +++ b/client/snapper.cc @@ -1106,10 +1106,22 @@ log_do(LogLevel level, const string& component, const char* file, const int line bool log_query(LogLevel level, const string& component) { - return level != DEBUG; + return level == ERROR; } +void usage() __attribute__ ((__noreturn__)); + +void +usage() +{ + cerr << "Try 'snapper --help' for more information." << endl; + exit(EXIT_FAILURE); +} + + +void help() __attribute__ ((__noreturn__)); + void help() { @@ -1144,6 +1156,8 @@ help() help_diff(); help_undo(); help_cleanup(); + + exit (EXIT_SUCCESS); } @@ -1217,29 +1231,21 @@ main(int argc, char** argv) if ((opt = opts.find("help")) != opts.end()) { help(); - exit(EXIT_SUCCESS); } if (!getopts.hasArgs()) { cerr << _("No command provided.") << endl - << _("Try 'snapper help' for more information.") << endl; + << _("Try 'snapper --help' for more information.") << endl; exit(EXIT_FAILURE); } const char* command = getopts.popArg(); - - if (strcmp(command, "help") == 0) - { - help(); - exit(EXIT_SUCCESS); - } - map::const_iterator cmd = cmds.find(command); if (cmd == cmds.end()) { cerr << sformat(_("Unknown command '%s'."), command) << endl - << _("Try 'snapper help' for more information.") << endl; + << _("Try 'snapper --help' for more information.") << endl; exit(EXIT_FAILURE); } diff --git a/client/utils/GetOpts.cc b/client/utils/GetOpts.cc index 16d31ba6..0fdee9c6 100644 --- a/client/utils/GetOpts.cc +++ b/client/utils/GetOpts.cc @@ -58,7 +58,7 @@ GetOpts::parse(const char* command, const struct option* longopts) cerr << sformat(_("Unknown global option '%s'."), argv[optind - 1]) << endl; else cerr << sformat(_("Unknown option '%s' for command '%s'."), argv[optind - 1], command) << endl; - cerr << _("Try 'snapper help' for more information.") << endl; + cerr << _("Try 'snapper --help' for more information.") << endl; exit(EXIT_FAILURE); case ':': @@ -66,7 +66,7 @@ GetOpts::parse(const char* command, const struct option* longopts) cerr << sformat(_("Missing argument for global option '%s'."), argv[optind - 1]) << endl; else cerr << sformat(_("Missing argument for command option '%s'."), argv[optind - 1]) << endl; - cerr << _("Try 'snapper help' for more information.") << endl; + cerr << _("Try 'snapper --help' for more information.") << endl; exit(EXIT_FAILURE); default: