Print this page
rpcgen should only produce ANSI code
@@ -18,10 +18,12 @@
*
* CDDL HEADER END
*/
/*
+ * Copyright 2014 Garrett D'Amore <garrett@damore.org>
+ *
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
@@ -114,107 +116,49 @@
bool_t oneway = streq(proc->res_type, "oneway");
decl_list *l;
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);
if (mtflag) { /* Generate result field */
f_print(fout, "*argp, ");
if (!oneway) {
- ptype(proc->res_prefix,
- proc->res_type, 1);
+ ptype(proc->res_prefix, proc->res_type, 1);
f_print(fout, "*%s, ", result);
}
- f_print(fout, "%s%s)\n",
- addargtype, addargname);
+ f_print(fout, "%s%s)\n", 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, ");
- if (!oneway) {
- f_print(fout, "%s, ",
- result);
- }
- f_print(fout, "%s)\n",
- addargname);
- }
- f_print(fout, "\t");
- ptype(proc->args.decls->decl.prefix,
- proc->args.decls->decl.type, 1);
- f_print(fout, "*argp;\n");
- if (mtflag && !oneway) {
- f_print(fout, "\t");
- ptype(proc->res_prefix, proc->res_type, 1);
- f_print(fout, "*%s;\n", result);
- }
- }
+ 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) {
if (!oneway) {
- ptype(proc->res_prefix,
- proc->res_type, 1);
+ ptype(proc->res_prefix, proc->res_type, 1);
f_print(fout, "*%s, ", result);
}
- f_print(fout, "%s%s)\n",
- addargtype, addargname);
- } else
- f_print(fout, "(%s)\n", addargname);
+ f_print(fout, "%s%s)\n", 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 && !oneway)
- 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");
+ pdeclaration(proc->args.argname, &l->decl, 0, ", ");
}
if (mtflag && !oneway) {
- 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 && !oneway) {
- ptype(proc->res_prefix, proc->res_type, 1);
f_print(fout, "*%s, ", result);
}
f_print(fout, "%s%s)\n", addargtype, addargname);
}
- }
-
- if (!Cflag)
- f_print(fout, "\t%s%s;\n", addargtype, addargname);
}
static char *