Subject: Re: bug in rpcgen
To: None <current-users@NetBSD.ORG>
From: Perry E. Metzger <>
List: current-users
Date: 10/13/1994 18:31:09
Perry E. Metzger says:
> Hi there.
> I've found a bug in rpcgen.

I found the source of this bug in rpcgen.

Sun's cpp does not smash together input lines with \s at the end -- it
passes these on to the compiler.

Gnu's cpp, cccp, smashes input lines together.

rpcgen calls cpp on its input.

I have temporarily kludged around this problem by building an rpcgen
that calls a script that calls a pipeline of

perlscript that protects %stuff\ lines | cccp | perlscript that unprotects

but this is an ugly hack. I'd love for someone to tell me a better way
to fix this so that it can be incorporated into rpcgen properly.


> Sun rpcgen passes through \ characters that appear at the end of line
> in % quoted regions. Thus (to use a real example), 
> %#define KRDDMsgPageImageCopy(pi) \
> %       (KRDDMsgPageImage *)XdrCopy((XdrFunc)xdr_KRDDMsgPageImage, \
> %           sizeof(KRDDMsgPageImage), (XtPointer)pi)
> turns into
> #define KRDDMsgPageImageCopy(pi) \
>        (KRDDMsgPageImage *)XdrCopy((XdrFunc)xdr_KRDDMsgPageImage, \
>            sizeof(KRDDMsgPageImage), (XtPointer)pi)
> The rpcgen in NetBSD (and in BSDI 1.1) interprets
> these characters, thus turning the line into the following very wide mess:
> #define KRDDMsgPageImageCopy(pi) %      (KRDDMsgPageImage *)XdrCopy((XdrFunc)
xdr_KRDDMsgPageImage, %        sizeof(KRDDMsgPageImage), (XtPointer)pi)
> The rpcgen in NetBSD seems to be based on the code sun released to the
> net, so perhaps Sun fixed this in their version of the OS but never
> bothered to to tell anyone.
> BTW, Sun also now offers an rpcgen option with the rpcgen send along
> with their unbundled compiler (the -C option) that generates ANSI
> code.
> Perry