char *hosturl;
char *hostname;
int bash;
+ int interactive;
int shrink_urls;
int dry_run;
int page;
if (!fgets(string, 999, stdin))
return NULL;
temp = strchr(string, '\n');
- *temp = '\0';
+ if (temp)
+ *temp = '\0';
return string;
}
int (*bind_key)(int, void *);
void (*insert)(void);
- /* default to internal function if we can't find anything */
+ /* default to internal function if we can't or won't find anything */
session->readline = get_string;
+ if (!isatty(0))
+ return;
+ session->interactive = 1;
tmp = malloc(strlen(libpath)+1);
if (!tmp)
*next++ = 0;
if (*cp == 0)
continue;
- if ((handle = dlopen(cp, RTLD_NOW))) {
+ handle = dlopen(cp, RTLD_NOW);
+ if (handle) {
dbg("Using %s for readline library\n", cp);
break;
}
session->time, session->hostname);
else
fprintf(log_file, "%s: host=%s tweet=%s\n",
- session->time, session->hostname, session->tweet);
+ session->time, session->hostname,
+ session->tweet);
break;
case ACTION_FRIENDS:
fprintf(log_file, "%s: host=%s retrieving friends timeline\n",
if (!fgets(string, 999, stdin))
return NULL;
temp = strchr(string, '\n');
- *temp = '\0';
+ if (temp)
+ *temp = '\0';
return string;
}
}
if (session->action == ACTION_UPDATE) {
- if (session->bash)
+ if (session->bash || !session->interactive)
tweet = get_string_from_stdin();
else
tweet = session->readline("tweet: ");