]> ToastFreeware Gitweb - gregoa/bti.git/blobdiff - bti.c
Removing explicit mentions of twitter
[gregoa/bti.git] / bti.c
diff --git a/bti.c b/bti.c
index fcf2da1bad5f9bfe9c0922b0008790a5b5aa9ddd..2c2f4bee5f490688418e4962e4398452d8971bd1 100644 (file)
--- a/bti.c
+++ b/bti.c
@@ -338,6 +338,9 @@ static int send_request(struct session *session)
        if (!curl)
                return -EINVAL;
 
+       if (!session->hosturl)
+               session->hosturl = strdup(twitter_host);
+
        switch (session->action) {
        case ACTION_UPDATE:
                snprintf(user_password, sizeof(user_password), "%s:%s",
@@ -372,21 +375,23 @@ static int send_request(struct session *session)
 
                break;
        case ACTION_USER:
-               sprintf(endpoint, "%s%s%s.xml?page=%d", session->hosturl, user_uri,
-                               session->user, session->page);
+               sprintf(endpoint, "%s%s%s.xml?page=%d", session->hosturl,
+                       user_uri, session->user, session->page);
                curl_easy_setopt(curl, CURLOPT_URL, endpoint);
 
                break;
        case ACTION_REPLIES:
                snprintf(user_password, sizeof(user_password), "%s:%s",
                         session->account, session->password);
-               sprintf(endpoint, "%s%s?page=%d", session->hosturl, replies_uri, session->page);
+               sprintf(endpoint, "%s%s?page=%d", session->hosturl, replies_uri,
+                       session->page);
                curl_easy_setopt(curl, CURLOPT_URL, endpoint);
                curl_easy_setopt(curl, CURLOPT_USERPWD, user_password);
 
                break;
        case ACTION_PUBLIC:
-               sprintf(endpoint, "%s%s?page=%d", session->hosturl, public_uri, session->page);
+               sprintf(endpoint, "%s%s?page=%d", session->hosturl, public_uri,
+                       session->page);
                curl_easy_setopt(curl, CURLOPT_URL, endpoint);
 
                break;
@@ -666,7 +671,7 @@ void read_password(char *buf, size_t len)
        tp.c_lflag &= (~ECHO);
        tcsetattr(0, TCSANOW, &tp);
 
-       fprintf(stdout, "Enter twitter password: ");
+       fprintf(stdout, "Enter password: ");
        fflush(stdout);
        scanf("%79s", pwd);
        fprintf(stdout, "\n");
@@ -1112,10 +1117,8 @@ int main(int argc, char *argv[], char *envp[])
         * Show the version to make it easier to determine what
         * is going on here
         */
-       if (debug) {
+       if (debug)
                display_version();
-               fprintf(stderr, "%s", session->group);
-       }
 
        if (session->action == ACTION_UNKNOWN) {
                fprintf(stderr, "Unknown action, valid actions are:\n");
@@ -1135,14 +1138,13 @@ int main(int argc, char *argv[], char *envp[])
        }
 
        if (!session->account) {
-               fprintf(stdout, "Enter twitter account: ");
+               fprintf(stdout, "Enter account: ");
                session->account = readline(NULL);
        }
 
        if (!session->password) {
                read_password(password, sizeof(password));
                session->password = strdup(password);
-               free(password);
        }
 
        if (session->action == ACTION_UPDATE) {
@@ -1160,7 +1162,8 @@ int main(int argc, char *argv[], char *envp[])
 
                session->tweet = zalloc(strlen(tweet) + 10);
                if (session->bash)
-                       sprintf(session->tweet, "%c %s", getuid() ? '$' : '#', tweet);
+                       sprintf(session->tweet, "%c %s",
+                               getuid() ? '$' : '#', tweet);
                else
                        sprintf(session->tweet, "%s", tweet);