git » libfiu » commit 17fdac5

utils/fiu-ctrl: Emit a warning on deprecated options

author Alberto Bertogli
2012-10-15 21:52:32 UTC
committer Alberto Bertogli
2012-10-15 21:52:32 UTC
parent e5013562e2288992162f86a4f78b3145d2119c7f

utils/fiu-ctrl: Emit a warning on deprecated options

This patch makes fiu-ctrl emit a warning when one of the deprecated options
are used, and also fixes the omission of one of them in the help text.

Thanks to Serafeim Zanikolas for the bug report.

Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>

utils/fiu-ctrl +10 -1

diff --git a/utils/fiu-ctrl b/utils/fiu-ctrl
index 140bb37..709a70e 100755
--- a/utils/fiu-ctrl
+++ b/utils/fiu-ctrl
@@ -40,7 +40,7 @@ All of the enable\* can also optionally take 'failnum' and 'failinfo'
 parameters, analogous to the ones taken by the C functions.
 
 The following options existed in the past but are deprecated and WILL BE
-REMOVED in future releases: -e, -p, -u and -i.
+REMOVED in future releases: -e, -p, -u, -i, and -d.
 
 
 Examples:
@@ -94,6 +94,10 @@ function add_deprecated_enable() {
 	CMDS[${#CMDS[*]}]="$C"
 }
 
+function deprecated_warning() {
+	echo "Warning: this option is deprecated and will be removed." >&2
+}
+
 opts_reset;
 while getopts "+c:e:p:u:i:d:f:h" opt; do
 	case $opt in
@@ -102,23 +106,28 @@ while getopts "+c:e:p:u:i:d:f:h" opt; do
 		;;
 	e)
 		# add the current one, if any
+		deprecated_warning;
 		add_deprecated_enable;
 		opts_reset;
 		DEP_NAME="$OPTARG"
 		;;
 	p)
+		deprecated_warning;
 		DEP_PROB="$OPTARG"
 		;;
 	u)
+		deprecated_warning;
 		DEP_FAILNUM="$OPTARG"
 		;;
 	i)
+		deprecated_warning;
 		DEP_FAILINFO="$OPTARG"
 		;;
 	f)
 		FIFO_PREFIX="$OPTARG"
 		;;
 	d)
+		deprecated_warning;
 		CMDS[${#CMDS[*]}]="disable name=$OPTARG"
 		opts_reset;
 		;;