Skip to content
Browse files

Fix readline bug(s)

  • Loading branch information...
1 parent afcac23 commit 37876dbad35e326019573adac3042299c47817f2 @gregkh committed Feb 13, 2009
Showing with 4 additions and 17 deletions.
  1. +4 −17 bti.c
View
21 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;

0 comments on commit 37876db

Please sign in to comment.
Something went wrong with that request. Please try again.