* update to use config->params instead of argv

This commit is contained in:
Dirk-Jan C. Binnema 2009-12-11 22:05:50 +02:00
parent 9e5e2b04e8
commit 7dc44abd9d
1 changed files with 8 additions and 11 deletions

View File

@ -191,10 +191,10 @@ main (int argc, char *argv[])
if (config.version) if (config.version)
return show_version (); return show_version ();
if (argc < 2) if (!config.params[0]) /* no command? */
return show_usage (FALSE); return show_usage (FALSE);
cmd = parse_cmd (argv[1]); cmd = parse_cmd (config.params[0]);
if (cmd == MU_CMD_UNKNOWN) if (cmd == MU_CMD_UNKNOWN)
return show_usage (FALSE); return show_usage (FALSE);
@ -202,7 +202,7 @@ main (int argc, char *argv[])
return show_help (argc > 2 ? argv[2] : NULL); return show_help (argc > 2 ? argv[2] : NULL);
if (!init_log (&config)) if (!init_log (&config))
return 1; return 1;
mu_msg_gmime_init (); mu_msg_gmime_init ();
rv = MU_OK; rv = MU_OK;
@ -223,16 +223,12 @@ main (int argc, char *argv[])
mu_index_destroy (midx); mu_index_destroy (midx);
} else if (cmd == MU_CMD_QUERY) { } else if (cmd == MU_CMD_QUERY) {
GSList *args; if (!config.params[1]) {
if (argc < 3) {
g_printerr ("error: missing something to search for\n"); g_printerr ("error: missing something to search for\n");
rv = 1; rv = 1;
} else { } else
args = mu_util_strlist_from_args (argc-2, argv+2); rv = mu_query_run (&config, &config.params[1]);
rv = mu_query_run (&config, args);
mu_util_strlist_free (args);
}
} }
mu_msg_gmime_uninit(); mu_msg_gmime_uninit();
@ -241,3 +237,4 @@ main (int argc, char *argv[])
return rv == MU_OK ? 0 : 1; return rv == MU_OK ? 0 : 1;
} }