[packages/adapter: 178/631] - options support

glen glen at pld-linux.org
Mon Sep 12 19:49:23 CEST 2016


commit ea91b16cf6c4d983160470a439c8ca24a18bbac3
Author: Elan Ruusamäe <glen at pld-linux.org>
Date:   Mon Aug 15 22:05:50 2005 +0000

    - options support
    
    Changed files:
        adapter.sh -> 1.9

 adapter.sh | 31 +++++++++++++++++++++++++++++--
 1 file changed, 29 insertions(+), 2 deletions(-)
---
diff --git a/adapter.sh b/adapter.sh
index 8dd7a3b..a42543e 100644
--- a/adapter.sh
+++ b/adapter.sh
@@ -1,8 +1,35 @@
 #!/bin/sh
 
+self=$(basename "$0")
+usage="Usage: $self [--sort[-br]|-s] filename"
+
+t=`getopt -o hs --long help,sort,sort-br -n "$self" -- "$@"` || exit $?
+eval set -- "$t"
+
+while true; do
+	case "$1" in
+	-h|--help)
+ 		echo 2>&1 "$usage"
+		exit 1
+	;;
+	--sort|--sort-br|-s)
+		export SORTBR=1
+	;;
+	--)
+		shift
+	   	break
+	;;
+	*)
+		echo 2>&1 "$self: Internal error: [$1] not recognized!"
+		exit 1
+	   	;;
+	esac
+	shift
+done
+
 if [ $# -ne 1 -o ! -f "$1" ]; then
-  echo "Usage: $0 filename"
-  exit 1
+	echo "$usage"
+	exit 1
 fi
 
 ./builder --adapter "$1"
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/adapter.git/commitdiff/6ca0126d4d0c8c79feb7db10b0a0fade0f3b8885



More information about the pld-cvs-commit mailing list