Remove verbose option, add quiet option.

Verbose is default.
Quiet option is enabled if a user specifies it in the cmdline arg.
This commit is contained in:
Taeho Oh 2016-01-23 20:27:01 +09:00
parent 5e8b1667f9
commit 562cf22cdc

View File

@ -15,7 +15,7 @@ static gchar *_omvs_outdir = "omvs_out";
static gint _omvs_jobs = 1;
static gint _omvs_sleep = 1000;
static gint _omvs_timeout = 10000;
static gboolean _omvs_verbose;
static gboolean _omvs_quiet;
static gchar **_omvs_net_dev_names;
static gchar **_omvs_net_dev_descs;
@ -35,8 +35,8 @@ static GOptionEntry _omvs_entries[] =
"Sleep time(milliseconds) between scans", "ms" },
{ "timeout", 't', 0, G_OPTION_ARG_INT, &_omvs_timeout,
"Timeout time(milliseconds) in each scan", "ms" },
{ "verbose", 'v', 0, G_OPTION_ARG_NONE, &_omvs_verbose,
"Be verbose", NULL },
{ "quiet", 'q', 0, G_OPTION_ARG_NONE, &_omvs_quiet,
"Print no log except for errors", NULL },
{ NULL }
};
@ -207,7 +207,7 @@ static gpointer _omvs_start_scan_job(gpointer data) {
addr_str =
g_strdup_printf("%d.%d.%d.%d", addr[0], addr[1], addr[2], addr[3]);
if (_omvs_verbose) {
if (!_omvs_quiet) {
g_print("[%p] start scanning %s\n", (void *)g_thread_self(), addr_str);
}
group_address = g_inet_address_new_from_string(addr_str);
@ -294,7 +294,7 @@ static gpointer _omvs_start_scan_job(gpointer data) {
uri = g_strdup_printf("udp://%s:%d", addr_str, udp_port);
filename =
g_strdup_printf("%s/%s-%d.png", _omvs_outdir, addr_str, udp_port);
if (_omvs_verbose) {
if (!_omvs_quiet) {
g_print("[%p] trying to save %s to %s\n", (void *)g_thread_self(),
uri, filename);
}
@ -341,7 +341,7 @@ static gpointer _omvs_start_scan_job(gpointer data) {
}
g_free(o_ipaddr->gsts);
if (_omvs_verbose) {
if (!_omvs_quiet) {
g_print("[%p] finish scanning %s\n", (void *)g_thread_self(), addr_str);
}
if (!g_socket_leave_multicast_group(socket, group_address, FALSE,