Ethereal-dev: [Ethereal-dev] a script for updating the 'manuf' file.

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

From: Marc Esipovich <marc@xxxxxxxxx>
Date: Sun, 16 Sep 2001 15:47:58 +0300
 Hi,

	The attached script helps keeping the 'manuf' file up to date
by fetching the most updated version from IEEE.ORG and formatting
it to fit Ethereal's format. the current manuf file from Ethereal
0.8.19 has 4739 entries while the one on IEEE's website has 5241.

	bye,
		Marc.

-- 
marc @ corky.net

fingerprint = D1F0 5689 967F B87A 98EB  C64D 256A D6BF 80DE 6D3C

          /"\
          \ /     ASCII Ribbon Campaign
           X      Against HTML Mail
          / \
#!/bin/csh -f
#
# Script by marc at corky dot dot dot net.
#

set orig_manuf = oui.txt
set new_manuf = oui.new.txt
set output = manuf
set URL = http://standards.ieee.org/regauth/oui

# --------------------------------------------------------------------------

echo -n "Trying to download updated file..."

/bin/rm -f $output $new_manuf

lynx -dump $URL/$orig_manuf >$new_manuf

if ( $status ) then
	set lynx_failed = 1
	set wget_failed = 0

	echo -n "\nFailed to obtain an updated $orig_manuf file via lynx, trying wget..."

	wget $URL/$orig_manuf -O $new_manuf -o /dev/null

	if ( $status ) then
			set wget_failed = 1

			echo "failed."
	else
		echo "done."
	endif

	if ( $lynx_failed && $wget_failed) then
		exit
	endif
else
	echo "done."
endif

if ( -e $orig_manuf ) then
	echo -n "Previous file exists, checking for differences, "

	diff -q $orig_manuf $new_manuf
	if ( $status ) then
		echo "change detected, processing."
	else
		echo "none found."
		exit
	endif
else
	echo -n "Didn't have previous file to compare with, processing new..."
endif

/bin/cp $new_manuf $orig_manuf

# Err, how to printf this more cleanly ?
cat $new_manuf | egrep "^..-..-.." | sed -e 's/-/:/1;s/-/:/1' |\
	awk '{printf ( "%s\t%s %s %s %s %s %s %s\n", $1, $3, $4, $5, $6, $7, $8, $9)}' >$output

if ( $status ) then
	echo "formatting somehow failed!"
else
	echo "done!"
endif