diff options
author | Guillem Jover <guillem@debian.org> | 2019-02-23 04:47:25 +0100 |
---|---|---|
committer | Guillem Jover <guillem@debian.org> | 2019-02-23 15:27:01 +0100 |
commit | 56ae35c4312c056811239ebe1e90ad565b6fbe48 (patch) | |
tree | 510a1155a82ba33d2593e164f915058205044d86 /src/force.h | |
parent | e566532b04c4d263001f798b4cea3488be00400c (diff) | |
download | dpkg-56ae35c4312c056811239ebe1e90ad565b6fbe48.tar.gz |
dpkg: Switch force options from individual variables to bit fields
This makes it easier to generalize to be used by other modules with
different force options, and to operate on the force options.
Diffstat (limited to 'src/force.h')
-rw-r--r-- | src/force.h | 66 |
1 files changed, 41 insertions, 25 deletions
diff --git a/src/force.h b/src/force.h index 769163bd6..28776eefc 100644 --- a/src/force.h +++ b/src/force.h @@ -25,35 +25,51 @@ #include <dpkg/dpkg.h> #include <dpkg/options.h> -extern int fc_architecture; -extern int fc_badpath; -extern int fc_badverify; -extern int fc_badversion; -extern int fc_breaks; -extern int fc_conff_ask; -extern int fc_conff_def; -extern int fc_conff_miss; -extern int fc_conff_new; -extern int fc_conff_old; -extern int fc_configureany; -extern int fc_conflicts; -extern int fc_depends; -extern int fc_dependsversion; -extern int fc_downgrade; -extern int fc_hold; -extern int fc_nonroot; -extern int fc_overwrite; -extern int fc_overwritedir; -extern int fc_overwritediverted; -extern int fc_removeessential; -extern int fc_removereinstreq; -extern int fc_script_chrootless; -extern int fc_unsafe_io; +enum force_flags { + FORCE_ARCHITECTURE = DPKG_BIT(0), + FORCE_BAD_PATH = DPKG_BIT(1), + FORCE_BAD_VERIFY = DPKG_BIT(2), + FORCE_BAD_VERSION = DPKG_BIT(3), + FORCE_BREAKS = DPKG_BIT(4), + FORCE_CONFF_ASK = DPKG_BIT(5), + FORCE_CONFF_DEF = DPKG_BIT(6), + FORCE_CONFF_MISS = DPKG_BIT(7), + FORCE_CONFF_NEW = DPKG_BIT(8), + FORCE_CONFF_OLD = DPKG_BIT(9), + FORCE_CONFIGURE_ANY = DPKG_BIT(10), + FORCE_CONFLICTS = DPKG_BIT(11), + FORCE_DEPENDS = DPKG_BIT(12), + FORCE_DEPENDS_VERSION = DPKG_BIT(13), + FORCE_DOWNGRADE = DPKG_BIT(14), + FORCE_HOLD = DPKG_BIT(15), + FORCE_NON_ROOT = DPKG_BIT(16), + FORCE_OVERWRITE = DPKG_BIT(17), + FORCE_OVERWRITE_DIR = DPKG_BIT(18), + FORCE_OVERWRITE_DIVERTED = DPKG_BIT(19), + FORCE_REMOVE_ESSENTIAL = DPKG_BIT(20), + FORCE_REMOVE_REINSTREQ = DPKG_BIT(21), + FORCE_SCRIPT_CHROOTLESS = DPKG_BIT(22), + FORCE_UNSAFE_IO = DPKG_BIT(23), + FORCE_ALL = 0xffffffff, +}; + +bool +in_force(int flags); +void +set_force(int flags); +void +reset_force(int flags); char * get_force_string(void); + +void +parse_force(const char *value, bool set); + +void +set_force_option(const struct cmdinfo *cip, const char *value); void -set_force(const struct cmdinfo *cip, const char *value); +reset_force_option(const struct cmdinfo *cip, const char *value); void forcibleerr(int forceflag, const char *format, ...) DPKG_ATTR_PRINTF(2); |