Don't generate K&R C code. The -C flag is kept for backwards compatibility.

Also remove the SIG_PF macro, there is no need to cast closedown.
This commit is contained in:
Stefan Farfeleder 2005-09-02 10:23:26 +00:00
parent 93cf1a68a6
commit 15df5e2d43
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=149709
9 changed files with 126 additions and 403 deletions

View File

@ -124,90 +124,39 @@ void printarglist(proc, result, addargname, addargtype)
if (!newstyle) {
/* old style: always pass argument by reference */
if (Cflag) { /* C++ style heading */
f_print(fout, "(");
ptype(proc->args.decls->decl.prefix,
proc->args.decls->decl.type, 1);
f_print(fout, "(");
ptype(proc->args.decls->decl.prefix,
proc->args.decls->decl.type, 1);
if (mtflag) {/* Generate result field */
f_print(fout, "*argp, ");
ptype(proc->res_prefix, proc->res_type, 1);
f_print(fout, "*%s, %s%s)\n",
result, addargtype, addargname);
} else
f_print(fout, "*argp, %s%s)\n", addargtype, addargname);
} else {
if (!mtflag)
f_print(fout, "(argp, %s)\n", addargname);
else
f_print(fout, "(argp, %s, %s)\n",
result, addargname);
f_print(fout, "\t");
ptype(proc->args.decls->decl.prefix,
proc->args.decls->decl.type, 1);
f_print(fout, "*argp;\n");
if (mtflag) {
f_print(fout, "\t");
ptype(proc->res_prefix, proc->res_type, 1);
f_print(fout, "*%s;\n", result);
}
}
if (mtflag) {/* Generate result field */
f_print(fout, "*argp, ");
ptype(proc->res_prefix, proc->res_type, 1);
f_print(fout, "*%s, %s%s)\n",
result, addargtype, addargname);
} else
f_print(fout, "*argp, %s%s)\n", addargtype, addargname);
} else if (streq(proc->args.decls->decl.type, "void")) {
/* newstyle, 0 argument */
if (mtflag) {
f_print(fout, "(");
if (Cflag) {
ptype(proc->res_prefix, proc->res_type, 1);
f_print(fout, "*%s, %s%s)\n",
result, addargtype, addargname);
}
else
f_print(fout, "(%s)\n", addargname);
f_print(fout, "(");
ptype(proc->res_prefix, proc->res_type, 1);
f_print(fout, "*%s, %s%s)\n",
result, addargtype, addargname);
} else
if (Cflag)
f_print(fout, "(%s%s)\n", addargtype, addargname);
else
f_print(fout, "(%s)\n", addargname);
} else {
/* new style, 1 or multiple arguments */
if (!Cflag) {
f_print(fout, "(");
for (l = proc->args.decls; l != NULL; l = l->next)
f_print(fout, "%s, ", l->decl.name);
if (mtflag)
f_print(fout, "%s, ", result);
f_print(fout, "%s)\n", addargname);
for (l = proc->args.decls; l != NULL; l = l->next) {
pdeclaration(proc->args.argname,
&l->decl, 1, ";\n");
}
if (mtflag) {
f_print(fout, "\t");
ptype(proc->res_prefix, proc->res_type, 1);
f_print(fout, "*%s;\n", result);
}
} else { /* C++ style header */
f_print(fout, "(");
for (l = proc->args.decls; l != NULL; l = l->next) {
pdeclaration(proc->args.argname, &l->decl, 0,
", ");
}
if (mtflag) {
ptype(proc->res_prefix, proc->res_type, 1);
f_print(fout, "*%s, ", result);
}
f_print(fout, "%s%s)\n", addargtype, addargname);
f_print(fout, "(");
for (l = proc->args.decls; l != NULL; l = l->next) {
pdeclaration(proc->args.argname, &l->decl, 0, ", ");
}
}
if (mtflag) {
ptype(proc->res_prefix, proc->res_type, 1);
f_print(fout, "*%s, ", result);
if (!Cflag)
f_print(fout, "\t%s%s;\n", addargtype, addargname);
}
f_print(fout, "%s%s)\n", addargtype, addargname);
}
}

View File

@ -135,21 +135,12 @@ print_generic_header(procname, pointerp)
{
f_print(fout, "\n");
f_print(fout, "bool_t\n");
if (Cflag) {
f_print(fout, "xdr_%s(", procname);
f_print(fout, "register XDR *xdrs, ");
f_print(fout, "%s ", procname);
if (pointerp)
f_print(fout, "*");
f_print(fout, "objp)\n{\n\n");
} else {
f_print(fout, "xdr_%s(xdrs, objp)\n", procname);
f_print(fout, "\tregister XDR *xdrs;\n");
f_print(fout, "\t%s ", procname);
if (pointerp)
f_print(fout, "*");
f_print(fout, "objp;\n{\n\n");
}
f_print(fout, "xdr_%s(", procname);
f_print(fout, "register XDR *xdrs, ");
f_print(fout, "%s ", procname);
if (pointerp)
f_print(fout, "*");
f_print(fout, "objp)\n{\n\n");
}
static void

View File

@ -58,7 +58,7 @@ static void ptypedef( definition * );
static void pdefine( char *, char * );
static int undefined2( char *, char * );
static void parglist( proc_list *, char * );
static void pprocdef( proc_list *, version_list *, char *, int, int );
static void pprocdef( proc_list *, version_list *, char *, int );
void pdeclaration( char *, declaration *, int, char * );
/*
@ -144,20 +144,10 @@ int pointerp;
}
void
print_xdr_func_def(name, pointerp, i)
char* name;
int pointerp;
int i;
print_xdr_func_def(char *name, int pointerp)
{
if (i == 2) {
f_print(fout, "extern bool_t xdr_%s();\n", name);
return;
}
else
f_print(fout, "extern bool_t xdr_%s(XDR *, %s%s);\n", name,
name, pointerp ? "*" : "");
f_print(fout, "extern bool_t xdr_%s(XDR *, %s%s);\n", name,
name, pointerp ? "*" : "");
}
@ -287,30 +277,20 @@ define_printed(stop, start)
}
static void
pfreeprocdef(char * name, char *vers, int mode)
pfreeprocdef(char * name, char *vers)
{
f_print(fout, "extern int ");
pvname(name, vers);
if (mode == 1)
f_print(fout,"_freeresult(SVCXPRT *, xdrproc_t, caddr_t);\n");
else
f_print(fout,"_freeresult();\n");
f_print(fout, "_freeresult(SVCXPRT *, xdrproc_t, caddr_t);\n");
}
static void
pdispatch(char * name, char *vers, int mode)
pdispatch(char * name, char *vers)
{
f_print(fout, "void ");
pvname(name, vers);
if (mode == 1)
f_print(fout,
"(struct svc_req *rqstp, register SVCXPRT *transp);\n");
else
f_print(fout,"();\n");
f_print(fout, "(struct svc_req *rqstp, register SVCXPRT *transp);\n");
}
static void
@ -318,7 +298,6 @@ pprogramdef(definition *def, int headeronly)
{
version_list *vers;
proc_list *proc;
int i;
char *ext;
pargdef(def);
@ -335,75 +314,27 @@ pprogramdef(definition *def, int headeronly)
}
puldefine(vers->vers_name, vers->vers_num);
/*
* Print out 2 definitions, one for ANSI-C, another for
* old K & R C
*/
if(!Cflag){
ext = "extern ";
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,
def->def.pr.versions)) {
puldefine(proc->proc_name,
proc->proc_num);
}
f_print(fout, "%s", ext);
pprocdef(proc, vers, NULL, 0, 2);
if (mtflag) {
f_print(fout, "%s", ext);
pprocdef(proc, vers, NULL, 1, 2);
}
}
pfreeprocdef(def->def_name, vers->vers_num, 2);
} else {
for (i = 1; i < 3; i++){
if (i == 1){
f_print(fout, "\n#if defined(__STDC__) || defined(__cplusplus)\n");
ext = "extern ";
}else{
f_print(fout, "\n#else /* K&R C */\n");
ext = "extern ";
}
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,
def->def.pr.versions)) {
puldefine(proc->proc_name,
proc->proc_num);
}
f_print(fout, "%s", ext);
pprocdef(proc, vers, "CLIENT *", 0, i);
f_print(fout, "%s", ext);
pprocdef(proc, vers, "struct svc_req *", 1, i);
}
pfreeprocdef(def->def_name, vers->vers_num, i);
}
f_print(fout, "#endif /* K&R C */\n");
f_print(fout, "\n");
ext = "extern ";
if (headeronly) {
f_print(fout, "%s", ext);
pdispatch(def->def_name, vers->vers_num);
}
for (proc = vers->procs; proc != NULL; proc = proc->next) {
if (!define_printed(proc, def->def.pr.versions)) {
puldefine(proc->proc_name, proc->proc_num);
}
f_print(fout, "%s", ext);
pprocdef(proc, vers, "CLIENT *", 0);
f_print(fout, "%s", ext);
pprocdef(proc, vers, "struct svc_req *", 1);
}
pfreeprocdef(def->def_name, vers->vers_num);
}
}
static void
pprocdef(proc, vp, addargtype, server_p, mode)
proc_list *proc;
version_list *vp;
char* addargtype;
int server_p;
int mode;
pprocdef(proc_list *proc, version_list *vp, char *addargtype, int server_p)
{
if (mtflag) {/* Print MT style stubs */
if (server_p)
@ -419,13 +350,7 @@ pprocdef(proc, vp, addargtype, server_p, mode)
else
pvname(proc->proc_name, vp->vers_num);
/*
* mode 1 = ANSI-C, mode 2 = K&R C
*/
if ( mode == 1)
parglist(proc, addargtype);
else
f_print(fout, "();\n");
parglist(proc, addargtype);
}

View File

@ -138,7 +138,6 @@ int indefinitewait; /* If started by port monitors, hang till it wants */
int exitnow; /* If started by port monitors, exit after the call */
int timerflag; /* TRUE if !indefinite && !exitnow */
int newstyle; /* newstyle of passing arguments (by value) */
int Cflag = 0; /* ANSI C syntax */
int CCflag = 0; /* C++ files */
static int allfiles; /* generate all files */
int tirpcflag = 1; /* generating code for tirpc, by default */
@ -523,7 +522,6 @@ h_output(char *infile, char *define, int extend, char *outfile, int headeronly)
char *guard;
list *l;
xdrfunc *xdrfuncp;
int i;
open_input(infile, define);
outfilename = extend ? extendfile(infile, outfile) : outfile;
@ -543,7 +541,7 @@ h_output(char *infile, char *define, int extend, char *outfile, int headeronly)
f_print(fout, "#include <pthread.h>\n");
/* put the C++ support */
if (Cflag && !CCflag){
if (!CCflag) {
f_print(fout, "\n#ifdef __cplusplus\n");
f_print(fout, "extern \"C\" {\n");
f_print(fout, "#endif\n\n");
@ -573,35 +571,15 @@ h_output(char *infile, char *define, int extend, char *outfile, int headeronly)
"\n/* the xdr functions */\n");
if (CCflag){
f_print(fout, "\n#ifdef __cplusplus\n");
f_print(fout, "extern \"C\" {\n");
f_print(fout, "#endif\n");
}
f_print(fout, "\n#ifdef __cplusplus\n");
f_print(fout, "extern \"C\" {\n");
f_print(fout, "#endif\n");
}
if (!Cflag){
xdrfuncp = xdrfunc_head;
while (xdrfuncp != NULL){
print_xdr_func_def(xdrfuncp->name,
xdrfuncp->pointerp, 2);
xdrfuncp = xdrfuncp->next;
}
} else {
for (i = 1; i < 3; i++){
if (i == 1)
f_print(fout, "\n#if defined(__STDC__) || defined(__cplusplus)\n");
else
f_print(fout, "\n#else /* K&R C */\n");
xdrfuncp = xdrfunc_head;
while (xdrfuncp != NULL){
print_xdr_func_def(xdrfuncp->name,
xdrfuncp->pointerp, i);
xdrfuncp = xdrfuncp->next;
}
}
f_print(fout, "\n#endif /* K&R C */\n");
xdrfuncp = xdrfunc_head;
while (xdrfuncp != NULL){
print_xdr_func_def(xdrfuncp->name, xdrfuncp->pointerp);
xdrfuncp = xdrfuncp->next;
}
}
@ -611,11 +589,9 @@ h_output(char *infile, char *define, int extend, char *outfile, int headeronly)
f_print(fout, rpcgen_table_dcl);
}
if (Cflag){
f_print(fout, "\n#ifdef __cplusplus\n");
f_print(fout, "}\n");
f_print(fout, "#endif\n");
}
f_print(fout, "\n#ifdef __cplusplus\n");
f_print(fout, "}\n");
f_print(fout, "#endif\n");
f_print(fout, "\n#endif /* !_%s */\n", guard);
}
@ -651,11 +627,8 @@ s_output(argc, argv, infile, define, extend, outfile, nomain, netflag)
f_print(fout, "#include <stdio.h>\n");
f_print(fout, "#include <stdlib.h> /* getenv, exit */\n");
if (Cflag) {
f_print (fout,
"#include <rpc/pmap_clnt.h> /* for pmap_unset */\n");
f_print (fout, "#include <string.h> /* strcmp */\n");
}
f_print (fout, "#include <rpc/pmap_clnt.h> /* for pmap_unset */\n");
f_print (fout, "#include <string.h> /* strcmp */\n");
if (tirpcflag)
f_print(fout, "#include <rpc/rpc_com.h>\n");
if (strcmp(svcclosetime, "-1") == 0)
@ -669,7 +642,7 @@ s_output(argc, argv, infile, define, extend, outfile, nomain, netflag)
if (!tirpcflag && inetdflag)
f_print(fout, "#include <sys/ttycom.h> /* TIOCNOTTY */\n");
if (Cflag && (inetdflag || pmflag)) {
if (inetdflag || pmflag) {
f_print(fout, "#ifdef __cplusplus\n");
f_print(fout,
"#include <sysent.h> /* getdtablesize, open */\n");
@ -695,12 +668,6 @@ s_output(argc, argv, infile, define, extend, outfile, nomain, netflag)
if (logflag || inetdflag || pmflag || tirpcflag)
f_print(fout, "#include <syslog.h>\n");
/* for ANSI-C */
if (Cflag)
f_print(fout,
"\n#ifndef SIG_PF\n#define SIG_PF void(*)\
(int)\n#endif\n");
f_print(fout, "\n#ifdef DEBUG\n#define RPC_SVC_FG\n#endif\n");
if (timerflag)
f_print(fout, "\n#define _RPCSVC_CLOSEDOWN %s\n",
@ -742,8 +709,7 @@ l_output(infile, define, extend, outfile)
outfilename = extend ? extendfile(infile, outfile) : outfile;
open_output(infile, outfilename);
add_warning();
if (Cflag)
f_print (fout, "#include <string.h> /* for memset */\n");
f_print (fout, "#include <string.h> /* for memset */\n");
if (infile && (include = extendfile(infile, ".h"))) {
f_print(fout, "#include \"%s\"\n", include);
free(include);
@ -1131,7 +1097,6 @@ parseargs(argc, argv, cmd)
flag[(int)ch] = 1;
break;
case 'C': /* ANSI C syntax */
Cflag = 1;
ch = argv[i][j+1]; /* get next char */
if (ch != 'C')

View File

@ -91,10 +91,7 @@ write_sample_client(program_name, vp)
f_print(fout, "\n\nvoid\n");
pvname(program_name, vp->vers_num);
if(Cflag)
f_print(fout,"(char *host)\n{\n");
else
f_print(fout, "(host)\n\tchar *host;\n{\n");
f_print(fout, "(char *host)\n{\n");
f_print(fout, "\tCLIENT *clnt;\n");
i = 0;
@ -211,10 +208,7 @@ write_sample_server(def)
f_print(fout, "*\n");
} else
f_print(fout, "bool_t\n");
if (Cflag || mtflag)
pvname_svc(proc->proc_name, vp->vers_num);
else
pvname(proc->proc_name, vp->vers_num);
pvname_svc(proc->proc_name, vp->vers_num);
printarglist(proc, "result", RQSTP, "struct svc_req *");
f_print(fout, "{\n");
@ -244,14 +238,7 @@ write_sample_server(def)
if (mtflag) {
f_print(fout, "\nint\n");
pvname(def->def_name, vp->vers_num);
if (Cflag)
f_print(fout,"_freeresult(SVCXPRT *transp, xdrproc_t xdr_result, caddr_t result)\n");
else {
f_print(fout,"_freeresult(transp, xdr_result, result)\n");
f_print(fout,"\tSVCXPRT *transp;\n");
f_print(fout,"\txdrproc_t xdr_result;\n");
f_print(fout,"\tcaddr_t result;\n");
}
f_print(fout,"_freeresult(SVCXPRT *transp, xdrproc_t xdr_result, caddr_t result)\n");
f_print(fout, "{\n");
f_print(fout, "\t(void) xdr_free(xdr_result, result);\n");
f_print(fout,
@ -290,10 +277,7 @@ write_sample_clnt_main()
version_list *vp;
f_print(fout, "\n\n");
if(Cflag)
f_print(fout,"main(int argc, char *argv[])\n{\n");
else
f_print(fout, "main(argc, argv)\n\tint argc;\n\tchar *argv[];\n{\n");
f_print(fout, "main(int argc, char *argv[])\n{\n");
f_print(fout, "\tchar *host;");
f_print(fout, "\n\n\tif (argc < 2) {");

View File

@ -80,12 +80,8 @@ p_xdrfunc(rname, typename)
char* rname;
char* typename;
{
if (Cflag)
f_print(fout, "\t\txdr_%s = (xdrproc_t) xdr_%s;\n",
rname, stringfix(typename));
else
f_print(fout, "\t\txdr_%s = xdr_%s;\n",
rname, stringfix(typename));
f_print(fout, "\t\txdr_%s = (xdrproc_t) xdr_%s;\n",
rname, stringfix(typename));
}
void
@ -308,8 +304,7 @@ write_rest()
if (timerflag) {
f_print(fout, "\tif (_rpcpmstart) {\n");
f_print(fout,
"\t\t(void) signal(SIGALRM, %s closedown);\n",
Cflag? "(SIG_PF)":"(void(*)())");
"\t\t(void) signal(SIGALRM, closedown);\n");
f_print(fout, "\t\t(void) \
alarm(_RPCSVC_CLOSEDOWN/2);\n");
f_print(fout, "\t}\n");
@ -373,50 +368,26 @@ write_real_program(def)
f_print(fout, "int");
f_print(fout, "\n_");
pvname(proc->proc_name, vp->vers_num);
if (Cflag) {
f_print(fout, "(");
/* arg name */
if (proc->arg_num > 1)
f_print(fout, proc->args.argname);
else
ptype(proc->args.decls->decl.prefix,
proc->args.decls->decl.type, 0);
if (mtflag) {
f_print(fout, " *argp, void *%s, struct svc_req *%s)\n",
RESULT, RQSTP);
f_print(fout, "(");
/* arg name */
if (proc->arg_num > 1)
f_print(fout, proc->args.argname);
else
ptype(proc->args.decls->decl.prefix,
proc->args.decls->decl.type, 0);
if (mtflag) {
f_print(fout, " *argp, void *%s, struct svc_req *%s)\n",
RESULT, RQSTP);
}
else
f_print(fout, " *argp, struct svc_req *%s)\n",
RQSTP);
} else {
if (mtflag)
f_print(fout, "(argp, %s, %s)\n", RESULT, RQSTP);
else
f_print(fout, "(argp, %s)\n", RQSTP);
/* arg name */
if (proc->arg_num > 1)
f_print(fout, "\t%s *argp;\n",
proc->args.argname);
else {
f_print(fout, "\t");
ptype(proc->args.decls->decl.prefix,
proc->args.decls->decl.type, 0);
f_print(fout, " *argp;\n");
}
if (mtflag)
f_print(fout, "\tvoid *%s;\n", RESULT);
f_print(fout, "\tstruct svc_req *%s;\n", RQSTP);
}
else
f_print(fout, " *argp, struct svc_req *%s)\n",
RQSTP);
f_print(fout, "{\n");
f_print(fout, "\treturn (");
if (Cflag || mtflag) /* for mtflag, arguments are different */
pvname_svc(proc->proc_name, vp->vers_num);
else
pvname(proc->proc_name, vp->vers_num);
pvname_svc(proc->proc_name, vp->vers_num);
f_print(fout, "(");
if (proc->arg_num < 2) { /* single argument */
if (!streq(proc->args.decls->decl.type, "void"))
@ -451,15 +422,8 @@ write_program(def, storage)
f_print(fout, "void\n");
pvname(def->def_name, vp->vers_num);
if (Cflag) {
f_print(fout, "(struct svc_req *%s, ", RQSTP);
f_print(fout, "register SVCXPRT *%s)\n", TRANSP);
} else {
f_print(fout, "(%s, %s)\n", RQSTP, TRANSP);
f_print(fout, " struct svc_req *%s;\n", RQSTP);
f_print(fout, " register SVCXPRT *%s;\n", TRANSP);
}
f_print(fout, "(struct svc_req *%s, ", RQSTP);
f_print(fout, "register SVCXPRT *%s)\n", TRANSP);
f_print(fout, "{\n");
filled = 0;
@ -504,26 +468,15 @@ write_program(def, storage)
} else
f_print(fout, "\tchar *%s;\n", RESULT);
if (Cflag) {
f_print(fout, "\txdrproc_t xdr_%s, xdr_%s;\n",
ARG, RESULT);
if (mtflag)
f_print(fout,
"\tbool_t (*%s)(char *, void *, struct svc_req *);\n",
ROUTINE);
else
f_print(fout,
"\tchar *(*%s)(char *, struct svc_req *);\n",
ROUTINE);
} else {
f_print(fout, "\txdrproc_t xdr_%s, xdr_%s;\n", ARG, RESULT);
if (mtflag)
f_print(fout,
"\tbool_t (*xdr_%s)(), (*xdr_%s)();\n",
ARG, RESULT);
if (mtflag)
f_print(fout, "\tbool_t (*%s)();\n", ROUTINE);
else
f_print(fout, "\tchar *(*%s)();\n", ROUTINE);
}
"\tbool_t (*%s)(char *, void *, struct svc_req *);\n",
ROUTINE);
else
f_print(fout,
"\tchar *(*%s)(char *, struct svc_req *);\n",
ROUTINE);
f_print(fout, "\n");
if (timerflag) {
@ -539,11 +492,8 @@ write_program(def, storage)
if (!nullproc(vp->procs)) {
f_print(fout, "\tcase NULLPROC:\n");
f_print(fout,
Cflag
? "\t\t(void) svc_sendreply(%s,\n\t\t\t\
(xdrproc_t) xdr_void, (char *)NULL);\n"
: "\t\t(void) svc_sendreply(%s, xdr_void,\n\t\t\t\
(char *)NULL);\n",
"\t\t(void) svc_sendreply(%s,\n\t\t\t"
"(xdrproc_t) xdr_void, (char *)NULL);\n",
TRANSP);
print_return("\t\t");
f_print(fout, "\n");
@ -557,27 +507,18 @@ write_program(def, storage)
}
p_xdrfunc(RESULT, proc->res_type);
if (Cflag)
if (mtflag)
f_print(fout,
"\t\t%s = (bool_t (*) (char *, void *, struct svc_req *))",
ROUTINE);
else
f_print(fout,
"\t\t%s = (char *(*)(char *, struct svc_req *)) ",
ROUTINE);
if (mtflag)
f_print(fout,
"\t\t%s = (bool_t (*) (char *, void *, struct svc_req *))",
ROUTINE);
else
if (mtflag)
f_print(fout, "\t\t%s = (bool_t (*)()) ",
ROUTINE);
else
f_print(fout, "\t\t%s = (char *(*)()) ",
ROUTINE);
f_print(fout,
"\t\t%s = (char *(*)(char *, struct svc_req *)) ",
ROUTINE);
if (newstyle) { /* new style: calls internal routine */
f_print(fout, "_");
}
if ((Cflag || mtflag) && !newstyle)
if (!newstyle)
pvname_svc(proc->proc_name, vp->vers_num);
else
pvname(proc->proc_name, vp->vers_num);
@ -592,30 +533,17 @@ write_program(def, storage)
f_print(fout,
"\t(void) memset((char *)&%s, 0, sizeof (%s));\n",
ARG, ARG);
if (Cflag)
printif("getargs", TRANSP, "(caddr_t) &", ARG);
else
printif("getargs", TRANSP, "&", ARG);
printif("getargs", TRANSP, "(caddr_t) &", ARG);
printerr("decode", TRANSP);
print_return("\t\t");
f_print(fout, "\t}\n");
if (!mtflag)
if (Cflag)
f_print(fout, "\t%s = (*%s)((char *)&%s, %s);\n",
RESULT, ROUTINE, ARG, RQSTP);
else
f_print(fout, "\t%s = (*%s)(&%s, %s);\n",
RESULT, ROUTINE, ARG, RQSTP);
f_print(fout, "\t%s = (*%s)((char *)&%s, %s);\n",
RESULT, ROUTINE, ARG, RQSTP);
else
if (Cflag)
f_print(fout, "\t%s = (bool_t) (*%s)((char *)&%s, (void *)&%s, %s);\n",
RETVAL, ROUTINE, ARG, RESULT, RQSTP);
else
f_print(fout, "\t%s = (bool_t) (*%s)(&%s, &%s, %s);\n",
RETVAL, ROUTINE, ARG, RESULT, RQSTP);
f_print(fout, "\t%s = (bool_t) (*%s)((char *)&%s, (void *)&%s, %s);\n",
RETVAL, ROUTINE, ARG, RESULT, RQSTP);
if (mtflag)
@ -630,10 +558,7 @@ write_program(def, storage)
printerr("systemerr", TRANSP);
f_print(fout, "\t}\n");
if (Cflag)
printif("freeargs", TRANSP, "(caddr_t) &", ARG);
else
printif("freeargs", TRANSP, "&", ARG);
printif("freeargs", TRANSP, "(caddr_t) &", ARG);
(void) sprintf(_errbuf, "unable to free arguments");
print_err_message("\t\t");
f_print(fout, "\t\texit(1);\n");
@ -789,13 +714,7 @@ write_msg_out(void)
* in the toplevel RPC server code.
*/
f_print(fout, "static\n");
if (!Cflag) {
f_print(fout, "void _msgout(msg)\n");
f_print(fout, "\tchar *msg;\n");
} else {
f_print(fout, "void _msgout(const char* msg)\n");
}
f_print(fout, "void _msgout(const char* msg)\n");
f_print(fout, "{\n");
f_print(fout, "#ifdef RPC_SVC_FG\n");
if (inetdflag || pmflag)
@ -821,11 +740,7 @@ write_timeout_func(void)
f_print(fout, "\n");
f_print(fout, "static void\n");
if (!Cflag) {
f_print(fout, "closedown(sig)\n");
f_print(fout, "\tint sig;\n");
} else
f_print(fout, "closedown(int sig)\n");
f_print(fout, "closedown(int sig)\n");
f_print(fout, "{\n");
if (mtflag)
f_print(fout, "\tmutex_lock(&_svcstate_lock);\n");
@ -868,8 +783,7 @@ write_timeout_func(void)
if (mtflag)
f_print(fout, "\tmutex_unlock(&_svcstate_lock);\n");
f_print(fout, "\t(void) signal(SIGALRM, %s closedown);\n",
Cflag? "(SIG_PF)" : "(void(*)())");
f_print(fout, "\t(void) signal(SIGALRM, closedown);\n");
f_print(fout, "\t(void) alarm(_RPCSVC_CLOSEDOWN/2);\n");
f_print(fout, "}\n");
@ -991,8 +905,7 @@ getenv(\"NLSPROVIDER\")) == NULL) {\n");
}
if (timerflag) {
f_print(fout, "\t\tif (pmclose) {\n");
f_print(fout, "\t\t\t(void) signal(SIGALRM, %s closedown);\n",
Cflag? "(SIG_PF)" : "(void(*)())");
f_print(fout, "\t\t\t(void) signal(SIGALRM, closedown);\n");
f_print(fout, "\t\t\t(void) alarm(_RPCSVC_CLOSEDOWN/2);\n");
f_print(fout, "\t\t}\n");
}

View File

@ -122,7 +122,7 @@ write_table(def)
f_print(fout, "\n\t(char *(*)())RPCGEN_ACTION(");
/* routine to invoke */
if( Cflag && !newstyle )
if( !newstyle )
pvname_svc(proc->proc_name, vp->vers_num);
else {
if( newstyle )

View File

@ -131,7 +131,6 @@ extern int pmflag;
extern int tblflag;
extern int logflag;
extern int newstyle;
extern int Cflag; /* ANSI-C/C++ flag */
extern int CCflag; /* C++ flag */
extern int tirpcflag; /* flag for generating tirpc code */
extern int inline_size; /* if this is 0, then do not generate inline code */
@ -193,7 +192,7 @@ void emit(definition *def);
*/
void print_datadef(definition *def, int headeronly);
void print_funcdef(definition *def, int headeronly);
void print_xdr_func_def(char* name, int pointerp, int i);
void print_xdr_func_def(char* name, int pointerp);
/*
* rpc_svcout routines

View File

@ -2,7 +2,7 @@
.\" $FreeBSD$
.\" Copyright 1985-1993 Sun Microsystems, Inc.
.\"
.Dd March 28, 1993
.Dd September 1, 2005
.Dt RPCGEN 1
.Os
.Sh NAME
@ -258,11 +258,8 @@ Compile into
.Tn XDR
routines.
.It Fl C
Generate header and stub files which can be used with
.Tn ANSI
C compilers.
Headers generated with this flag can also be
used with C++ programs.
Generate ANSI C code.
This is always done, the flag is only provided for backwards compatibility.
.It Fl D Ns Ar name
.It Fl D Ns Ar name=value
.\".It Fl D Ns Ar name Ns Op Ar =value