diff options
author | stefanf <stefanf@FreeBSD.org> | 2005-09-01 19:16:25 +0000 |
---|---|---|
committer | stefanf <stefanf@FreeBSD.org> | 2005-09-01 19:16:25 +0000 |
commit | cd3615cae726ef8f1ea81f8af4d25a8ff2fa6ab7 (patch) | |
tree | 811d253fa6dd9c7130a1eb6b03d8f45fd9ce7485 /usr.bin/rpcgen/rpc_hout.c | |
parent | 1d9944c7c9dd7c2690c4a21182e65394409b2015 (diff) | |
download | FreeBSD-src-cd3615cae726ef8f1ea81f8af4d25a8ff2fa6ab7.zip FreeBSD-src-cd3615cae726ef8f1ea81f8af4d25a8ff2fa6ab7.tar.gz |
Only write the dispatch table function prototypes to the header if the -h
flag was specified. If all files are generated at once, those functions are
static and shouldn't appear in the header.
PR: 84450
Reviewed by: alfred
Diffstat (limited to 'usr.bin/rpcgen/rpc_hout.c')
-rw-r--r-- | usr.bin/rpcgen/rpc_hout.c | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/usr.bin/rpcgen/rpc_hout.c b/usr.bin/rpcgen/rpc_hout.c index c4f089e..eb4e4bf 100644 --- a/usr.bin/rpcgen/rpc_hout.c +++ b/usr.bin/rpcgen/rpc_hout.c @@ -51,7 +51,7 @@ void storexdrfuncdecl( char *, int ); static void pconstdef( definition * ); static void pstructdef( definition * ); static void puniondef( definition * ); -static void pprogramdef( definition * ); +static void pprogramdef( definition *, int ); static void pstructdef( definition * ); static void penumdef( definition * ); static void ptypedef( definition * ); @@ -65,8 +65,7 @@ void pdeclaration( char *, declaration *, int, char * ); * Print the C-version of an xdr definition */ void -print_datadef(def) - definition *def; +print_datadef(definition *def, int headeronly) { if (def->def_kind == DEF_PROGRAM) /* handle data only */ @@ -89,7 +88,7 @@ print_datadef(def) ptypedef(def); break; case DEF_PROGRAM: - pprogramdef(def); + pprogramdef(def, headeronly); break; case DEF_CONST: pconstdef(def); @@ -105,13 +104,12 @@ print_datadef(def) void -print_funcdef(def) - definition *def; +print_funcdef(definition *def, int headeronly) { switch (def->def_kind) { case DEF_PROGRAM: f_print(fout, "\n"); - pprogramdef(def); + pprogramdef(def, headeronly); break; default: break; @@ -316,8 +314,7 @@ pdispatch(char * name, char *vers, int mode) } static void -pprogramdef(def) - definition *def; +pprogramdef(definition *def, int headeronly) { version_list *vers; proc_list *proc; @@ -345,8 +342,10 @@ pprogramdef(def) if(!Cflag){ ext = "extern "; - f_print(fout, "%s", ext); - pdispatch(def->def_name, vers->vers_num, 2); + if (headeronly) { + f_print(fout, "%s", ext); + pdispatch(def->def_name, vers->vers_num, 2); + } for (proc = vers->procs; proc != NULL; proc = proc->next) { if (!define_printed(proc, @@ -374,8 +373,11 @@ pprogramdef(def) ext = "extern "; } - f_print(fout, "%s", ext); - pdispatch(def->def_name, vers->vers_num, i); + if (headeronly) { + f_print(fout, "%s", ext); + pdispatch(def->def_name, vers->vers_num, + i); + } for (proc = vers->procs; proc != NULL; proc = proc->next) { if (!define_printed(proc, |