n = strcspn(p, seperator);
if (n >= 2 &&
- strchr(QUOTES, v[0]) &&
- v[n-1] == v[0])
+ strchr(QUOTES, p[0]) &&
+ p[n-1] == p[0])
v = strndup(p+1, n-2);
else
v = strndup(p, n);
}
int ask(char *ret, const char *replies, const char *text, ...) {
+ bool on_tty;
+
assert(ret);
assert(replies);
assert(text);
+ on_tty = isatty(STDOUT_FILENO);
+
for (;;) {
va_list ap;
char c;
int r;
bool need_nl = true;
- fputs("\x1B[1m", stdout);
+ if (on_tty)
+ fputs("\x1B[1m", stdout);
va_start(ap, text);
vprintf(text, ap);
va_end(ap);
- fputs("\x1B[0m", stdout);
+ if (on_tty)
+ fputs("\x1B[0m", stdout);
fflush(stdout);