cairo/util/cairo-trace/cairo-trace.in

66 lines
1.3 KiB
Text
Raw Normal View History

#!/bin/sh
prefix=@prefix@
exec_prefix=@exec_prefix@
nofile=
silent=
skip=1
while test $skip -eq 1; do
skip=0
case $1 in
--silent)
skip=1
silent=1
;;
--no-file)
skip=1
nofile=1
;;
esac
if test $skip -eq 1; then
shift
fi
done
if test $# -eq 0; then
cat << EOF
usage: cairo-trace [--no-file|--silent] command
cairo-trace will generate a log of all calls made by command to
cairo. This log will be stored in a file in the local directory
called command.pid.trace.
Whatever else happens is driven by its argument:
--silent - disables the overriding of stdout by cairo-trace.
The trace file is still generated, but your application
is free to continue to use stdout.
--no-file - disables the generation of an output file
Enviroment variables understood by cairo-trace:
CAIRO_TRACE_FLUSH - flush the output after every function call.
EOF
exit
fi
#echo $*
filename=""
if test -z "$nofile"; then
filename=`basename $1`.$$.trace
fi
LD_PRELOAD=@libdir@/cairo/cairo-trace.so
export LD_PRELOAD
# Force the decimal output to the 'C' locale
LC_ALL=C
export LC_ALL
if test -z "$filename"; then
CAIRO_TRACE_FD=3 $* 3>&1 >/dev/null
elif test -n "$silent"; then
CAIRO_TRACE_OUTFILE_EXACT=$filename $*
else
CAIRO_TRACE_FD=3 $* 3>&1 >/dev/null | tee $filename
fi