mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
cpictl: provide error for invalid options
cpictl tool supports options which start with - or -- alone. Getopt command verifies options which start with - or -- alone. When an option that does not start with - or -- is provided, the tool commits the changes and does not report error as shown below. $ ./cpictl abc Inside cpi_commit function Report error and do not commit for invalid options. Signed-off-by: Shalini Chellathurai Saroja <shalini@linux.ibm.com> Reviewed-by: Peter Oberparleiter <oberpar@linux.ibm.com> Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
This commit is contained in:
committed by
Steffen Eiden
parent
c746c5c267
commit
e8237e6ae0
@@ -39,6 +39,7 @@ readonly EXIT_SUCCESS=0
|
||||
readonly EXIT_FAILURE=1
|
||||
readonly EXIT_ARG_TOO_LONG=3
|
||||
readonly EXIT_INVALID_CHARS=4
|
||||
readonly EXIT_INVALID_ARGS=5
|
||||
|
||||
# Distro-IDs as supported by SE/HMC firmware
|
||||
readonly DISTRO_GENERIC=0
|
||||
@@ -490,6 +491,11 @@ while [ -n $1 ]; do
|
||||
esac
|
||||
done
|
||||
|
||||
# Unparsed options are not supported
|
||||
if [ $# -ne 0 ]; then
|
||||
fail_with "$PRG: Invalid command-line option: $*" $EXIT_INVALID_ARGS
|
||||
fi
|
||||
|
||||
# Print settings for --dry-run or commit them to sysfs otherwise
|
||||
|
||||
if [ $DRYRUN -eq 1 ]; then
|
||||
|
||||
Reference in New Issue
Block a user