diff options
author | Guillem Jover <guillem@debian.org> | 2015-03-12 23:53:30 +0100 |
---|---|---|
committer | Guillem Jover <guillem@debian.org> | 2015-04-21 07:12:27 +0200 |
commit | 3a5e0d6cd99c92cfe7c22fb33c636bf15bcf4728 (patch) | |
tree | de6b8df152e79c15083e06a181b3a20a4c943aa5 | |
parent | 6d987d5647075275f7261e1b7f9c7d157cfc40fb (diff) | |
download | dpkg-3a5e0d6cd99c92cfe7c22fb33c636bf15bcf4728.tar.gz |
dpkg: Use badusage() instead of ohshit() for command-line errors
-rw-r--r-- | debian/changelog | 1 | ||||
-rw-r--r-- | dpkg-deb/main.c | 4 | ||||
-rw-r--r-- | src/trigcmd.c | 8 |
3 files changed, 7 insertions, 6 deletions
diff --git a/debian/changelog b/debian/changelog index ffeb8a8a4..7a51dbf62 100644 --- a/debian/changelog +++ b/debian/changelog @@ -51,6 +51,7 @@ dpkg (1.18.0) UNRELEASED; urgency=low * Make dependency checks fatal for dpkg-buildpackage -S. * Update amd64 GNU cpu regex in cputable to match amd64 too, in addition to x86_64. This is required for FreeBSD. + * Use badusage() instead of ohshit() for command-line errors. * Perl modules: - Rename and deprecate Dpkg::Gettext _g function with new g_. diff --git a/dpkg-deb/main.c b/dpkg-deb/main.c index 686e82f42..eb5b295cd 100644 --- a/dpkg-deb/main.c +++ b/dpkg-deb/main.c @@ -204,7 +204,7 @@ set_compress_strategy(const struct cmdinfo *cip, const char *value) { compress_params.strategy = compressor_get_strategy(value); if (compress_params.strategy == COMPRESSOR_STRATEGY_UNKNOWN) - ohshit(_("unknown compression strategy '%s'!"), value); + badusage(_("unknown compression strategy '%s'!"), value); } static void @@ -212,7 +212,7 @@ set_compress_type(const struct cmdinfo *cip, const char *value) { compress_params.type = compressor_find_by_name(value); if (compress_params.type == COMPRESSOR_TYPE_UNKNOWN) - ohshit(_("unknown compression type '%s'!"), value); + badusage(_("unknown compression type '%s'!"), value); if (compress_params.type == COMPRESSOR_TYPE_LZMA) warning(_("deprecated compression type '%s'; use xz instead"), value); if (compress_params.type == COMPRESSOR_TYPE_BZIP2) diff --git a/src/trigcmd.c b/src/trigcmd.c index 01b6688a6..4309cb964 100644 --- a/src/trigcmd.c +++ b/src/trigcmd.c @@ -120,8 +120,8 @@ parse_awaiter_package(void) pkgname = getenv("DPKG_MAINTSCRIPT_PACKAGE"); archname = getenv("DPKG_MAINTSCRIPT_ARCH"); if (pkgname == NULL || archname == NULL) - ohshit(_("must be called from a maintainer script" - " (or with a --by-package option)")); + badusage(_("must be called from a maintainer script" + " (or with a --by-package option)")); pkg = pkg_spec_find_pkg(pkgname, archname, &err); } else if (strcmp(bypackage, "-") == 0) { @@ -226,8 +226,8 @@ main(int argc, const char *const *argv) badname = parse_awaiter_package(); if (badname) - ohshit(_("illegal awaited package name '%.250s': %.250s"), - bypackage, badname); + badusage(_("illegal awaited package name '%.250s': %.250s"), + bypackage, badname); activate = argv[0]; badname = trig_name_is_illegal(activate); |