]>
Commit | Line | Data |
---|---|---|
b6fa4447 BP |
1 | #! /bin/sh |
2 | ||
3 | wrap_program=`basename '@wrap_program@'` | |
4 | ||
5 | # Strip the first directory from $PATH that contains $wrap_program, | |
6 | # so that below we run the real $wrap_program, not ourselves. | |
7 | not_found=true | |
8 | new_path= | |
9 | first=true | |
10 | save_IFS=$IFS | |
11 | IFS=: | |
12 | for dir in $PATH; do | |
13 | IFS=$save_IFS | |
14 | if $not_found && test -x "$dir/$wrap_program"; then | |
15 | not_found=false | |
16 | else | |
17 | if $first; then | |
18 | first=false | |
19 | new_path=$dir | |
20 | else | |
21 | new_path=$new_path:$dir | |
22 | fi | |
23 | fi | |
24 | done | |
25 | IFS=$save_IFS | |
26 | if $not_found; then | |
27 | echo "$0: error: cannot find $wrap_program in \$PATH" >&2 | |
28 | exit 1 | |
29 | fi | |
30 | PATH=$new_path | |
31 | export PATH | |
32 | ||
33 | : ${VALGRIND:=valgrind -q --log-file=valgrind.%p --leak-check=full} | |
34 | exec $VALGRIND $wrap_program "$@" | |
35 | echo "$0: failed to execute $VALGRIND $wrap_program" "$@" >&2 | |
36 | exit 1 |