#!/usr/bin/perl
#
#   mkvarmodule name...
#
# This takes a list of names, which should be names of the group-level
# data  routines  within  the  SNMP  agent,  and  builds "stub" source
# modules for each of them.  This is done by copying  the  "v_proto.b"
# source  file,  and  changing  the  word  "proto" to the desired name
# throughout.  The resulting module should compile and return  a  null
# value  for  all calls.  This is a kludge to get the calling sequence
# right, and to make sure that we can link snmpd successfully.
#
# The name "foo" may be given in various forms:
#     foo
#     foo.o
#     v_foo
#     var_foo
#     _v_foo
# so you can feed it the list from the linker, for example.  The extra
# stuff  will be stripped off, and 'v_' prepended and '.b" appended to
# form the module's real name.
#
# Take care not to stomp on existing modules.

$proto = 'v_proto.b';

for $m (@ARGV) {
#	print "Name: $m\n";
	$m =~ s/^_*//;
	$m =~ s/^v_//;
	$m =~ s/^var_//;
	$m =~ s/\.o$//;
	print "v_$m.b: \$(SRC)/v_$m.b; Lc \$(SRC)/v_$m.b v_$m.b\n";
	print "v_$m.c: v_$m.b; \$(BC) <v_$m.b > v_$m.c\n";
	print "v_$m.o: v_$m.c\n";
	print "\n";
}
