4.4BSD/usr/src/contrib/gdb-4.7.lbl/gdb/createtags

#!/bin/sh
#
# Here we check to see if we are compiling in a directory that contains
# symlinks to the source files instead of the actual files.  If this is so, 
# we setup the TAGS entries to point to the actual source directory.
#
filelist=""
if test "`find main.c -type l -print `" != "" ; then
	prefix=`ls -l main.c | awk '{print $11}' | sed 's;main.c$;;'`
else
	prefix=""
fi

# Replace .o at end of filename with .c
for i in $@ ; do
	file=`echo $i-x- | sed -e 's/\.o-x-/\.c-x-/' | sed -e 's/-x-//'`
	filelist="$filelist $prefix$file"
done

etags $filelist