session->host = HOST_IDENTICA;
free(host);
}
- if (proxy)
+ if (proxy) {
+ if (session->proxy)
+ free(session->proxy);
session->proxy = proxy;
+ }
/* Free buffer and close file. */
free(line);
{ "account", 1, NULL, 'a' },
{ "password", 1, NULL, 'p' },
{ "host", 1, NULL, 'H' },
+ { "proxy", 1, NULL, 'P' },
{ "help", 0, NULL, 'h' },
{ "bash", 0, NULL, 'b' },
{ "version", 0, NULL, 'v' },
char *tweet;
int retval;
int option;
+ char *http_proxy;
#if 0
char *home = getenv("HOME");
char *pwd = getenv("PWD");
}
curl_global_init(CURL_GLOBAL_ALL);
+
+ /* Set environment variables first, before reading command line options
+ * or config file values. */
+ http_proxy = getenv("http_proxy");
+ if (http_proxy) {
+ if (session->proxy)
+ free(session->proxy);
+ session->proxy = strdup(http_proxy);
+ dbg("http_proxy = %s\n", session->proxy);
+ }
+
parse_configfile(session);
while (1) {
- option = getopt_long_only(argc, argv, "dqe:p:H:a:h",
+ option = getopt_long_only(argc, argv, "dqe:p:P:H:a:h",
options, NULL);
if (option == -1)
break;
session->password = strdup(optarg);
dbg("password = %s\n", session->password);
break;
+ case 'P':
+ if (session->proxy)
+ free(session->proxy);
+ session->proxy = strdup(optarg);
+ dbg("proxy = %s\n", session->proxy);
+ break;
case 'H':
if (strcasecmp(optarg, "twitter") == 0)
session->host = HOST_TWITTER;