]> ToastFreeware Gitweb - gregoa/bti.git/blobdiff - bti.c
Die if no host is provided.
[gregoa/bti.git] / bti.c
diff --git a/bti.c b/bti.c
index a9a6d435bd89a2e7ee34397cf503953d933dd34b..8447a9d4b650282798b452af3c2188d5126de188 100644 (file)
--- a/bti.c
+++ b/bti.c
@@ -656,9 +656,10 @@ static char *get_string_from_stdin(void)
        return string;
 }
 
-void read_password(char *buf, size_t len)
+static void read_password(char *buf, size_t len)
 {
        char pwd[80];
+       int retval;
        struct termios old;
        struct termios tp;
 
@@ -670,7 +671,9 @@ void read_password(char *buf, size_t len)
 
        fprintf(stdout, "Enter twitter password: ");
        fflush(stdout);
-       scanf("%79s", pwd);
+       tcflow(0, TCOOFF);
+       retval = scanf("%79s", pwd);
+       tcflow(0, TCOON);
        fprintf(stdout, "\n");
 
        tcsetattr(0, TCSANOW, &old);
@@ -1124,6 +1127,11 @@ int main(int argc, char *argv[], char *envp[])
                goto exit;
        }
 
+       if (!session->host) {
+               fprintf(stderr, "You need to provide a host either in ~/.bti or with --host.\n");
+               goto exit;
+       }
+
        if (session->host == HOST_TWITTER && session->action == ACTION_GROUP) {
                fprintf(stderr, "Groups only work in Identi.ca.\n");
                goto exit;