summaryrefslogtreecommitdiff
path: root/scripts/build/debug/duma.in
diff options
context:
space:
mode:
authorYann E. MORIN" <yann.morin.1998@anciens.enib.fr>2008-06-30 20:37:14 (GMT)
committerYann E. MORIN" <yann.morin.1998@anciens.enib.fr>2008-06-30 20:37:14 (GMT)
commit08ca782e76bae04823eb7d52b8cff2adb664d33e (patch)
tree1e788385709b3674eee7613d020a3026cefbfdd8 /scripts/build/debug/duma.in
parent15483af16b822680b39053302a78c4c1b6f4016f (diff)
Newer, better, tsocks(1)-like wrapper script for D.U.M.A.
/trunk/scripts/build/debug/duma.in | 44 44 0 0 ++++++++++++++++++++++++++++++++++++++++ /trunk/scripts/build/debug/200-duma.sh | 12 3 9 0 +++-------- 2 files changed, 47 insertions(+), 9 deletions(-)
Diffstat (limited to 'scripts/build/debug/duma.in')
-rw-r--r--scripts/build/debug/duma.in44
1 files changed, 44 insertions, 0 deletions
diff --git a/scripts/build/debug/duma.in b/scripts/build/debug/duma.in
new file mode 100644
index 0000000..7871100
--- /dev/null
+++ b/scripts/build/debug/duma.in
@@ -0,0 +1,44 @@
+#!/bin/sh
+# (C) 2008 Yann E. MORIN <yann.morin.1998@anciens.enib.fr>
+# Licensed under the GPL v.2
+
+LIBDUMA_SO=
+
+case "$1" in
+ -on)
+ case "${LD_PRELOAD}" in
+ *${LIBDUMA_SO}*) ;;
+ *) LD_PRELOAD="${LIBDUMA_SO} ${LD_PRELOAD}";;
+ esac
+ shift
+ ;;
+ -off)
+ LD_PRELOAD="${LD_PRELOAD//${LIBDUMA_SO}/}"
+ shift
+ ;;
+ -show)
+ case "${LD_PRELOAD}" in
+ *${LIBDUMA_SO}*) echo "duma is enabled";;
+ *) echo "duma is disabled";;
+ esac
+ exit 0
+ ;;
+ "")
+ cat <<_EOF_
+Usage:
+ . $0 <-on|-off|-show>
+ Sets, unsets or show DUMA usage.
+ $0 <executable [arg...]>
+ Execute 'executable' (with arguments 'args') using DUMA.
+_EOF_
+ false # Don't 'exit', we could well be source'd
+ ;;
+ *)
+ exec "$0" -on "$@"
+ ;;
+esac
+
+export LD_PRELOAD
+if [ -n "$1" ]; then
+ exec "$@"
+fi