* gdb.base/corefile.exp: Recognize the message saying that GDB
[deliverable/binutils-gdb.git] / gdb / gdb_indent.sh
1 #!/bin/sh
2
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.
5
6 gindent=
7 indent=
8 paths=`echo $PATH | sed \
9 -e 's/::/:.:/g' \
10 -e 's/^:/.:/' \
11 -e 's/:$/:./' \
12 -e 's/:/ /g'`
13 for path in $paths
14 do
15 if test ! -n "${gindent}" -a -x ${path}/gindent
16 then
17 gindent=${path}/gindent
18 break
19 elif test ! -n "${indent}" -a -x ${path}/indent
20 then
21 indent=${path}/indent
22 fi
23 done
24
25 if test -n "${gindent}"
26 then
27 indent=${gindent}
28 elif test -n "${indent}"
29 then
30 :
31 else
32 echo "Indent not found" 1>&2
33 fi
34
35
36 # Check that the indent found is both GNU and a reasonable version.
37 # Different indent versions give different indentation.
38
39 case `${indent} --version 2>/dev/null < /dev/null` in
40 GNU*2.2.6 ) ;;
41 *GNU* ) echo "Incorrect version of GNU indent" 1>&2 ;;
42 * ) echo "Indent is not GNU" 1>&2 ;;
43 esac
44
45
46 # Check that we're in the GDB source directory
47
48 case `pwd` in
49 */gdb ) ;;
50 * ) echo "Not in GDB directory" 1>&2 ; exit 1 ;;
51 esac
52
53
54 # Run indent per GDB specs
55
56 types="-T FILE `cat *.h | sed -n \
57 -e 's/^.*[^a-z0-9_]\([a-z0-9_]*_ftype\).*$/-T \1/p' \
58 -e 's/^.*[^a-z0-9_]\([a-z0-9_]*_func\).*$/-T \1/p' \
59 -e 's/^typedef.*[^a-zA-Z0-9_]\([a-zA-Z0-9_]*[a-zA-Z0-9_]\);$/-T \1/p' \
60 | sort -u`"
61
62 ${indent} ${types} "$@"
This page took 0.031772 seconds and 4 git commands to generate.