aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsrc/tools/make_ctags38
-rwxr-xr-xsrc/tools/make_etags8
2 files changed, 34 insertions, 12 deletions
diff --git a/src/tools/make_ctags b/src/tools/make_ctags
index 102881667b6..aa7d7b573f0 100755
--- a/src/tools/make_ctags
+++ b/src/tools/make_ctags
@@ -9,15 +9,19 @@ then echo $usage
exit 1
fi
-MODE=
+EMACS_MODE=
NO_SYMLINK=
+IS_EXUBERANT=
+PROG="ctags"
+TAGS_OPT="-a -f"
TAGS_FILE="tags"
+FLAGS=
+IGNORE_IDENTIFIES=
while [ $# -gt 0 ]
do
if [ $1 = "-e" ]
- then MODE="-e"
- TAGS_FILE="TAGS"
+ then EMACS_MODE="Y"
elif [ $1 = "-n" ]
then NO_SYMLINK="Y"
else
@@ -27,15 +31,24 @@ do
shift
done
-command -v ctags >/dev/null || \
+if [ ! "$EMACS_MODE" ]
+then (command -v ctags >/dev/null) || \
{ echo "'ctags' program not found" 1>&2; exit 1; }
+fi
-trap "ret=$?; rm -rf /tmp/$$; exit $ret" 0 1 2 3 15
-rm -f ./$TAGS_FILE
-
-IS_EXUBERANT=""
ctags --version 2>&1 | grep Exuberant && IS_EXUBERANT="Y"
+if [ "$EMACS_MODE" ]
+then TAGS_FILE="TAGS"
+ if [ "$IS_EXUBERANT" ]
+ then PROG="ctags -e"
+ else (command -v etags >/dev/null) || \
+ { echo "neither 'etags' nor exuberant 'ctags' program not found" 1>&2; exit 1; }
+ PROG="etags"
+ TAGS_OPT="-a -o"
+ fi
+fi
+
# List of kinds supported by Exuberant Ctags 5.8
# generated by ctags --list-kinds
# --c-kinds was called --c-types before 2003
@@ -56,20 +69,23 @@ ctags --version 2>&1 | grep Exuberant && IS_EXUBERANT="Y"
if [ "$IS_EXUBERANT" ]
then FLAGS="--c-kinds=+dfmstuv"
-else FLAGS="-dt"
+elif [ ! "$EMACS_MODE" ]
+then FLAGS="-dt"
fi
# Use -I option to ignore a macro
if [ "$IS_EXUBERANT" ]
then IGNORE_IDENTIFIES="-I pg_node_attr+"
-else IGNORE_IDENTIFIES=
fi
+trap "ret=$?; rm -rf /tmp/$$; exit $ret" 0 1 2 3 15
+rm -f ./$TAGS_FILE
+
# this is outputting the tags into the file 'tags', and appending
find `pwd`/ \( -name tmp_install -prune -o -name tmp_check -prune \) \
-o \( -name "*.[chly]" -o -iname "*makefile*" -o -name "*.mk" -o -name "*.in" \
-o -name "*.sql" -o -name "*.p[lm]" \) -type f -print |
- xargs ctags $MODE -a -f $TAGS_FILE "$FLAGS" "$IGNORE_IDENTIFIES"
+ xargs $PROG $TAGS_OPT $TAGS_FILE $FLAGS $IGNORE_IDENTIFIES
# Exuberant tags has a header that we cannot sort in with the other entries
# so we skip the sort step
diff --git a/src/tools/make_etags b/src/tools/make_etags
index afc57e3e892..7e51bb4c4e2 100755
--- a/src/tools/make_etags
+++ b/src/tools/make_etags
@@ -1,5 +1,11 @@
#!/bin/sh
-# src/tools/make_etags
+
+# src/tools/make_etags [-n]
+
+if [ $# -gt 1 ] || ( [ $# -eq 1 ] && [ $1 != "-n" ] )
+then echo "Usage: $0 [-n]"
+ exit 1
+fi
cdir=`dirname $0`
dir=`(cd $cdir && pwd)`