X-Git-Url: https://git.toastfreeware.priv.at/gregoa/bti.git/blobdiff_plain/b430c57af11a0a294a6758ae6649783844829a81..35f9afd2df1cc9b633ec9eee01a3292dc7eb5ccd:/bti.c diff --git a/bti.c b/bti.c index 578e247..fe4c6e2 100644 --- a/bti.c +++ b/bti.c @@ -1,6 +1,7 @@ /* * Copyright (C) 2008 Greg Kroah-Hartman * Copyright (C) 2009 Bart Trojanowski + * Copyright (C) 2009 Amir Mohammad Saied * * 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 @@ -50,6 +51,7 @@ static int debug; +static int verbose; enum host { HOST_TWITTER = 0, @@ -110,6 +112,7 @@ static void display_help(void) fprintf(stdout, " --page PAGENUMBER\n"); fprintf(stdout, " --bash\n"); fprintf(stdout, " --debug\n"); + fprintf(stdout, " --verbose\n"); fprintf(stdout, " --dry-run\n"); fprintf(stdout, " --version\n"); fprintf(stdout, " --help\n"); @@ -224,8 +227,12 @@ static void parse_statuses(xmlDocPtr doc, xmlNodePtr current) } if (user && text && created) { - printf("[%s] (%.16s) %s\n", - user, created, text); + if (verbose) + printf("[%s] (%.16s) %s\n", + user, created, text); + else + printf("[%s] %s\n", + user, text); xmlFree(user); xmlFree(text); xmlFree(created); @@ -495,6 +502,13 @@ static void parse_configfile(struct session *session) !strncasecmp(c, "yes", 3)) shrink_urls = 1; } + else if (!strncasecmp(c, "verbose", 7) && + (c[7] == '=')) { + c += 8; + if (!strncasecmp(c, "true", 4) || + !strncasecmp(c, "yes", 3)) + verbose = 1; + } } while (!feof(config_file)); if (password) @@ -889,6 +903,7 @@ int main(int argc, char *argv[], char *envp[]) { static const struct option options[] = { { "debug", 0, NULL, 'd' }, + { "verbose", 0, NULL, 'V' }, { "account", 1, NULL, 'a' }, { "password", 1, NULL, 'p' }, { "host", 1, NULL, 'H' }, @@ -914,6 +929,7 @@ int main(int argc, char *argv[], char *envp[]) int page_nr; debug = 0; + verbose = 0; rl_bind_key('\t', rl_insert); session = session_alloc(); @@ -944,7 +960,7 @@ int main(int argc, char *argv[], char *envp[]) parse_configfile(session); while (1) { - option = getopt_long_only(argc, argv, "dqe:p:P:H:a:A:u:hg:sn", + option = getopt_long_only(argc, argv, "dp:P:H:a:A:u:hg:snVv", options, NULL); if (option == -1) break; @@ -952,6 +968,9 @@ int main(int argc, char *argv[], char *envp[]) case 'd': debug = 1; break; + case 'V': + verbose = 1; + break; case 'a': if (session->account) free(session->account);