From 37876dbad35e326019573adac3042299c47817f2 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 13 Feb 2009 22:27:11 -0800 Subject: [PATCH] Fix readline bug(s) --- bti.c | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/bti.c b/bti.c index b4af7f0..2f3b35a 100644 --- a/bti.c +++ b/bti.c @@ -87,19 +87,6 @@ static void display_version(void) fprintf(stdout, "bti - version %s\n", BTI_VERSION); } -static char *get_string_from_stdin(char *prompt) -{ - static char *string = (char *)NULL; - if (string) { - free(string); - string = (char *)NULL; - } - - string = readline(prompt); - - return string; -} - static struct session *session_alloc(void) { struct session *session; @@ -513,18 +500,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 = readline(NULL); } if (!session->password) { fprintf(stdout, "Enter twitter password: "); - session->password = get_string_from_stdin(""); + session->password = readline(NULL); } if (session->bash) - tweet = get_string_from_stdin(""); + tweet = readline(NULL); else - tweet = get_string_from_stdin("tweet: "); + tweet = readline("tweet: "); if (!tweet || strlen(tweet) == 0) { dbg("no tweet?\n"); return -1; -- 2.39.5