#! /usr/local/bin/perl
open (xdr_hdr, ">$ARGV[0]") || die ("unable to open $ARGV[0] : $!\n");
print xdr_hdr "/*\n *  Please do not edit this file by hand\n";
print xdr_hdr " *  It was generated by xdrhdr.pl\n */\n\n";
print xdr_hdr "\n";
print xdr_hdr "#if defined(_DIS_PRIVATE)\n";
print xdr_hdr "#define xdr_short xdr_byte_short\n";
print xdr_hdr "#define xdr_u_short xdr_byte_u_short\n";
print xdr_hdr "#define xdr_char xdr_byte_char\n";
print xdr_hdr "#define xdr_u_char xdr_byte_u_char\n";
print xdr_hdr "#define xdr_byte_float xdr_float\n";
print xdr_hdr "#define xdr_byte_double xdr_double\n";
print xdr_hdr "\n";
print xdr_hdr "typedef u_char byte_u_char;\n";
print xdr_hdr "typedef u_short byte_u_short;\n";
print xdr_hdr "typedef u_long byte_u_long;\n";
print xdr_hdr "typedef u_int byte_u_int;\n";
print xdr_hdr "typedef char byte_char;\n";
print xdr_hdr "typedef short byte_short;\n";
print xdr_hdr "typedef long byte_long;\n";
print xdr_hdr "typedef int byte_int;\n";
print xdr_hdr "#endif\n\n";
print xdr_hdr "extern bool_t xdr_var_array(XDR * xdrs,
			caddr_t * addrp,
			u_int size,
			u_int maxsize,
			u_int elsize,
			xdrproc_t elproc);
";
print xdr_hdr "extern bool_t   xdr_byte_long(XDR *, void *);\n";
print xdr_hdr "extern bool_t   xdr_byte_u_long(XDR *, void *);\n";
print xdr_hdr "extern bool_t   xdr_byte_short(XDR *, void *);\n";
print xdr_hdr "extern bool_t   xdr_byte_u_short(XDR *, void *);\n";
print xdr_hdr "extern bool_t   xdr_byte_char(XDR *, void *);\n";
print xdr_hdr "extern bool_t   xdr_byte_u_char(XDR *, void *);\n";
print xdr_hdr "\n\n";
while (<STDIN>) {
	if (/^xdr_/) {
		$name = substr ($_, 0, index($_, '('));
		$name1 = substr ($name, 4);
		print xdr_hdr "bool_t $name (XDR *, $name1 *);\n";
	}
}
