#!/bin/sh # # This is a shell archive. To extract its contents, # execute this file with /bin/sh to create the file(s): # # 4gltags # # This shell archive created: Mon Mar 9 10:54:05 EST 1992 # echo "Extracting file 4gltags" sed -e 's/^X//' <<\SHAR_EOF > 4gltags X: X# 4gltags - written by Stu Heiss - 02/22/91 Xtmp=/tmp/$$tags Xtrap 'rm -f $tmp;exit' 0 1 2 3 15 Xusage() { echo "usage: $0 [-au] file ..."; exit 1; } Xuflag=false Xaflag=false Xset -- `getopt ua $*` || usage Xfor i Xdo X case "$i" in X -a) aflag=true;shift;; X -u) uflag=true;shift;; X --) shift;break;; X esac Xdone Xtest $# -lt 1 && usage Xfiles="$@" Xnawk ' X/end[ ]*function/ { X next X} X/function/ { X save=$0 X sub(/#.*$/,"") # strip trailing comments X if ((i=index($0,"function"))==0) next X s=substr($0,i+8) X i=index(s,"(") # must be followed by open paren X if(i==0) next X token=substr(s,1,i-1) # function name X sub(/^[ ]/,"",token) # strip leading/trailing blanks X sub(/[ ]$/,"",token) X line="" X while((i = index(save,"\\"))>0) { X line = line substr(save,1,i-1) "\\\\" X save = substr(save,i+1) X } X if (tokens[token]) { X if (tokens[token] == FILENAME) Xprintf("Duplicate function in file %s, line %d: %s\nSecond entry ignored\n", X FILENAME, FNR, token) | "cat >&2" X else Xprintf("Duplicate function in files %s and %s: %s (Warning only)\n", X FILENAME, tokens[token], token) | "cat >&2" X continue X } X tokens[token] = FILENAME X printf("%s\t%s\t/^%s%s$/\n", token, FILENAME, line, save) X next X} X{ X next X} X' $files > $tmp X X$uflag && { X for file in $files X do X mv tags OTAGS X fgrep -v " ${file} " OTAGS > tags X rm OTAGS X done X aflag=true X} Xif $aflag;then X cat $tmp >> tags Xelse X cat $tmp > tags Xfi SHAR_EOF if [ `wc -c < 4gltags` -ne 1400 ] then echo "Lengths do not match -- Bad Copy of 4gltags" fi echo "Done."