summaryrefslogtreecommitdiff
path: root/support/scripts/stdlib.sh
diff options
context:
space:
mode:
Diffstat (limited to 'support/scripts/stdlib.sh')
-rw-r--r--support/scripts/stdlib.sh94
1 files changed, 0 insertions, 94 deletions
diff --git a/support/scripts/stdlib.sh b/support/scripts/stdlib.sh
deleted file mode 100644
index fed03dae2b..0000000000
--- a/support/scripts/stdlib.sh
+++ /dev/null
@@ -1,94 +0,0 @@
-########################################################-*-Shell-script-*-####
-# Bash Standard Library
-##############################################################################
-# $Id$
-
-function print() {
- while [ $# -gt 0 ]; do
- echo "$1";
- shift 1;
- done
-}
-
-function abort() {
- print "${program:-$0}: ""$@" 1>&2;
- exit 1;
-}
-
-function warning() {
- print "${program:-$0}: warning: ""$@" 1>&2;
-}
-
-function run_() {
- "$@" || exit $?;
-}
-
-function run() {
- [ "$verbose" = "true" ] && echo "$@";
- run_ "$@";
-}
-
-function runO() {
- local stdout="$1"; shift 1;
- [ "$verbose" = "true" ] && echo "$@" "1>" "$stdout";
- run_ "$@" 1> "$stdout";
-}
-
-function runOO() {
- local stdout="$1"; shift 1;
- [ "$verbose" = "true" ] && echo "$@" "1>>" "$stdout";
- run_ "$@" 1>> "$stdout";
-}
-
-##############################################################################
-
-# usage: args-loop <script> "$@"
-# process all arguments
-function args-loop() {
- while [ $# -gt 0 ]; do
- $program-args "$@";
- shift $?;
- done;
-}
-
-# usage: args-option-unknown "$@"
-# <option> ... => abort "unknown option <option>";
-function args-option-unknown() {
- abort "unknown option $1";
-}
-
-# usage: args-unknown "$@"
-# <argument> ... => abort "don't know what to do with argument <argument>";
-function args-unknown() {
- abort "don't know what to do with argument '$1'";
-}
-
-# usage: args-append-array <array> "$@"
-# <argument> ... => <array>[${#<array>[@]}]=<argument>; shift 1;
-function args-append-array() {
- local array="$1"; shift 1;
- eval "$array[\${#$array[@]}]=\"\$1\"";
- return 1;
-}
-
-# usage: args-option-value <value> "$@"
-# <option> <argument> ... => <value>=<argument>; shift 2;
-function args-option-value() {
- local value="$1"; shift 1;
- if [ $# -lt 2 ]; then
- abort "missing argument for option $1";
- fi;
- eval "$value=\"\$2\"";
- return 2;
-}
-
-# usage: args-inline-value <value> "$@"
-# <value-name>=<argument> ... => <value>=<argument>; shift 1;
-function args-inline-value() {
- local value="$1"; shift 1;
- local prefix="$value";
- eval "$value=\"\${1#--$prefix=}\"";
- return 1;
-}
-
-##############################################################################