summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2013-05-26 23:10:37 -0400
committerLuke Shumaker <LukeShu@sbcglobal.net>2013-05-26 23:10:37 -0400
commitf6ccc7caa1d80c7a2fcc6486f872d54468d265dc (patch)
tree1643198b3a582e3cea2a0441cb3c4104ccec4c6a /src
parentca6db7290cacee0d3b5ba836e6acea76ea314e50 (diff)
librelib: fix usage()
Diffstat (limited to 'src')
-rwxr-xr-xsrc/librelib12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/librelib b/src/librelib
index 22811db..3b12c93 100755
--- a/src/librelib
+++ b/src/librelib
@@ -16,14 +16,20 @@
default_libdir=/usr/lib/libretools
+print() {
+ fmt=$1; shift
+ printf -- "$fmt\n" "$@"
+}
+
cmd=${0##*/}
usage() {
+ . libremessages
print 'Usage: . $(%s LIBRARY)' "$cmd"
print "Finds a shell library file"
echo
print "While some libraries can be sourced just by their name because"
print "they are installed in PATH (like libremessages), some are not"
- print "installed there (like conf.sh), so path must be given."
+ print "installed there (like conf.sh), so a path must be given."
print "Hardcoding that path is the way of the dark side."
echo
print "By default, it looks for the files in '%s'," "$default_libdir"
@@ -39,6 +45,10 @@ main() {
usage >&2
return 2
fi
+ if [[ $1 == '-h' ]]; then
+ usage
+ return 0;
+ fi
if [[ -z $LIBRETOOLS_LIBDIR ]]; then
export LIBRETOOLS_LIBDIR=$default_libdir