[Stgt-devel] [PATCH 2/4] iscsi: Add usage information to tgt-setup-lun

Erez Zilber erezz
Sun Jan 20 13:54:07 CET 2008


If the script is ran without parameters or with -h, the usage
message is printed.

Signed-off-by: Erez Zilber <erezz at voltaire.com>
---
 scripts/tgt-setup-lun |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/scripts/tgt-setup-lun b/scripts/tgt-setup-lun
index 824c7d3..53bb934 100755
--- a/scripts/tgt-setup-lun
+++ b/scripts/tgt-setup-lun
@@ -129,14 +129,19 @@ check_if_tgt_exists()
 	return 0
 }
 
-while getopts "d:n:" opt
+if [ $# -eq 0 ]; then
+	usage
+	exit 1
+fi
+
+while getopts "d:n:h" opt
 do
 	case ${opt} in
 	d)
 		dev=$OPTARG;;
 	n)
 		tgt_name=$OPTARG;;
-	*)
+	h*)
 		usage
 		exit 1
 	esac
-- 
1.5.3





More information about the stgt mailing list