summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGuillem Jover <guillem@debian.org>2019-02-23 04:47:12 +0100
committerGuillem Jover <guillem@debian.org>2019-02-23 15:26:27 +0100
commite566532b04c4d263001f798b4cea3488be00400c (patch)
tree93a490f0fefbd87398fd6d917971ba47465a1a9c /src
parentc6fe5807feb2b1fcddd56831af29183184db4f4a (diff)
downloaddpkg-e566532b04c4d263001f798b4cea3488be00400c.tar.gz
dpkg: Print the current set of enabled force options on --force-help
This will make it possible to reason more easily about what is getting enabled.
Diffstat (limited to 'src')
-rw-r--r--src/force.c25
-rw-r--r--src/force.h2
2 files changed, 27 insertions, 0 deletions
diff --git a/src/force.c b/src/force.c
index 13c53f3d6..f3e4d902d 100644
--- a/src/force.c
+++ b/src/force.c
@@ -217,6 +217,25 @@ static const struct forceinfo {
}
};
+char *
+get_force_string(void)
+{
+ const struct forceinfo *fip;
+ struct varbuf vb = VARBUF_INIT;
+
+ for (fip = forceinfos; fip->name; fip++) {
+ if (fip->opt == NULL || !*fip->opt)
+ continue;
+
+ if (vb.used)
+ varbuf_add_char(&vb, ',');
+ varbuf_add_str(&vb, fip->name);
+ }
+ varbuf_end_str(&vb);
+
+ return varbuf_detach(&vb);
+}
+
static inline void
print_forceinfo_line(int type, const char *name, const char *desc)
{
@@ -260,6 +279,12 @@ set_force(const struct cmdinfo *cip, const char *value)
"WARNING - use of options marked [!] can seriously damage your installation.\n"
"Forcing options marked [*] are enabled by default.\n"));
m_output(stdout, _("<standard output>"));
+
+ printf(_(
+"\n"
+"Currently enabled options:\n"
+" %s\n"), get_force_string());
+
exit(0);
}
diff --git a/src/force.h b/src/force.h
index 2e9a84d9e..769163bd6 100644
--- a/src/force.h
+++ b/src/force.h
@@ -50,6 +50,8 @@ extern int fc_removereinstreq;
extern int fc_script_chrootless;
extern int fc_unsafe_io;
+char *
+get_force_string(void);
void
set_force(const struct cmdinfo *cip, const char *value);