From 7323d3b99c25003014fee1241858445f0c61aeb5 Mon Sep 17 00:00:00 2001 From: Lucas Schnorr Date: Thu, 28 Apr 2011 10:16:19 +0200 Subject: [PATCH] create an usage function to smpirun, check if at least one parameter is passed --- src/smpi/smpirun.in | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/src/smpi/smpirun.in b/src/smpi/smpirun.in index 51fc1751ee..07c97f77c9 100755 --- a/src/smpi/smpirun.in +++ b/src/smpi/smpirun.in @@ -18,6 +18,24 @@ POWER="${DEFAULT_POWER}" SIMOPTS="--cfg=maxmin/precision:1e-9 --cfg=network/model:SMPI --cfg=TCP_gamma:4194304" + +#usage to print the way this script should be called +function usage () { + echo "usage:" + echo "$0 [-quiet] [-keep-temps] [-trace ] [-np ] -platform -hostfile [-map] program [program-options]" + echo "or (deprecated usage):" + echo "$0 [-quiet] [-keep-temps] [-np ] [-bandwidth ] [-latency ] program [program-options]" + echo +} + +#check if we have at least one parameter +if [ $# -eq 0 ] +then + usage + exit +fi + + while true; do case "$1" in "-np" | "-n") @@ -75,11 +93,7 @@ while true; do ;; "-help" | "--help" | "-h") - echo "usage:" - echo "$0 [-quiet] [-keep-temps] [-trace ] [-np ] -platform -hostfile [-map] program [program-options]" - echo "or (deprecated usage):" - echo "$0 [-quiet] [-keep-temps] [-np ] [-bandwidth ] [-latency ] program [program-options]" - echo + usage exit ;; -- 2.20.1