summaryrefslogtreecommitdiff
path: root/src/apk.c
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2012-02-24 08:47:19 +0200
committerTimo Teräs <timo.teras@iki.fi>2012-02-24 08:47:37 +0200
commite145738acea4bcc3f77ac7573802215a55275d88 (patch)
treecc9e406b1e7373ac2ec4cd0b22e3ff5f706c550d /src/apk.c
parent4676c5d63ac70f4bf2c4e4c945a7fa65941676e9 (diff)
downloadapk-tools-e145738acea4bcc3f77ac7573802215a55275d88.tar.gz
apk-tools-e145738acea4bcc3f77ac7573802215a55275d88.tar.bz2
apk-tools-e145738acea4bcc3f77ac7573802215a55275d88.tar.xz
apk-tools-e145738acea4bcc3f77ac7573802215a55275d88.zip
apk: do not enable automatically interactive mode with --simulate
Diffstat (limited to 'src/apk.c')
-rw-r--r--src/apk.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/apk.c b/src/apk.c
index 752409f..3bf1154 100644
--- a/src/apk.c
+++ b/src/apk.c
@@ -264,14 +264,21 @@ static void on_sigwinch(int s)
static void setup_terminal(void)
{
setvbuf(stderr, NULL, _IOLBF, BUFSIZ);
- if (isatty(STDOUT_FILENO) && isatty(STDERR_FILENO) && isatty(STDIN_FILENO)) {
- apk_flags |= APK_PROGRESS;
- if (access("/etc/apk/interactive", F_OK) == 0)
- apk_flags |= APK_INTERACTIVE;
- }
signal(SIGWINCH, on_sigwinch);
}
+static void setup_automatic_flags(void)
+{
+ if (!isatty(STDOUT_FILENO) || !isatty(STDERR_FILENO) ||
+ !isatty(STDIN_FILENO))
+ return;
+
+ apk_flags |= APK_PROGRESS;
+ if (!(apk_flags & APK_SIMULATE) &&
+ access("/etc/apk/interactive", F_OK) == 0)
+ apk_flags |= APK_INTERACTIVE;
+}
+
int main(int argc, char **argv)
{
struct apk_applet *applet;
@@ -422,6 +429,7 @@ int main(int argc, char **argv)
break;
}
}
+ setup_automatic_flags();
if (applet == NULL) {
r = usage(NULL);