#!/usr/bin/perl
#
#   vSRFtT vaRiaBle SYMBOL Re_Cord Field typ TYP
#
# "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.  Thus for the command
#   vSRFtT swsfmptBar XSWSFMPTSBP7BAR SFM_Perf_progress SBBar7 sfm SFM
# the transformations that we make are:
#
#   fuBar  -> swsfmptBar
#   FUBAR  -> XSWSFMPTSBP7BAR
#   Fu_Bar -> SFM_Perf_progress
#   FuBar  -> SBBar7
#   foo    -> sfm
#   FOO    -> SFM
#
# 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  for the record Rec_name.  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
$mgc = shift(ARGV) || "FUBAR";	# Symbolic "magic" constant
$rec = shift(ARGV) || "Fu_Bar";	# Field name in ICD and cm4_record.h
$fld = shift(ARGV) || "FuBar";	# Field name in ICD and cm4_record.h
$typ = shift(ARGV) || "foo";	# Type of data wanted
$TYP = shift(ARGV) || "FOO";	# Same in upper case

for (<>) {
	next if /^\|/;
	s/FUBAR/$mgc/g;
	s/fuBar/$var/g;
	s/FuBar/$fld/g;
	s/Fu_Bar/$rec/g;
	s/foo/$typ/g;
	s/FOO/$TYP/g;
	print;
}
