Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix readline mess when in --bash mode

Turns out it was echoing stdin to stdout, which is annoying, you
end up seeing everything that you just typed.
  • Loading branch information...
commit 78f54978ace1606785e6a0ab7933c4867ad38525 1 parent d581e72
@gregkh authored
Showing with 17 additions and 1 deletion.
  1. +17 −1 bti.c
View
18 bti.c
@@ -599,6 +599,22 @@ static void log_session(struct session *session, int retval)
fclose(log_file);
}
+static char *get_string_from_stdin(void)
+{
+ char *temp;
+ char *string;
+
+ string = zalloc(1000);
+ if (!string)
+ return NULL;
+
+ if (!fgets(string, 999, stdin))
+ return NULL;
+ temp = strchr(string, '\n');
+ *temp = '\0';
+ return string;
+}
+
int main(int argc, char *argv[], char *envp[])
{
static const struct option options[] = {
@@ -747,7 +763,7 @@ int main(int argc, char *argv[], char *envp[])
if (session->action == ACTION_UPDATE) {
if (session->bash)
- tweet = readline(NULL);
+ tweet = get_string_from_stdin();
else
tweet = readline("tweet: ");
if (!tweet || strlen(tweet) == 0) {
Please sign in to comment.
Something went wrong with that request. Please try again.