
BEGIN {
	print "/* $Id: mksnmp-h.awk,v 1.1 2000/10/13 12:52:02 gray Exp $ */"
	print "/* This file is automatically generated"
	print " * Please, do not edit."
	for (i = 1; i < ARGC; i++)
		print " * Source file: " ARGV[i]
        print " */"
}

/--.*/ {
	print substr($0, 3);
	next;
}

/-beginX/ {
	create_X++
	next
}

/-endX/ {
	create_X--
	next
}

NF == 2 {
	print "#define MIB_" $1 " " $2
	n = split($2, a, ",")
	print "#define LEN_" $1 " " n
	print "#define MIB_KEY_" $1 " " a[n]
	if (create_X) {
		print "#define MIB_" $1 "_X " $2 ",0"
		print "#define LEN_" $1 "_X " n+1
	}
	next
}


