3 # Try to find a GNU indent. There could be a BSD indent in front of a
4 # GNU gindent so when indent is found, keep looking.
6 # Make certain that the script is not running in an internationalized
9 LC_ALL
=c
; export LC_ALL
13 paths
=`echo $PATH | sed \
20 if test ! -n "${gindent}" -a -x ${path}/gindent
22 gindent
=${path}/gindent
24 elif test ! -n "${indent}" -a -x ${path}/indent
30 if test -n "${gindent}"
33 elif test -n "${indent}"
37 echo "Indent not found" 1>&2
41 # Check that the indent found is both GNU and a reasonable version.
42 # Different indent versions give different indentation.
48 version
=`${indent} --version 2>/dev/null < /dev/null`
51 * ) echo "error: GNU indent $m1.$m2.$m3 expected" 1>&2 ; exit 1;;
53 v1
=`echo "${version}" | sed 's/^.* \([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)$/\1/'`
54 v2
=`echo "${version}" | sed 's/^.* \([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)$/\2/'`
55 v3
=`echo "${version}" | sed 's/^.* \([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)$/\3/'`
57 if test $m1 -ne $v1 -o $m2 -ne $v2 -o $m3 -gt $v3
59 echo "error: Must be GNU indent version $m1.$m2.$m3 or later" 1>&2
65 echo "warning: GNU indent version $m1.$m2.$m3 recommended" 1>&2
68 # Check that we're in the GDB source directory
73 * ) echo "Not in GDB directory" 1>&2 ; exit 1 ;;
77 # Run indent per GDB specs
81 -T bfd -T asection -T pid_t \
82 -T prgregset_t -T fpregset_t -T gregset_t -T sigset_t \
83 -T td_thrhandle_t -T td_event_msg_t -T td_thr_events_t \
84 -T td_notify_t -T td_thr_iter_f -T td_thrinfo_t \
87 -e 's/^.*[^a-z0-9_]\([a-z0-9_]*_ftype\).*$/-T \1/p' \
88 -e 's/^.*[^a-z0-9_]\([a-z0-9_]*_func\).*$/-T \1/p' \
89 -e 's/^typedef.*[^a-zA-Z0-9_]\([a-zA-Z0-9_]*[a-zA-Z0-9_]\);$/-T \1/p' \
92 ${indent} ${types} "$@"