/* ** Copyright (C) 2010 Dirk-Jan C. Binnema ** ** 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 the ** Free Software Foundation; either version 3, or (at your option) any ** later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software Foundation, ** Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ** */ #include #include #include #include #include /* for fileno() */ #include "mu-config.h" #include "mu-cmd.h" #include "mu-log.h" static gboolean init_log (MuConfigOptions *opts) { gboolean rv; if (opts->log_stderr) rv = mu_log_init_with_fd (fileno(stderr), FALSE, opts->quiet, opts->debug); else rv = mu_log_init (opts->muhome, TRUE, opts->quiet, opts->debug); if (!rv) g_printerr ("error: failed to initialize log\n"); return rv; } int main (int argc, char *argv[]) { MuConfigOptions config; gboolean rv; g_type_init (); if (!mu_config_init (&config, &argc, &argv)) return 1; if (!init_log (&config)) { mu_config_uninit (&config); return 1; } rv = mu_cmd_execute (&config); mu_log_uninit(); mu_config_uninit (&config); return rv ? 0 : 1; }