87 |
fprintf(stdout, "bti - version %s\n", BTI_VERSION); |
fprintf(stdout, "bti - version %s\n", BTI_VERSION); |
88 |
} |
} |
89 |
|
|
|
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; |
|
|
} |
|
|
|
|
90 |
static struct session *session_alloc(void) |
static struct session *session_alloc(void) |
91 |
{ |
{ |
92 |
struct session *session; |
struct session *session; |
500 |
|
|
501 |
if (!session->account) { |
if (!session->account) { |
502 |
fprintf(stdout, "Enter twitter account: "); |
fprintf(stdout, "Enter twitter account: "); |
503 |
session->account = get_string_from_stdin(""); |
session->account = readline(NULL); |
504 |
} |
} |
505 |
|
|
506 |
if (!session->password) { |
if (!session->password) { |
507 |
fprintf(stdout, "Enter twitter password: "); |
fprintf(stdout, "Enter twitter password: "); |
508 |
session->password = get_string_from_stdin(""); |
session->password = readline(NULL); |
509 |
} |
} |
510 |
|
|
511 |
if (session->bash) |
if (session->bash) |
512 |
tweet = get_string_from_stdin(""); |
tweet = readline(NULL); |
513 |
else |
else |
514 |
tweet = get_string_from_stdin("tweet: "); |
tweet = readline("tweet: "); |
515 |
if (!tweet || strlen(tweet) == 0) { |
if (!tweet || strlen(tweet) == 0) { |
516 |
dbg("no tweet?\n"); |
dbg("no tweet?\n"); |
517 |
return -1; |
return -1; |