#!/usr/bin/perl
#
#   Svf SYMBOL vaRiaBle field
#
# "Symbol variable field" transformation.
#
# This is a program that transforms the "generic" chunks of text  that
# are  scattered  throughout  the  SNMP  agent code, replacing several
# embedded strings with our command-line  args.   The  transformations
# that we make are:
#   fuBar -> vaRiaBle
# | FuBar -> field
#   FUBAR -> SYMBOL
# where  vaRiaBle  is  the  SNMP  MIB  variable  name (which must also
# conform to C variable-name rules), SYMBOL is the  #defined  constant
# in  mibtbl.h, and Field is the field name in the cm4_record.h header
# file. Note that the file "icd.t" (produced as a side-effect of using
# icd-c  to  make  cm4record.h) contains the three fields you need for
# calls on this program.

$var = shift(ARGV) || "fuBar";	# SNMP MIB variable name
$sym = shift(ARGV) || "FUBAR";	# Symbolic constant
$fld = shift(ARGV) || "FuBar";	# Field name in ICD and cm4_record.h

for (<>) {
	s/FUBAR/$sym/g;
	s/fuBar/$var/g;
	s/FuBar/$fld/g;
	print;
}
