* mu-cmd-index.c: small cleanup, keep func len <= 33
This commit is contained in:
@ -76,7 +76,7 @@ install_sig_handler (void)
|
|||||||
|
|
||||||
for (i = 0; i != G_N_ELEMENTS(sigs); ++i)
|
for (i = 0; i != G_N_ELEMENTS(sigs); ++i)
|
||||||
if (sigaction (sigs[i], &action, NULL) != 0)
|
if (sigaction (sigs[i], &action, NULL) != 0)
|
||||||
g_warning ("error: set sigaction for %d failed: %s",
|
g_critical ("set sigaction for %d failed: %s",
|
||||||
sigs[i], strerror (errno));;
|
sigs[i], strerror (errno));;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,17 +85,18 @@ static gboolean
|
|||||||
check_index_params (MuConfigOptions *opts)
|
check_index_params (MuConfigOptions *opts)
|
||||||
{
|
{
|
||||||
if (opts->linksdir || opts->xquery) {
|
if (opts->linksdir || opts->xquery) {
|
||||||
g_warning ("Error: Invalid option(s) for command");
|
g_warning ("invalid option(s) for command");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!opts->maildir || !g_path_is_absolute (opts->maildir)) {
|
if (!opts->maildir || !g_path_is_absolute (opts->maildir)) {
|
||||||
g_warning ("Error: maildir path is not valid");
|
g_warning ("maildir path '%s' is not valid",
|
||||||
|
opts->maildir);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mu_util_check_dir (opts->maildir, TRUE, FALSE)) {
|
if (!mu_util_check_dir (opts->maildir, TRUE, FALSE)) {
|
||||||
g_warning ("Error: not a valid Maildir (%s)",
|
g_warning ("not a valid Maildir: %s",
|
||||||
opts->maildir);
|
opts->maildir);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -233,16 +234,12 @@ mu_cmd_index (MuConfigOptions *opts)
|
|||||||
MuIndexStats stats;
|
MuIndexStats stats;
|
||||||
time_t t;
|
time_t t;
|
||||||
|
|
||||||
g_return_val_if_fail (opts, FALSE);
|
g_return_val_if_fail (opts && mu_cmd_equals (opts, "index"), FALSE);
|
||||||
g_return_val_if_fail (mu_cmd_equals (opts, "index"), FALSE);
|
|
||||||
|
|
||||||
if (!check_index_params (opts) || !database_version_check_and_update(opts))
|
if (!check_index_params (opts) || !database_version_check_and_update(opts))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
install_sig_handler ();
|
if (!(midx = mu_index_new (opts->xpath))) {
|
||||||
|
|
||||||
midx = mu_index_new (opts->xpath);
|
|
||||||
if (!midx) {
|
|
||||||
g_warning ("Indexing failed");
|
g_warning ("Indexing failed");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -253,9 +250,9 @@ mu_cmd_index (MuConfigOptions *opts)
|
|||||||
|
|
||||||
mu_index_stats_clear (&stats);
|
mu_index_stats_clear (&stats);
|
||||||
quiet = opts->quiet || !isatty(fileno(stdout));
|
quiet = opts->quiet || !isatty(fileno(stdout));
|
||||||
|
install_sig_handler ();
|
||||||
rv = mu_index_run (midx, opts->maildir, opts->reindex, &stats,
|
rv = mu_index_run (midx, opts->maildir, opts->reindex, &stats,
|
||||||
quiet ? index_msg_silent_cb :index_msg_cb,
|
quiet ? index_msg_silent_cb :index_msg_cb, NULL, NULL);
|
||||||
NULL, NULL);
|
|
||||||
maybe_newline (opts->quiet);
|
maybe_newline (opts->quiet);
|
||||||
show_time ((unsigned)(time(NULL)-t), stats._processed);
|
show_time ((unsigned)(time(NULL)-t), stats._processed);
|
||||||
mu_index_destroy (midx);
|
mu_index_destroy (midx);
|
||||||
|
|||||||
Reference in New Issue
Block a user