-
Notifications
You must be signed in to change notification settings - Fork 11
/
writeWav
executable file
·41 lines (34 loc) · 923 Bytes
/
writeWav
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
#!/bin/bash
if [ -z "$1" ]; then
echo "No program specified."
echo "Usage: writeWav [program] [arguments]"
exit 1
fi
LIBNAME=writeWav.so
if LC_MESSAGE=C LD_PRELOAD="$LIBNAME" /bin/true 2>&1 | grep -qFe ignored; then
tryLib() {
if [ -z "$LIB" ]; then
#echo "Trying LIB $1"
if [ -e "$1" ]; then
#echo "Setting LIB to $1"
LIB="$1"
fi
fi
}
tryLib "/usr/local/lib/$LIBNAME"
tryLib "/usr/lib/$LIBNAME"
tryLib "./$LIBNAME"
if [ -z "$LIB" ]; then
echo "$LIBNAME not found. Specify LIB environment variable to force $LIBNAME location" >&2
exit 1
fi
else
#echo "$LIBNAME is already available for preload"
LIB="$LIBNAME"
fi
if [ -z "$LD_PRELOAD" ]; then
LD_PRELOAD="$LIB"
else
LD_PRELOAD="$LIB:$LD_PRELOAD"
fi
LD_PRELOAD="$LD_PRELOAD" writeWav_out=`date +"%s.wav"` "$@"