mirror of https://github.com/djcb/mu.git
* mu, mu-config: add --version, prepare logging support
This commit is contained in:
parent
8c74e0569d
commit
bc99a753da
|
@ -31,6 +31,15 @@ mu_config_options_group_mu (MuConfigOptions *opts)
|
|||
"print debug output to standard-error", NULL },
|
||||
{ "quiet", 'q', 0, G_OPTION_ARG_NONE, &opts->quiet,
|
||||
"don't give any progress information", NULL },
|
||||
{"version", 'v', 0, G_OPTION_ARG_NONE, &opts->version,
|
||||
"display version and copyright information", NULL},
|
||||
{"muhome", 'h', 0, G_OPTION_ARG_FILENAME, &opts->muhome,
|
||||
"mu directory", NULL},
|
||||
{"log-stderr", 's', 0, G_OPTION_ARG_NONE, &opts->log_stderr,
|
||||
"log to standard error", NULL},
|
||||
{"log-append", 'a', 0, G_OPTION_ARG_NONE, &opts->log_append,
|
||||
"append to the current logfile (instead of overwriting it)",
|
||||
NULL},
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
|
|
@ -31,6 +31,10 @@ struct _MuConfigOptions {
|
|||
/* general options */
|
||||
gboolean quiet; /* don't give any output */
|
||||
gboolean debug; /* spew out debug info */
|
||||
const char *muhome;/* the House of Mu */
|
||||
gboolean version; /* request mu version */
|
||||
gboolean log_stderr; /*log to stderr (instead of logfile)*/
|
||||
gboolean log_append; /* append to log (instead of overwriting)*/
|
||||
|
||||
/* options for indexing */
|
||||
const char *maildir; /* where the mails are */
|
||||
|
|
25
src/mu.c
25
src/mu.c
|
@ -17,6 +17,8 @@
|
|||
**
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <glib.h>
|
||||
#include <glib-object.h>
|
||||
#include <string.h>
|
||||
|
@ -84,6 +86,23 @@ show_help (const char* cmd)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
show_version (void)
|
||||
{
|
||||
const char* msg =
|
||||
"mu (mail indexer / searcher version) " VERSION "\n\n"
|
||||
"copyright (C) 2009 Dirk-Jan C. Binnema\n"
|
||||
"license GPLv3+: GNU GPL version 3 or later "
|
||||
"<http://gnu.org/licenses/gpl.html>.\n\n"
|
||||
"This is free software: you are free to change "
|
||||
"and redistribute it.\n"
|
||||
"There is NO WARRANTY, to the extent permitted by law.";
|
||||
|
||||
g_print ("%s\n", msg);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
show_usage (gboolean noerror)
|
||||
{
|
||||
|
@ -99,7 +118,6 @@ show_usage (gboolean noerror)
|
|||
|
||||
return noerror ? 0 : 1;
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
|
@ -129,9 +147,14 @@ main (int argc, char *argv[])
|
|||
return 1;
|
||||
}
|
||||
|
||||
if (config.version)
|
||||
return show_version ();
|
||||
|
||||
if (argc < 2)
|
||||
return show_usage (FALSE);
|
||||
|
||||
|
||||
|
||||
cmd = parse_cmd (argv[1]);
|
||||
if (cmd == MU_CMD_UNKNOWN)
|
||||
return show_usage (FALSE);
|
||||
|
|
Loading…
Reference in New Issue