#!/bin/csh -f
#
# Renumbers the PLED values in prom_leds.h

echo ""
echo "**** Renumber LEDs ****"
echo ""
echo "It is no longer possible to renumber the LEDs."
echo "The values are already published in the documentation."
exit 1
echo ""
echo -n "Continue? "

if ("$<" != y) then
	echo Aborted.
	exit
endif

cp prom_leds.h prom_leds_awk.old
cat prom_leds_awk.old | nawk ' 				\
{							\
	if ($1 == "#define" && ($2 ~ /^PLED_/)) {	\
		$3 = num++ 				\
		printf "#define %-31s 0x%02x\n", $2, $3	\
	} else						\
		print $0				\
}' > prom_leds.h
