From bedd871dd4e55958263adb2a985a7a0e61afebe4 Mon Sep 17 00:00:00 2001 From: Jan Kupec Date: Fri, 16 Nov 2007 18:21:04 +0000 Subject: [PATCH] - unused code removed - report 'too few arguments' for install/remove if none specified --- src/zypper.cc | 34 ++++++++++++++-------------------- src/zypper.h | 2 -- 2 files changed, 14 insertions(+), 22 deletions(-) diff --git a/src/zypper.cc b/src/zypper.cc index 55e5dcf..d9d53f5 100644 --- a/src/zypper.cc +++ b/src/zypper.cc @@ -1121,30 +1121,24 @@ int one_command(int argc, char **argv) else if (command == ZypperCommand::INSTALL || command == ZypperCommand::REMOVE) { - if (command == ZypperCommand::INSTALL) { - if (ghelp || arguments.size() < 1) { - cerr << specific_help; - return !ghelp; - } - - gData.packages_to_install = arguments; - - if (copts.count("auto-agree-with-licenses") - || copts.count("agree-to-third-party-licenses")) - gSettings.license_auto_agree = true; + if (ghelp) + { + cout << specific_help; + return ZYPPER_EXIT_OK; } - - - if (command == ZypperCommand::REMOVE) { - if (ghelp || arguments.size() < 1) { - cerr << specific_help; - return !ghelp; - } - - gData.packages_to_uninstall = arguments; + if (arguments.size() < 1) + { + cerr << _("Too few arguments."); + cerr << " " << _("At least one package name is required.") << endl << endl; + cerr << specific_help; + return ZYPPER_EXIT_ERR_INVALID_ARGS; } + if (copts.count("auto-agree-with-licenses") + || copts.count("agree-to-third-party-licenses")) + gSettings.license_auto_agree = true; + // check root user if (geteuid() != 0) { diff --git a/src/zypper.h b/src/zypper.h index b3e334c..393297d 100644 --- a/src/zypper.h +++ b/src/zypper.h @@ -61,8 +61,6 @@ struct RuntimeData std::list repos; int patches_count; int security_patches_count; - std::vector packages_to_install; - std::vector packages_to_uninstall; zypp::ResStore repo_resolvables; zypp::ResStore target_resolvables; zypp::RepoInfo current_repo; -- 2.7.4