chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
gentoo: vconsole-setup support.
[elogind.git]
/
src
/
util.c
diff --git
a/src/util.c
b/src/util.c
index 47da11c1b8b0ce3633e352a8ce26be0ee081ec9b..bdc194e80c9ce45bde0975d7ef9c5ab4b4482bfd 100644
(file)
--- a/
src/util.c
+++ b/
src/util.c
@@
-641,8
+641,8
@@
int parse_env_file(
n = strcspn(p, seperator);
if (n >= 2 &&
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);
v = strndup(p+1, n-2);
else
v = strndup(p, n);
@@
-2009,23
+2009,29
@@
int read_one_char(FILE *f, char *ret, bool *need_nl) {
}
int ask(char *ret, const char *replies, const char *text, ...) {
}
int ask(char *ret, const char *replies, const char *text, ...) {
+ bool on_tty;
+
assert(ret);
assert(replies);
assert(text);
assert(ret);
assert(replies);
assert(text);
+ on_tty = isatty(STDOUT_FILENO);
+
for (;;) {
va_list ap;
char c;
int r;
bool need_nl = true;
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);
va_start(ap, text);
vprintf(text, ap);
va_end(ap);
- fputs("\x1B[0m", stdout);
+ if (on_tty)
+ fputs("\x1B[0m", stdout);
fflush(stdout);
fflush(stdout);