# We need -lcurl for the curl stuff
# We need -lsocket and -lnsl when on Solaris
+# We need -lreadline for readline support
# We need -lssl and -lcrypto when using libcurl with SSL support
# We need -lpthread for the pthread example
#LIB_OBJS = -lcurl -lnsl -lssl -lcrypto
-LIB_OBJS = -lcurl -lnsl
+LIB_OBJS = -lcurl -lnsl -lreadline
all: $(PROGRAM) $(MAN_PAGES)
#include <time.h>
#include <sys/stat.h>
#include <curl/curl.h>
+#include <readline/readline.h>
#include "bti_version.h"
static char *get_string_from_stdin(void)
{
- char *temp;
- char *string;
+ static char *string = (char *)NULL;
+ if (string) {
+ free(string);
+ string = (char *)NULL;
+ }
- string = zalloc(1000);
- if (!string)
- return NULL;
+ string = readline("tweet: ");
- if (!fgets(string, 999, stdin))
- return NULL;
- temp = strchr(string, '\n');
- *temp = '\0';
return string;
}
char *dir;
#endif
+ rl_bind_key('\t', rl_insert);
session = session_alloc();
if (!session) {
fprintf(stderr, "no more memory...\n");