update (c) year

And some whitespace cleanup. The (c) year doesn't matter too much, but
let's close the ticket.

Fixes: #2075.
This commit is contained in:
Dirk-Jan C. Binnema 2021-08-03 12:47:20 +03:00
parent 907db013c0
commit 321e747882
2 changed files with 60 additions and 60 deletions

View File

@ -16,7 +16,7 @@
AC_PREREQ([2.68]) AC_PREREQ([2.68])
AC_INIT([mu],[1.6.1],[https://github.com/djcb/mu/issues],[mu]) AC_INIT([mu],[1.6.1],[https://github.com/djcb/mu/issues],[mu])
AC_COPYRIGHT([Copyright (C) 2008-2020 Dirk-Jan C. Binnema]) AC_COPYRIGHT([Copyright (C) 2008-2021 Dirk-Jan C. Binnema])
AC_CONFIG_HEADERS([config.h]) AC_CONFIG_HEADERS([config.h])
AC_CONFIG_SRCDIR([mu/mu.cc]) AC_CONFIG_SRCDIR([mu/mu.cc])
# libtoolize wants to put some stuff in here; if you have an old # libtoolize wants to put some stuff in here; if you have an old

118
mu/mu.cc
View File

@ -1,5 +1,5 @@
/* /*
** Copyright (C) 2008-2020 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl> ** Copyright (C) 2008-2021 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
** **
** This program is free software; you can redistribute it and/or modify it ** 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 ** under the terms of the GNU General Public License as published by the
@ -33,16 +33,16 @@ using namespace Mu;
static void static void
show_version (void) show_version (void)
{ {
const char* blurb = const char* blurb =
"mu (mail indexer/searcher) version " VERSION "\n" "mu (mail indexer/searcher) version " VERSION "\n"
"Copyright (C) 2008-2020 Dirk-Jan C. Binnema\n" "Copyright (C) 2008-2021 Dirk-Jan C. Binnema\n"
"License GPLv3+: GNU GPL version 3 or later " "License GPLv3+: GNU GPL version 3 or later "
"<http://gnu.org/licenses/gpl.html>.\n" "<http://gnu.org/licenses/gpl.html>.\n"
"This is free software: you are free to change " "This is free software: you are free to change "
"and redistribute it.\n" "and redistribute it.\n"
"There is NO WARRANTY, to the extent permitted by law."; "There is NO WARRANTY, to the extent permitted by law.";
g_print ("%s\n", blurb); g_print ("%s\n", blurb);
} }
@ -50,12 +50,12 @@ static void
handle_error (MuConfig *conf, MuError merr, GError **err) handle_error (MuConfig *conf, MuError merr, GError **err)
{ {
if (!(err && *err)) if (!(err && *err))
return; return;
using Color = MaybeAnsi::Color; using Color = MaybeAnsi::Color;
MaybeAnsi col{conf ? !conf->nocolor : false}; MaybeAnsi col{conf ? !conf->nocolor : false};
if (*err) if (*err)
std::cerr << col.fg(Color::Red) << "error" << col.reset() << ": " std::cerr << col.fg(Color::Red) << "error" << col.reset() << ": "
<< col.fg(Color::BrightYellow) << col.fg(Color::BrightYellow)
<< ((*err) ? (*err)->message : "something when wrong") << ((*err) ? (*err)->message : "something when wrong")
@ -63,35 +63,35 @@ handle_error (MuConfig *conf, MuError merr, GError **err)
std::cerr << col.fg(Color::Green); std::cerr << col.fg(Color::Green);
switch ((*err)->code) { switch ((*err)->code) {
case MU_ERROR_XAPIAN_CANNOT_GET_WRITELOCK: case MU_ERROR_XAPIAN_CANNOT_GET_WRITELOCK:
std::cerr << "Maybe mu is already running?\n"; std::cerr << "Maybe mu is already running?\n";
break; break;
case MU_ERROR_XAPIAN_NEEDS_REINDEX: case MU_ERROR_XAPIAN_NEEDS_REINDEX:
std::cerr << "Database needs (re)indexing.\n" std::cerr << "Database needs (re)indexing.\n"
<< "try 'mu index' " << "try 'mu index' "
<< "(see mu-index(1) for details)\n"; << "(see mu-index(1) for details)\n";
return; return;
case MU_ERROR_IN_PARAMETERS: case MU_ERROR_IN_PARAMETERS:
if (conf && mu_config_cmd_is_valid(conf->cmd)) if (conf && mu_config_cmd_is_valid(conf->cmd))
mu_config_show_help (conf->cmd); mu_config_show_help (conf->cmd);
break; break;
case MU_ERROR_SCRIPT_NOT_FOUND: case MU_ERROR_SCRIPT_NOT_FOUND:
std::cerr << "See the mu manpage for commands, or " std::cerr << "See the mu manpage for commands, or "
<< "'mu script' for the scripts\n"; << "'mu script' for the scripts\n";
break; break;
case MU_ERROR_XAPIAN_CANNOT_OPEN: case MU_ERROR_XAPIAN_CANNOT_OPEN:
std::cerr << "Please (re)initialize mu with 'mu init' " std::cerr << "Please (re)initialize mu with 'mu init' "
<< "see mu-init(1) for details\n"; << "see mu-init(1) for details\n";
return; return;
case MU_ERROR_XAPIAN_SCHEMA_MISMATCH: case MU_ERROR_XAPIAN_SCHEMA_MISMATCH:
std::cerr << "Please (re)initialize mu with 'mu init' " std::cerr << "Please (re)initialize mu with 'mu init' "
<< "see mu-init(1) for details\n"; << "see mu-init(1) for details\n";
return; return;
default: default:
break; /* nothing to do */ break; /* nothing to do */
} }
std::cerr << col.reset(); std::cerr << col.reset();
} }
@ -100,41 +100,41 @@ handle_error (MuConfig *conf, MuError merr, GError **err)
int int
main (int argc, char *argv[]) main (int argc, char *argv[])
{ {
GError *err; GError *err;
MuError rv; MuError rv;
MuConfig *conf; MuConfig *conf;
setlocale (LC_ALL, ""); setlocale (LC_ALL, "");
err = NULL; err = NULL;
rv = MU_OK; rv = MU_OK;
conf = mu_config_init (&argc, &argv, &err); conf = mu_config_init (&argc, &argv, &err);
if (!conf) { if (!conf) {
rv = err ? (MuError)err->code : MU_ERROR; rv = err ? (MuError)err->code : MU_ERROR;
goto cleanup; goto cleanup;
} else if (conf->version) { } else if (conf->version) {
show_version (); show_version ();
goto cleanup; goto cleanup;
} }
/* nothing to do */ /* nothing to do */
if (conf->cmd == MU_CONFIG_CMD_NONE) if (conf->cmd == MU_CONFIG_CMD_NONE)
return 0; return 0;
if (!mu_runtime_init (conf->muhome, PACKAGE_NAME, conf->debug)) { if (!mu_runtime_init (conf->muhome, PACKAGE_NAME, conf->debug)) {
mu_config_uninit (conf); mu_config_uninit (conf);
return 1; return 1;
} }
rv = mu_cmd_execute (conf, &err); rv = mu_cmd_execute (conf, &err);
cleanup: cleanup:
handle_error (conf, rv, &err); handle_error (conf, rv, &err);
g_clear_error (&err); g_clear_error (&err);
mu_config_uninit (conf); mu_config_uninit (conf);
mu_runtime_uninit (); mu_runtime_uninit ();
return rv; return rv;
} }