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.
8 paths=`echo $PATH | sed \
15 if test ! -n "${gindent}" -a -x ${path}/gindent
17 gindent=${path}/gindent
19 elif test ! -n "${indent}" -a -x ${path}/indent
25 if test -n "${gindent}"
28 elif test -n "${indent}"
32 echo "Indent not found" 1>&2
36 # Check that the indent found is both GNU and a reasonable version.
37 # Different indent versions give different indentation.
43 version=`${indent} --version 2>/dev/null < /dev/null`
46 * ) echo "error: GNU indent $m1.$m2.$m3 expected" 1>&2 ; exit 1;;
48 v1=`echo "${version}" | sed 's/^.* \([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)$/\1/'`
49 v2=`echo "${version}" | sed 's/^.* \([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)$/\2/'`
50 v3=`echo "${version}" | sed 's/^.* \([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)$/\3/'`
52 if test $m1 -ne $v1 -o $m2 -ne $v2 -o $m3 -gt $v3
54 echo "error: Must be GNU indent version $m1.$m2.$m3 or later" 1>&2
60 echo "warning: GNU indent version $m1.$m2.$m3 recommended" 1>&2
63 # Check that we're in the GDB source directory
68 * ) echo "Not in GDB directory" 1>&2 ; exit 1 ;;
72 # Run indent per GDB specs
76 -T bfd -T asection -T pid_t \
77 -T prgregset_t -T fpregset_t -T gregset_t -T sigset_t \
79 -e 's/^.*[^a-z0-9_]\([a-z0-9_]*_ftype\).*$/-T \1/p' \
80 -e 's/^.*[^a-z0-9_]\([a-z0-9_]*_func\).*$/-T \1/p' \
81 -e 's/^typedef.*[^a-zA-Z0-9_]\([a-zA-Z0-9_]*[a-zA-Z0-9_]\);$/-T \1/p' \
84 ${indent} ${types} "$@"