blob: 25fad0f674c0c6c28796d3192b7c071944b4c5a0 (
plain)
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
|
# Configures KScope parameters
# Checks that the given executable is indeed a Cscope-compatible application
# and determines which options it supports.
verifyCscope()
{
CSCOPE_EXE=`basename $CSCOPE_PATH`
if [ $DEBUG ]
then
echo -n Checking $CSCOPE_EXE version...
fi
# Get the executable's version
CSCOPE_VER_MAJOR=`$CSCOPE_PATH -V 2>&1 | grep -i $CSCOPE_EXE | sed -e "s/.*version \([1-9][0-9]*\)\.\([0-9]\).*/\1/"`
CSCOPE_VER_MINOR=`$CSCOPE_PATH -V 2>&1 | grep -i $CSCOPE_EXE | sed -e "s/.*version \([1-9][0-9]*\)\.\([0-9]\).*/\2/"`
if [ -n "$CSCOPE_VER_MAJOR" -a "$CSCOPE_VER_MINOR" ]
then
echo $CSCOPE_VER_MAJOR.$CSCOPE_VER_MINOR
if [ $DEBUG ]
then
echo -n Cscope support for line mode verbose output...
fi
# Check for verbose output
if [ "`$CSCOPE_PATH -h 2>&1 | grep "\-v"`" ]
then
CSCOPE_VERBOSE=Yes
else
CSCOPE_VERBOSE=No
fi
echo $CSCOPE_VERBOSE
if [ $DEBUG ]
then
echo -n Cscope support slow path definitions...
fi
# Check for slow-path definitions
if [ "`$CSCOPE_PATH -h 2>&1 | grep "\-D"`" ]
then
CSCOPE_SLOWPATH=Yes
else
CSCOPE_SLOWPATH=No
fi
echo $CSCOPE_SLOWPATH
else
echo ERROR
if [ $DEBUG ]
then
echo -e "\n *** ERROR *** The \"cscope\" executable does not appear to be a Cscope compatible programme"
fi
fi
}
DEBUG=0
CSCOPE_OPTIONS_ONLY=
# Parse command-line parameters
# Supported options:
# -d: Debug mode
# -co: Check Cscope options only
for opt in $@
do
case "$opt" in
"-d") DEBUG=1
;;
"-co") CSCOPE_OPTIONS_ONLY=1
;;
esac
done
if [ $DEBUG ]
then
echo -n Looking for cscope...
fi
if [ -z "$CSCOPE_PATH" ]
then
CSCOPE_PATH=`which cscope`
fi
if [ -n "$CSCOPE_PATH" -a -x "$CSCOPE_PATH" ]
then
echo $CSCOPE_PATH
verifyCscope
else
echo ERROR
if [ $DEBUG ]
then
echo -e "\n *** ERROR *** No Cscope executable found"
fi
fi
if [ -n "$CSCOPE_OPTIONS_ONLY" ]
then
exit
fi
if [ $DEBUG ]
then
echo -n Looking for Ctags...
fi
if [ -z "$CTAGS_PATH" ]
then
for CTAGS_NAME in exctags ctags-exuberant exuberant-ctags ctags
do
CTAGS_PATH=`which $CTAGS_NAME`
if [ -n "$CTAGS_PATH" -a -x "$CTAGS_PATH" ]
then
break
fi
done
fi
if [ -n "$CTAGS_PATH" ]
then
echo $CTAGS_PATH
# echo -n Checking for Exuberant-Ctags compatibility...
CTAGS_EXUB=`$CTAGS_PATH --help | grep -c "\-\-excmd=number"`
if [ $CTAGS_EXUB -gt 0 ]
then
CTAGS_EXUB_PATH=$CTAGS_PATH
echo Yes
else
echo ERROR
# echo -e "\n *** ERROR *** The \"ctags\" executable does not appear to be compatible with Exuberant Ctags"
fi
else
echo ERROR
# echo -e "\n *** ERROR *** No Ctags executable found"
fi
# echo -n Looking for Dot...
if [ -z "$DOT_PATH" ]
then
DOT_PATH=`which dot`
fi
if [ -n "$DOT_PATH" -a -x "$DOT_PATH" ]
then
echo $DOT_PATH
# echo -n Checking if dot handles the -Tplain option...
echo "digraph G {Hello->World}" | $DOT_PATH -Tplain 2>&1 /dev/null
if [ $? -eq 0 ]
then
echo Yes
else
echo ERROR
# echo -e "\n *** ERROR *** The \"dot\" executable does not support -Tplain"
fi
else
echo ERROR
# echo -e "\n *** ERROR *** No Dot executable found"
fi
|