1 |
/* |
/* |
2 |
* Copyright (C) 2008 Greg Kroah-Hartman <greg@kroah.com> |
* Copyright (C) 2008 Greg Kroah-Hartman <greg@kroah.com> |
3 |
* Copyright (C) 2009 Bart Trojanowski <bart@jukie.net> |
* Copyright (C) 2009 Bart Trojanowski <bart@jukie.net> |
4 |
|
* Copyright (C) 2009 Amir Mohammad Saied <amirsaied@gmail.com> |
5 |
* |
* |
6 |
* 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 |
7 |
* 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 |
51 |
|
|
52 |
|
|
53 |
static int debug; |
static int debug; |
54 |
|
static int verbose; |
55 |
|
|
56 |
enum host { |
enum host { |
57 |
HOST_TWITTER = 0, |
HOST_TWITTER = 0, |
112 |
fprintf(stdout, " --page PAGENUMBER\n"); |
fprintf(stdout, " --page PAGENUMBER\n"); |
113 |
fprintf(stdout, " --bash\n"); |
fprintf(stdout, " --bash\n"); |
114 |
fprintf(stdout, " --debug\n"); |
fprintf(stdout, " --debug\n"); |
115 |
|
fprintf(stdout, " --verbose\n"); |
116 |
fprintf(stdout, " --dry-run\n"); |
fprintf(stdout, " --dry-run\n"); |
117 |
fprintf(stdout, " --version\n"); |
fprintf(stdout, " --version\n"); |
118 |
fprintf(stdout, " --help\n"); |
fprintf(stdout, " --help\n"); |
176 |
free(buffer); |
free(buffer); |
177 |
} |
} |
178 |
|
|
179 |
static const char *twitter_host = "http://twitter.com/statuses"; |
static const char *twitter_host = "https://twitter.com/statuses"; |
180 |
static const char *identica_host = "https://identi.ca/api/statuses"; |
static const char *identica_host = "https://identi.ca/api/statuses"; |
181 |
|
|
182 |
static const char *user_uri = "/user_timeline/"; |
static const char *user_uri = "/user_timeline/"; |
227 |
} |
} |
228 |
|
|
229 |
if (user && text && created) { |
if (user && text && created) { |
230 |
printf("[%s] (%.16s) %s\n", |
if (verbose) |
231 |
user, created, text); |
printf("[%s] (%.16s) %s\n", |
232 |
|
user, created, text); |
233 |
|
else |
234 |
|
printf("[%s] %s\n", |
235 |
|
user, text); |
236 |
xmlFree(user); |
xmlFree(user); |
237 |
xmlFree(text); |
xmlFree(text); |
238 |
xmlFree(created); |
xmlFree(created); |
502 |
!strncasecmp(c, "yes", 3)) |
!strncasecmp(c, "yes", 3)) |
503 |
shrink_urls = 1; |
shrink_urls = 1; |
504 |
} |
} |
505 |
|
else if (!strncasecmp(c, "verbose", 7) && |
506 |
|
(c[7] == '=')) { |
507 |
|
c += 8; |
508 |
|
if (!strncasecmp(c, "true", 4) || |
509 |
|
!strncasecmp(c, "yes", 3)) |
510 |
|
verbose = 1; |
511 |
|
} |
512 |
} while (!feof(config_file)); |
} while (!feof(config_file)); |
513 |
|
|
514 |
if (password) |
if (password) |
903 |
{ |
{ |
904 |
static const struct option options[] = { |
static const struct option options[] = { |
905 |
{ "debug", 0, NULL, 'd' }, |
{ "debug", 0, NULL, 'd' }, |
906 |
|
{ "verbose", 0, NULL, 'V' }, |
907 |
{ "account", 1, NULL, 'a' }, |
{ "account", 1, NULL, 'a' }, |
908 |
{ "password", 1, NULL, 'p' }, |
{ "password", 1, NULL, 'p' }, |
909 |
{ "host", 1, NULL, 'H' }, |
{ "host", 1, NULL, 'H' }, |
929 |
int page_nr; |
int page_nr; |
930 |
|
|
931 |
debug = 0; |
debug = 0; |
932 |
|
verbose = 0; |
933 |
rl_bind_key('\t', rl_insert); |
rl_bind_key('\t', rl_insert); |
934 |
|
|
935 |
session = session_alloc(); |
session = session_alloc(); |
960 |
parse_configfile(session); |
parse_configfile(session); |
961 |
|
|
962 |
while (1) { |
while (1) { |
963 |
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", |
964 |
options, NULL); |
options, NULL); |
965 |
if (option == -1) |
if (option == -1) |
966 |
break; |
break; |
968 |
case 'd': |
case 'd': |
969 |
debug = 1; |
debug = 1; |
970 |
break; |
break; |
971 |
|
case 'V': |
972 |
|
verbose = 1; |
973 |
|
break; |
974 |
case 'a': |
case 'a': |
975 |
if (session->account) |
if (session->account) |
976 |
free(session->account); |
free(session->account); |