336 |
session->host = HOST_IDENTICA; |
session->host = HOST_IDENTICA; |
337 |
free(host); |
free(host); |
338 |
} |
} |
339 |
if (proxy) |
if (proxy) { |
340 |
|
if (session->proxy) |
341 |
|
free(session->proxy); |
342 |
session->proxy = proxy; |
session->proxy = proxy; |
343 |
|
} |
344 |
|
|
345 |
/* Free buffer and close file. */ |
/* Free buffer and close file. */ |
346 |
free(line); |
free(line); |
354 |
{ "account", 1, NULL, 'a' }, |
{ "account", 1, NULL, 'a' }, |
355 |
{ "password", 1, NULL, 'p' }, |
{ "password", 1, NULL, 'p' }, |
356 |
{ "host", 1, NULL, 'H' }, |
{ "host", 1, NULL, 'H' }, |
357 |
|
{ "proxy", 1, NULL, 'P' }, |
358 |
{ "help", 0, NULL, 'h' }, |
{ "help", 0, NULL, 'h' }, |
359 |
{ "bash", 0, NULL, 'b' }, |
{ "bash", 0, NULL, 'b' }, |
360 |
{ "version", 0, NULL, 'v' }, |
{ "version", 0, NULL, 'v' }, |
365 |
char *tweet; |
char *tweet; |
366 |
int retval; |
int retval; |
367 |
int option; |
int option; |
368 |
|
char *http_proxy; |
369 |
#if 0 |
#if 0 |
370 |
char *home = getenv("HOME"); |
char *home = getenv("HOME"); |
371 |
char *pwd = getenv("PWD"); |
char *pwd = getenv("PWD"); |
378 |
} |
} |
379 |
|
|
380 |
curl_global_init(CURL_GLOBAL_ALL); |
curl_global_init(CURL_GLOBAL_ALL); |
381 |
|
|
382 |
|
/* Set environment variables first, before reading command line options |
383 |
|
* or config file values. */ |
384 |
|
http_proxy = getenv("http_proxy"); |
385 |
|
if (http_proxy) { |
386 |
|
if (session->proxy) |
387 |
|
free(session->proxy); |
388 |
|
session->proxy = strdup(http_proxy); |
389 |
|
dbg("http_proxy = %s\n", session->proxy); |
390 |
|
} |
391 |
|
|
392 |
parse_configfile(session); |
parse_configfile(session); |
393 |
|
|
394 |
while (1) { |
while (1) { |
395 |
option = getopt_long_only(argc, argv, "dqe:p:H:a:h", |
option = getopt_long_only(argc, argv, "dqe:p:P:H:a:h", |
396 |
options, NULL); |
options, NULL); |
397 |
if (option == -1) |
if (option == -1) |
398 |
break; |
break; |
412 |
session->password = strdup(optarg); |
session->password = strdup(optarg); |
413 |
dbg("password = %s\n", session->password); |
dbg("password = %s\n", session->password); |
414 |
break; |
break; |
415 |
|
case 'P': |
416 |
|
if (session->proxy) |
417 |
|
free(session->proxy); |
418 |
|
session->proxy = strdup(optarg); |
419 |
|
dbg("proxy = %s\n", session->proxy); |
420 |
|
break; |
421 |
case 'H': |
case 'H': |
422 |
if (strcasecmp(optarg, "twitter") == 0) |
if (strcasecmp(optarg, "twitter") == 0) |
423 |
session->host = HOST_TWITTER; |
session->host = HOST_TWITTER; |