summaryrefslogtreecommitdiffstats
path: root/slapd-supann
blob: 0ecf360e2b6e42190768d90e831ecf0dfdeb66be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/sh

ME=`basename $0`
COMMANDDIR=`dirname $0`/lib
test -d ${COMMANDDIR} || COMMANDDIR=/usr/lib/`basename $0`

help() {
	msg="$1"
	test -n "$msg" && echo $msg
	echo "syntaxe: $ME commande ..."
	echo ""
	echo "commandes disponibles:"
		echo "	help		cette aide"
	for fcom in $COMMANDDIR/*.help
	do
		com=`basename $fcom .help`
		descr=`head -1 $fcom`
		echo "	"$com"		"$descr
	done
	test -n "$msg" && exit 1
	exit 0
}

helpcmd() {
	command=$1
	xcommand=$COMMANDDIR/$command
	test -x $xcommand || help "ERR: commande inconnue ($command)"
	echo "$ME $command"
	cat $xcommand.help
}

command=$1
test -z $command && help "ERR: commande manquante"
shift

case $command in
	help)
		test -z "$1" && help
		helpcmd $1
		;;
	*)
		xcommand=$COMMANDDIR/$command
		test -x $xcommand || help "ERR: commande inconnue ($command)"
		$xcommand "$@"
		;;
esac