2
** Copyright (C) 2010 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
4
** This program is free software; you can redistribute it and/or modify it
5
** under the terms of the GNU General Public License as published by the
6
** Free Software Foundation; either version 3, or (at your option) any
9
** This program is distributed in the hope that it will be useful,
10
** but WITHOUT ANY WARRANTY; without even the implied warranty of
11
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
** GNU General Public License for more details.
14
** You should have received a copy of the GNU General Public License
15
** along with this program; if not, write to the Free Software Foundation,
16
** Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23
#include <glib-object.h>
25
#include <stdio.h> /* for fileno() */
27
#include "mu-config.h"
32
init_log (MuConfigOptions *opts)
37
rv = mu_log_init_with_fd (fileno(stderr), FALSE,
38
opts->quiet, opts->debug);
40
rv = mu_log_init (opts->muhome, TRUE, opts->quiet,
44
g_printerr ("error: failed to initialize log\n");
50
parse_params (MuConfigOptions *config, int *argcp, char ***argvp)
53
GOptionContext *context;
56
context = g_option_context_new ("- maildir utilities");
58
g_option_context_set_main_group (context,
59
mu_config_options_group_mu (config));
60
g_option_context_add_group (context,
61
mu_config_options_group_index (config));
62
g_option_context_add_group (context,
63
mu_config_options_group_find (config));
65
rv = g_option_context_parse (context, argcp, argvp, &error);
67
g_printerr ("error in options: %s\n", error->message);
70
g_option_context_free (context);
71
mu_config_set_defaults (config);
79
main (int argc, char *argv[])
81
MuConfigOptions config;
86
mu_config_init (&config);
91
if (!parse_params (&config, &argc, &argv))
94
if (!init_log (&config))
97
rv = mu_cmd_execute (&config);
103
mu_config_uninit (&config);