Ethereal-dev: [ethereal-dev] make-ett-doth - if you want to use it, here's a working one

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Nathan Neulinger <nneul@xxxxxxx>
Date: Fri, 29 Oct 1999 12:23:18 -0500
This generates the enum for all the ETT_ constants similar to the way 
make-reg-dotc works.

I haven't included a patch, as that should be straightforward to write, 
packet.h would need to include ett.h.

-- Nathan

------------------------------------------------------------
Nathan Neulinger                       EMail:  nneul@xxxxxxx
University of Missouri - Rolla         Phone: (573) 341-4841
Computing Services                       Fax: (573) 341-4216
#! /bin/sh

#
# The first argument is the directory in which the source files live.
#
srcdir="$1"
shift

#
# All subsequent arguments are the files to scan.
#
rm -f ett.h-tmp
echo '/* Do not modify this file.  */' >ett.h-tmp
echo '/* It is created automatically by the Makefile.  */'>>ett.h-tmp
echo 'enum {' >>ett.h-tmp
echo '    ETT_NONE,' >>ett.h-tmp

for f in "$@"
do
	grep 'ETT_[a-z_0-9A-Z][a-z_0-9A-Z]*' $srcdir/$f 2>/dev/null
done | sed -e 's/^.*://' -e 's/.*\(ETT_[a-z_0-9A-Z][a-z_0-9A-Z]*\).*/    \1,/' \
	| sort | uniq >> ett.h-tmp

echo '    NUM_TREE_TYPES  /* last item number plus one */' >>ett.h-tmp
echo '};' >>ett.h-tmp
mv ett.h-tmp ett.h