From 590e740d1355829a34eb719cb74a6981b81c4225 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Wed, 4 Feb 2009 09:56:33 -0800 Subject: [PATCH] fix readline support We don't always want to prompt with "tweet:", especially for the username or password, or when in "bash" mode. --- bti.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/bti.c b/bti.c index 3bcf055..09a31f4 100644 --- a/bti.c +++ b/bti.c @@ -87,7 +87,7 @@ static void display_version(void) fprintf(stdout, "bti - version %s\n", BTI_VERSION); } -static char *get_string_from_stdin(void) +static char *get_string_from_stdin(char *prompt) { static char *string = (char *)NULL; if (string) { @@ -95,7 +95,7 @@ static char *get_string_from_stdin(void) string = (char *)NULL; } - string = readline("tweet: "); + string = readline(prompt); return string; } @@ -513,15 +513,18 @@ int main(int argc, char *argv[], char *envp[]) if (!session->account) { fprintf(stdout, "Enter twitter account: "); - session->account = get_string_from_stdin(); + session->account = get_string_from_stdin("account: "); } if (!session->password) { fprintf(stdout, "Enter twitter password: "); - session->password = get_string_from_stdin(); + session->password = get_string_from_stdin("password: "); } - tweet = get_string_from_stdin(); + if (session->bash) + tweet = get_string_from_stdin(""); + else + tweet = get_string_from_stdin("tweet: "); if (!tweet || strlen(tweet) == 0) { dbg("no tweet?\n"); return -1; -- 2.39.5