summaryrefslogtreecommitdiff
path: root/usr.bin/rpcgen
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/rpcgen')
-rw-r--r--usr.bin/rpcgen/rpc_clntout.c9
-rw-r--r--usr.bin/rpcgen/rpc_cout.c95
-rw-r--r--usr.bin/rpcgen/rpc_hout.c65
-rw-r--r--usr.bin/rpcgen/rpc_main.c76
-rw-r--r--usr.bin/rpcgen/rpc_parse.c55
-rw-r--r--usr.bin/rpcgen/rpc_sample.c24
-rw-r--r--usr.bin/rpcgen/rpc_scan.c42
-rw-r--r--usr.bin/rpcgen/rpc_svcout.c67
-rw-r--r--usr.bin/rpcgen/rpc_tblout.c12
-rw-r--r--usr.bin/rpcgen/rpc_util.c15
-rw-r--r--usr.bin/rpcgen/rpc_util.h14
11 files changed, 262 insertions, 212 deletions
diff --git a/usr.bin/rpcgen/rpc_clntout.c b/usr.bin/rpcgen/rpc_clntout.c
index 804357cafa5..6143aa33f60 100644
--- a/usr.bin/rpcgen/rpc_clntout.c
+++ b/usr.bin/rpcgen/rpc_clntout.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rpc_clntout.c,v 1.3 1997/06/11 08:27:27 deraadt Exp $ */
+/* $OpenBSD: rpc_clntout.c,v 1.4 2001/07/17 02:23:59 pvalchev Exp $ */
/* $NetBSD: rpc_clntout.c,v 1.4 1995/06/11 21:49:52 pk Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -44,11 +44,9 @@ static char sccsid[] = "@(#)rpc_clntout.c 1.11 89/02/22 (C) 1987 SMI";
#include "rpc_parse.h"
#include "rpc_util.h"
-static write_program __P((definition *));
+static void write_program __P((definition *));
static void printbody __P((proc_list *));
-extern pdeclaration();
-
#define DEFAULT_TIMEOUT 25 /* in seconds */
static char RESULT[] = "clnt_res";
@@ -71,7 +69,7 @@ write_stubs()
}
}
-static
+static void
write_program(def)
definition *def;
{
@@ -165,7 +163,6 @@ printbody(proc)
{
decl_list *l;
bool_t args2 = (proc->arg_num > 1);
- int i;
/* For new style with multiple arguments, need a structure in which
to stuff the arguments. */
diff --git a/usr.bin/rpcgen/rpc_cout.c b/usr.bin/rpcgen/rpc_cout.c
index a3112016981..48f14d9c151 100644
--- a/usr.bin/rpcgen/rpc_cout.c
+++ b/usr.bin/rpcgen/rpc_cout.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rpc_cout.c,v 1.4 1997/10/11 21:10:41 deraadt Exp $ */
+/* $OpenBSD: rpc_cout.c,v 1.5 2001/07/17 02:23:59 pvalchev Exp $ */
/* $NetBSD: rpc_cout.c,v 1.6 1996/10/01 04:13:53 cgd Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -41,27 +41,28 @@ static char sccsid[] = "@(#)rpc_cout.c 1.13 89/02/22 (C) 1987 SMI";
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <ctype.h>
+#include <err.h>
#include "rpc_parse.h"
#include "rpc_util.h"
-static findtype __P((definition *, char *));
-static undefined __P((char *));
-static print_generic_header __P((char *, int));
-static print_header __P((definition *));
-static print_prog_header __P((proc_list *));
-static print_trailer __P((void));
-static print_ifopen __P((int, char *));
-static print_ifarg __P((char *));
-static print_ifsizeof __P((char *, char *));
-static print_ifclose __P((int));
-static print_ifstat __P((int, char *, char *, relation, char *, char *, char *));
-static emit_num __P((definition *));
-static emit_program __P((definition *));
-static emit_enum __P((definition *));
-static emit_union __P((definition *));
-static emit_struct __P((definition *));
-static emit_typedef __P((definition *));
-static print_stat __P((int, declaration *));
+static int findtype __P((definition *, char *));
+static int undefined __P((char *));
+static void print_generic_header __P((char *, int));
+static void print_header __P((definition *));
+static void print_prog_header __P((proc_list *));
+static void print_trailer __P((void));
+static void print_ifopen __P((int, char *));
+static void print_ifarg __P((char *));
+static void print_ifsizeof __P((char *, char *));
+static void print_ifclose __P((int));
+static void print_ifstat __P((int, char *, char *, relation, char *, char *, char *));
+static void emit_program __P((definition *));
+static void emit_enum __P((definition *));
+static void emit_union __P((definition *));
+static void emit_struct __P((definition *));
+static void emit_typedef __P((definition *));
+static void print_stat __P((int, declaration *));
/*
@@ -101,11 +102,16 @@ emit(def)
case DEF_TYPEDEF:
emit_typedef(def);
break;
+ case DEF_CONST:
+ case DEF_PROGRAM:
+ errx(1, "Internal error %s, %d: Case %d not handled\n",
+ __FILE__, __LINE__, def->def_kind);
+ break;
}
print_trailer();
}
-static
+static int
findtype(def, type)
definition *def;
char *type;
@@ -118,7 +124,7 @@ findtype(def, type)
}
}
-static
+static int
undefined(type)
char *type;
{
@@ -130,7 +136,7 @@ undefined(type)
return (def == NULL);
}
-static
+static void
print_generic_header(procname, pointerp)
char *procname;
int pointerp;
@@ -154,16 +160,11 @@ print_generic_header(procname, pointerp)
}
}
-static
+static void
print_header(def)
definition *def;
{
- decl_list *dl;
- bas_type *ptr;
- int i;
-
-
print_generic_header(def->def_name,
def->def_kind != DEF_TYPEDEF ||
!isvectordef(def->def.ty.old_type, def->def.ty.rel));
@@ -178,14 +179,14 @@ print_header(def)
}
-static
+static void
print_prog_header(plist)
proc_list *plist;
{
print_generic_header(plist->args.argname, 1);
}
-static
+static void
print_trailer()
{
f_print(fout, "\treturn (TRUE);\n");
@@ -193,7 +194,7 @@ print_trailer()
}
-static
+static void
print_ifopen(indent, name)
int indent;
char *name;
@@ -202,14 +203,14 @@ print_ifopen(indent, name)
f_print(fout, " if (!xdr_%s(xdrs", name);
}
-static
+static void
print_ifarg(arg)
char *arg;
{
f_print(fout, ", %s", arg);
}
-static
+static void
print_ifsizeof(prefix, type)
char *prefix;
char *type;
@@ -225,7 +226,7 @@ print_ifsizeof(prefix, type)
}
}
-static
+static void
print_ifclose(indent)
int indent;
{
@@ -236,7 +237,7 @@ print_ifclose(indent)
f_print(fout, " }\n");
}
-static
+static void
print_ifstat(indent, prefix, type, rel, amax, objname, name)
int indent;
char *prefix;
@@ -314,7 +315,7 @@ print_ifstat(indent, prefix, type, rel, amax, objname, name)
}
/* ARGSUSED */
-static
+static void
emit_enum(def)
definition *def;
{
@@ -323,7 +324,7 @@ emit_enum(def)
print_ifclose(1);
}
-static
+static void
emit_program(def)
definition *def;
{
@@ -345,7 +346,7 @@ emit_program(def)
}
-static
+static void
emit_union(def)
definition *def;
{
@@ -407,7 +408,7 @@ emit_union(def)
f_print(fout, "\t}\n");
}
-static
+static void
emit_struct(def)
definition *def;
{
@@ -514,7 +515,7 @@ emit_struct(def)
}
} else {
- if (i > 0)
+ if (i > 0) {
if (sizestr == NULL && size < doinline) {
/* don't expand into inline
* code if size < doinline */
@@ -559,6 +560,7 @@ emit_struct(def)
f_print(fout, "\t }\n");
}
+ }
size = 0;
i = 0;
sizestr = NULL;
@@ -566,7 +568,7 @@ emit_struct(def)
}
}
- if (i > 0)
+ if (i > 0) {
if (sizestr == NULL && size < doinline) {
/* don't expand into inline code if size <
* doinline */
@@ -610,6 +612,7 @@ emit_struct(def)
}
flag = GET;
+ }
}
f_print(fout, "\t return(TRUE);\n\t}\n\n");
@@ -619,7 +622,7 @@ emit_struct(def)
print_stat(1, &dl->decl);
}
-static
+static void
emit_typedef(def)
definition *def;
{
@@ -632,7 +635,7 @@ emit_typedef(def)
print_ifstat(1, prefix, type, rel, amax, "objp", def->def_name);
}
-static
+static void
print_stat(indent, dec)
declaration *dec;
int indent;
@@ -655,6 +658,7 @@ print_stat(indent, dec)
char *upcase __P((char *));
+void
emit_inline(decl, flag)
declaration *decl;
int flag;
@@ -672,10 +676,15 @@ emit_inline(decl, flag)
decl->name, decl->array_max);
emit_single_in_line(decl, flag, REL_VECTOR);
f_print(fout, "\t\t }\n\t\t };\n");
+ case REL_ARRAY:
+ case REL_POINTER:
+ errx(1, "Internal error %s, %d: Case %d not handled\n",
+ __FILE__, __LINE__, decl->rel);
}
}
+void
emit_single_in_line(decl, flag, rel)
declaration *decl;
int flag;
diff --git a/usr.bin/rpcgen/rpc_hout.c b/usr.bin/rpcgen/rpc_hout.c
index fb48cb1aca1..6f1638b90fa 100644
--- a/usr.bin/rpcgen/rpc_hout.c
+++ b/usr.bin/rpcgen/rpc_hout.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rpc_hout.c,v 1.4 1997/07/25 21:05:39 mickey Exp $ */
+/* $OpenBSD: rpc_hout.c,v 1.5 2001/07/17 02:23:59 pvalchev Exp $ */
/* $NetBSD: rpc_hout.c,v 1.4 1995/06/11 21:49:55 pk Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -43,18 +43,18 @@ static char sccsid[] = "@(#)rpc_hout.c 1.12 89/02/22 (C) 1987 SMI";
#include "rpc_parse.h"
#include "rpc_util.h"
-static pconstdef __P((definition *));
-static pargdef __P((definition *));
-static pstructdef __P((definition *));
-static puniondef __P((definition *));
-static pprogramdef __P((definition *));
-static penumdef __P((definition *));
-static ptypedef __P((definition *));
-static pdefine __P((char *, char *));
-static puldefine __P((char *, char *));
-static define_printed __P((proc_list *, version_list *));
-static undefined2 __P((char *, char *));
-static parglist __P((proc_list *, char *));
+static void pconstdef __P((definition *));
+static void pargdef __P((definition *));
+static void pstructdef __P((definition *));
+static void puniondef __P((definition *));
+static void pprogramdef __P((definition *));
+static void penumdef __P((definition *));
+static void ptypedef __P((definition *));
+static void pdefine __P((char *, char *));
+static void puldefine __P((char *, char *));
+static int define_printed __P((proc_list *, version_list *));
+static int undefined2 __P((char *, char *));
+static void parglist __P((proc_list *, char *));
/*
* Print the C-version of an xdr definition
@@ -108,12 +108,19 @@ print_funcdef(def)
f_print(fout, "\n");
pprogramdef(def);
break;
- }
+ case DEF_CONST:
+ case DEF_STRUCT:
+ case DEF_UNION:
+ case DEF_ENUM:
+ case DEF_TYPEDEF:
+ break;
+ }
}
+void
pxdrfuncdecl( name, pointerp )
-char* name;
-int pointerp;
+ char* name;
+ int pointerp;
{
f_print(fout,"#ifdef __cplusplus\n");
@@ -130,7 +137,7 @@ int pointerp;
}
-static
+static void
pconstdef(def)
definition *def;
{
@@ -140,7 +147,7 @@ pconstdef(def)
/* print out the definitions for the arguments of functions in the
header file
*/
-static
+static void
pargdef(def)
definition *def;
{
@@ -173,7 +180,7 @@ pargdef(def)
}
-static
+static void
pstructdef(def)
definition *def;
{
@@ -188,7 +195,7 @@ pstructdef(def)
f_print(fout, "typedef struct %s %s;\n", name, name);
}
-static
+static void
puniondef(def)
definition *def;
{
@@ -217,7 +224,7 @@ puniondef(def)
f_print(fout, "typedef struct %s %s;\n", name, name);
}
-static
+static void
pdefine(name, num)
char *name;
char *num;
@@ -225,7 +232,7 @@ pdefine(name, num)
f_print(fout, "#define %s %s\n", name, num);
}
-static
+static void
puldefine(name, num)
char *name;
char *num;
@@ -233,7 +240,7 @@ puldefine(name, num)
f_print(fout, "#define %s ((u_long)%s)\n", name, num);
}
-static
+static int
define_printed(stop, start)
proc_list *stop;
version_list *start;
@@ -254,7 +261,7 @@ define_printed(stop, start)
/* NOTREACHED */
}
-static
+static void
pprogramdef(def)
definition *def;
{
@@ -309,6 +316,7 @@ pprogramdef(def)
}
}
+void
pprocdef(proc, vp, addargtype, server_p,mode)
proc_list *proc;
version_list *vp;
@@ -335,7 +343,7 @@ pprocdef(proc, vp, addargtype, server_p,mode)
/* print out argument list of procedure */
-static
+static void
parglist(proc, addargtype)
proc_list *proc;
char* addargtype;
@@ -360,7 +368,7 @@ parglist(proc, addargtype)
f_print(fout, "%s);\n", addargtype);
}
-static
+static void
penumdef(def)
definition *def;
{
@@ -392,7 +400,7 @@ penumdef(def)
f_print(fout, "typedef enum %s %s;\n", name, name);
}
-static
+static void
ptypedef(def)
definition *def;
{
@@ -439,6 +447,7 @@ ptypedef(def)
}
}
+void
pdeclaration(name, dec, tab, separator)
char *name;
declaration *dec;
@@ -496,7 +505,7 @@ pdeclaration(name, dec, tab, separator)
f_print(fout, separator );
}
-static
+static int
undefined2(type, stop)
char *type;
char *stop;
diff --git a/usr.bin/rpcgen/rpc_main.c b/usr.bin/rpcgen/rpc_main.c
index 5eb944c0adf..d01691d192e 100644
--- a/usr.bin/rpcgen/rpc_main.c
+++ b/usr.bin/rpcgen/rpc_main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rpc_main.c,v 1.5 2001/01/21 22:02:52 deraadt Exp $ */
+/* $OpenBSD: rpc_main.c,v 1.6 2001/07/17 02:23:59 pvalchev Exp $ */
/* $NetBSD: rpc_main.c,v 1.9 1996/02/19 11:12:43 pk Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -32,7 +32,7 @@
#ifndef lint
static char sccsid[] = "@(#)rpc_main.c 1.30 89/03/30 (C) 1987 SMI";
-static char cvsid[] = "$OpenBSD: rpc_main.c,v 1.5 2001/01/21 22:02:52 deraadt Exp $";
+static char cvsid[] = "$OpenBSD: rpc_main.c,v 1.6 2001/07/17 02:23:59 pvalchev Exp $";
#endif
/*
@@ -44,12 +44,14 @@ static char cvsid[] = "$OpenBSD: rpc_main.c,v 1.5 2001/01/21 22:02:52 deraadt Ex
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <ctype.h>
#include <sys/types.h>
#ifdef __TURBOC__
#define MAXPATHLEN 80
#include <process.h>
#include <dir.h>
#else
+#include <unistd.h>
#include <sys/param.h>
#include <sys/file.h>
#endif
@@ -127,24 +129,31 @@ int tirpcflag = 0; /* generating code for tirpc, by default */
static char *dos_cppfile = NULL;
#endif
-static c_output __P((char *, char *, int, char *));
-static h_output __P((char *, char *, int, char *));
-static s_output __P((int, char **, char *, char *, int, char *, int, int));
-static l_output __P((char *, char *, int, char *));
-static t_output __P((char *, char *, int, char *));
-static svc_output __P((char *, char *, int, char *));
-static clnt_output __P((char *, char *, int, char *));
-static do_registers __P((int, char **));
+static char *extendfile __P((char *, char *));
+static void open_output __P((char *, char *));
+static void add_warning __P((void));
+static void clear_args __P((void));
+static void find_cpp __P((void));
+static void open_input __P((char *, char *));
+static int check_nettype __P((char *, char *[]));
+static void c_output __P((char *, char *, int, char *));
+static void c_initialize __P((void));
+static char *generate_guard __P((char *));
+static void h_output __P((char *, char *, int, char *));
+static void s_output __P((int, char *[], char *, char *, int, char *, int, int));
+static void l_output __P((char *, char *, int, char *));
+static void t_output __P((char *, char *, int, char *));
+static void svc_output __P((char *, char *, int, char *));
+static void clnt_output __P((char *, char *, int, char *));
+static int do_registers __P((int, char *[]));
static void addarg __P((char *));
static void putarg __P((int, char *));
-static void clear_args __P((void));
static void checkfiles __P((char *, char *));
-static int parseargs __P((int, char **, struct commandline *));
-static usage __P((void));
-static options_usage __P((void));
-
-
+static int parseargs __P((int, char *[], struct commandline *));
+static void usage __P((void));
+static void options_usage __P((void));
+int
main(argc, argv)
int argc;
char *argv[];
@@ -248,7 +257,7 @@ extendfile(path, ext)
/*
* Open output file with given extension
*/
-static
+static void
open_output(infile, outfile)
char *infile;
char *outfile;
@@ -274,7 +283,7 @@ open_output(infile, outfile)
}
-static
+static void
add_warning()
{
f_print(fout, "/*\n");
@@ -314,7 +323,7 @@ static void find_cpp()
/*
* Open input file with given define for C-preprocessor
*/
-static
+static void
open_input(infile, define)
char *infile;
char *define;
@@ -432,7 +441,7 @@ char* list_to_check[];
* Compile into an XDR routine output file
*/
-static
+static void
c_output(infile, define, extend, outfile)
char *infile;
char *define;
@@ -465,6 +474,7 @@ c_output(infile, define, extend, outfile)
}
+static void
c_initialize()
{
@@ -514,7 +524,7 @@ char* generate_guard( pathname )
* Compile into an XDR header file
*/
-static
+static void
h_output(infile, define, extend, outfile)
char *infile;
char *define;
@@ -562,7 +572,7 @@ h_output(infile, define, extend, outfile)
/*
* Compile into an RPC service
*/
-static
+static void
s_output(argc, argv, infile, define, extend, outfile, nomain, netflag)
int argc;
char *argv[];
@@ -670,7 +680,7 @@ s_output(argc, argv, infile, define, extend, outfile, nomain, netflag)
/*
* generate client side stubs
*/
-static
+static void
l_output(infile, define, extend, outfile)
char *infile;
char *define;
@@ -706,7 +716,7 @@ l_output(infile, define, extend, outfile)
/*
* generate the dispatch table
*/
-static
+static void
t_output(infile, define, extend, outfile)
char *infile;
char *define;
@@ -732,7 +742,7 @@ t_output(infile, define, extend, outfile)
}
/* sample routine for the server template */
-static
+static void
svc_output(infile, define, extend, outfile)
char *infile;
char *define;
@@ -768,7 +778,7 @@ svc_output(infile, define, extend, outfile)
/* sample main routine for client */
-static
+static void
clnt_output(infile, define, extend, outfile)
char *infile;
char *define;
@@ -810,8 +820,8 @@ clnt_output(infile, define, extend, outfile)
* Perform registrations for service output
* Return 0 if failed; 1 otherwise.
*/
-static
-int do_registers(argc, argv)
+static int
+do_registers(argc, argv)
int argc;
char *argv[];
{
@@ -879,8 +889,8 @@ putarg(where, cp)
static void
checkfiles(infile, outfile)
-char *infile;
-char *outfile;
+ char *infile;
+ char *outfile;
{
struct stat buf;
@@ -915,7 +925,7 @@ parseargs(argc, argv, cmd)
{
int i;
int j;
- char c;
+ int c;
char flag[(1 << 8 * sizeof(char))];
int nflags;
@@ -1110,7 +1120,7 @@ parseargs(argc, argv, cmd)
return (1);
}
-static
+static void
usage()
{
f_print(stderr, "usage: %s infile\n", cmdname);
@@ -1124,7 +1134,7 @@ usage()
exit(1);
}
-static
+static void
options_usage()
{
f_print(stderr, "options:\n");
diff --git a/usr.bin/rpcgen/rpc_parse.c b/usr.bin/rpcgen/rpc_parse.c
index 809d3b16bca..c58fa316f91 100644
--- a/usr.bin/rpcgen/rpc_parse.c
+++ b/usr.bin/rpcgen/rpc_parse.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rpc_parse.c,v 1.2 1996/06/26 05:38:37 deraadt Exp $ */
+/* $OpenBSD: rpc_parse.c,v 1.3 2001/07/17 02:23:59 pvalchev Exp $ */
/* $NetBSD: rpc_parse.c,v 1.5 1995/08/29 23:05:55 cgd Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -48,17 +48,17 @@ static char sccsid[] = "@(#)rpc_parse.c 1.8 89/02/22 (C) 1987 SMI";
#define ARGNAME "arg"
-static isdefined __P((definition *));
-static def_struct __P((definition *));
-static def_program __P((definition *));
-static def_enum __P((definition *));
-static def_const __P((definition *));
-static def_union __P((definition *));
-static def_typedef __P((definition *));
-static get_declaration __P((declaration *, defkind));
-static get_prog_declaration __P((declaration *, defkind, int));
-static get_type __P((char **, char **, defkind));
-static unsigned_dec __P((char **));
+static void isdefined __P((definition *));
+static void def_struct __P((definition *));
+static void def_program __P((definition *));
+static void def_enum __P((definition *));
+static void def_const __P((definition *));
+static void def_union __P((definition *));
+static void def_typedef __P((definition *));
+static void get_declaration __P((declaration *, defkind));
+static void get_prog_declaration __P((declaration *, defkind, int));
+static void get_type __P((char **, char **, defkind));
+static void unsigned_dec __P((char **));
/*
* return the next definition you see
@@ -100,14 +100,14 @@ get_definition()
return (defp);
}
-static
+static void
isdefined(defp)
definition *defp;
{
STOREVAL(&defined, defp);
}
-static
+static void
def_struct(defp)
definition *defp;
{
@@ -135,7 +135,7 @@ def_struct(defp)
*tailp = NULL;
}
-static
+static void
def_program(defp)
definition *defp;
{
@@ -241,7 +241,7 @@ def_program(defp)
}
-static
+static void
def_enum(defp)
definition *defp;
{
@@ -271,7 +271,7 @@ def_enum(defp)
*tailp = NULL;
}
-static
+static void
def_const(defp)
definition *defp;
{
@@ -285,13 +285,13 @@ def_const(defp)
defp->def.co = tok.str;
}
-static
+static void
def_union(defp)
definition *defp;
{
token tok;
declaration dec;
- case_list *cases,*tcase;
+ case_list *cases;
case_list **tailp;
int flag;
@@ -383,9 +383,10 @@ static char* reserved_types[] = {
/* check that the given name is not one that would eventually result in
xdr routines that would conflict with internal XDR routines. */
-static check_type_name( name, new_type )
-int new_type;
-char* name;
+static void
+check_type_name( name, new_type )
+ int new_type;
+ char* name;
{
int i;
char tmp[100];
@@ -408,7 +409,7 @@ char* name;
}
}
-static
+static void
def_typedef(defp)
definition *defp;
{
@@ -424,7 +425,7 @@ def_typedef(defp)
defp->def.ty.array_max = dec.array_max;
}
-static
+static void
get_declaration(dec, dkind)
declaration *dec;
defkind dkind;
@@ -477,7 +478,7 @@ get_declaration(dec, dkind)
}
}
-static
+static void
get_prog_declaration(dec, dkind, num)
declaration *dec;
defkind dkind;
@@ -546,7 +547,7 @@ get_prog_declaration(dec, dkind, num)
-static
+static void
get_type(prefixp, typep, dkind)
char **prefixp;
char **typep;
@@ -598,7 +599,7 @@ get_type(prefixp, typep, dkind)
}
}
-static
+static void
unsigned_dec(typep)
char **typep;
{
diff --git a/usr.bin/rpcgen/rpc_sample.c b/usr.bin/rpcgen/rpc_sample.c
index 3f4ca36a1d0..dd90624de1d 100644
--- a/usr.bin/rpcgen/rpc_sample.c
+++ b/usr.bin/rpcgen/rpc_sample.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rpc_sample.c,v 1.3 1997/11/15 22:10:53 deraadt Exp $ */
+/* $OpenBSD: rpc_sample.c,v 1.4 2001/07/17 02:23:59 pvalchev Exp $ */
/* $NetBSD: rpc_sample.c,v 1.2 1995/06/11 21:50:01 pk Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -42,15 +42,16 @@ static char sccsid[] = "@(#)rpc_sample.c 1.1 90/08/30 (C) 1987 SMI";
#include <sys/cdefs.h>
#include <stdio.h>
#include <string.h>
+#include "rpc_scan.h"
#include "rpc_parse.h"
#include "rpc_util.h"
static char RQSTP[] = "rqstp";
void printarglist();
-static write_sample_client __P((char *, version_list *));
-static write_sample_server __P((definition *));
-static return_type __P((proc_list *));
+static void write_sample_client __P((char *, version_list *));
+static void write_sample_server __P((definition *));
+static void return_type __P((proc_list *));
void
write_sample_svc(def)
@@ -81,7 +82,7 @@ write_sample_clnt(def)
}
-static
+static void
write_sample_client(program_name, vp )
char* program_name;
version_list *vp;
@@ -164,7 +165,7 @@ write_sample_client(program_name, vp )
f_print(fout, "}\n");
}
-static
+static void
write_sample_server(def)
definition *def;
{
@@ -184,11 +185,11 @@ write_sample_server(def)
f_print(fout, "{\n");
f_print(fout, "\n\tstatic ");
- if( !streq( proc->res_type, "void") )
- return_type(proc);
+ if(streq( proc->res_type, "void"))
+ f_print(fout, "char*"); /* cannot have void type */
else
- f_print(fout, "char*" ); /* cannot have void type */
- f_print(fout, " result;\n", proc->res_type);
+ return_type(proc);
+ f_print(fout, " result;\n");
f_print(fout,
"\n\t/*\n\t * insert server code here\n\t */\n\n");
if( !streq( proc->res_type, "void") )
@@ -203,13 +204,14 @@ write_sample_server(def)
}
}
-static
+static void
return_type(plist)
proc_list *plist;
{
ptype( plist->res_prefix, plist->res_type, 1 );
}
+void
add_sample_msg()
{
f_print(fout, "/*\n");
diff --git a/usr.bin/rpcgen/rpc_scan.c b/usr.bin/rpcgen/rpc_scan.c
index e6082295386..4ff702b372a 100644
--- a/usr.bin/rpcgen/rpc_scan.c
+++ b/usr.bin/rpcgen/rpc_scan.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rpc_scan.c,v 1.2 1996/06/26 05:38:39 deraadt Exp $ */
+/* $OpenBSD: rpc_scan.c,v 1.3 2001/07/17 02:23:59 pvalchev Exp $ */
/* $NetBSD: rpc_scan.c,v 1.4 1995/06/11 21:50:02 pk Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -47,15 +47,15 @@ static char sccsid[] = "@(#)rpc_scan.c 1.11 89/02/22 (C) 1987 SMI";
#include "rpc_parse.h"
#include "rpc_util.h"
-static unget_token __P((token *tokp));
-static findstrconst __P((char **, char **));
-static findchrconst __P((char **, char **));
-static findconst __P((char **, char **));
-static findkind __P((char **, token *));
-static cppline __P((char *));
-static directive __P((char *));
-static printdirective __P((char *));
-static docppline __P((char *, int *, char **));
+static void unget_token __P((token *tokp));
+static void findstrconst __P((char **, char **));
+static void findchrconst __P((char **, char **));
+static void findconst __P((char **, char **));
+static void findkind __P((char **, token *));
+static int cppline __P((char *));
+static int directive __P((char *));
+static void printdirective __P((char *));
+static void docppline __P((char *, int *, char **));
#define startcomment(where) (where[0] == '/' && where[1] == '*')
#define endcomment(where) (where[-1] == '*' && where[0] == '/')
@@ -308,7 +308,7 @@ get_token(tokp)
}
}
-static
+static void
unget_token(tokp)
token *tokp;
{
@@ -316,7 +316,7 @@ unget_token(tokp)
pushed = 1;
}
-static
+static void
findstrconst(str, val)
char **str;
char **val;
@@ -326,7 +326,7 @@ findstrconst(str, val)
p = *str;
do {
- *p++;
+ p++;
} while (*p && *p != '"');
if (*p == 0) {
error("unterminated string constant");
@@ -339,7 +339,7 @@ findstrconst(str, val)
*str = p;
}
-static
+static void
findchrconst(str, val)
char **str;
char **val;
@@ -349,7 +349,7 @@ findchrconst(str, val)
p = *str;
do {
- *p++;
+ p++;
} while (*p && *p != '\'');
if (*p == 0) {
error("unterminated string constant");
@@ -365,7 +365,7 @@ findchrconst(str, val)
*str = p;
}
-static
+static void
findconst(str, val)
char **str;
char **val;
@@ -416,7 +416,7 @@ static token symbols[] = {
{TOK_EOF, "??????"},
};
-static
+static void
findkind(mark, tokp)
char **mark;
token *tokp;
@@ -445,28 +445,28 @@ findkind(mark, tokp)
*mark = str + len;
}
-static
+static int
cppline(line)
char *line;
{
return (line == curline && *line == '#');
}
-static
+static int
directive(line)
char *line;
{
return (line == curline && *line == '%');
}
-static
+static void
printdirective(line)
char *line;
{
f_print(fout, "%s", line + 1);
}
-static
+static void
docppline(line, lineno, fname)
char *line;
int *lineno;
diff --git a/usr.bin/rpcgen/rpc_svcout.c b/usr.bin/rpcgen/rpc_svcout.c
index e127e2d5cf7..2b492cfd983 100644
--- a/usr.bin/rpcgen/rpc_svcout.c
+++ b/usr.bin/rpcgen/rpc_svcout.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rpc_svcout.c,v 1.3 2001/01/11 19:24:24 deraadt Exp $ */
+/* $OpenBSD: rpc_svcout.c,v 1.4 2001/07/17 02:23:59 pvalchev Exp $ */
/* $NetBSD: rpc_svcout.c,v 1.7 1995/06/24 14:59:59 pk Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -40,6 +40,7 @@
#include <sys/cdefs.h>
#include <stdio.h>
#include <string.h>
+#include "rpc_scan.h"
#include "rpc_parse.h"
#include "rpc_util.h"
@@ -51,22 +52,22 @@ static char ROUTINE[] = "local";
char _errbuf[256]; /* For all messages */
-void internal_proctype __P((proc_list *));
-static write_real_program __P((definition *));
-static write_program __P((definition *, char *));
-static printerr __P((char *, char *));
-static printif __P((char *, char *, char *, char *));
-static write_inetmost __P((char *));
-static print_return __P((char *));
-static print_pmapunset __P((char *));
-static print_err_message __P((char *));
-static write_timeout_func __P((void));
-static write_pm_most __P((char *, int));
-static write_caller_func __P((void));
-static write_rpc_svc_fg __P((char *, char *));
-static open_log_file __P((char *, char *));
-
-static
+static void internal_proctype __P((proc_list *));
+static void write_real_program __P((definition *));
+static void write_program __P((definition *, char *));
+static void printerr __P((char *, char *));
+static void printif __P((char *, char *, char *, char *));
+static void write_inetmost __P((char *));
+static void print_return __P((char *));
+static void print_pmapunset __P((char *));
+static void print_err_message __P((char *));
+static void write_timeout_func __P((void));
+static void write_pm_most __P((char *, int));
+static void write_caller_func __P((void));
+static void write_rpc_svc_fg __P((char *, char *));
+static void open_log_file __P((char *, char *));
+
+static void
p_xdrfunc( rname, typename )
char* rname;
char* typename;
@@ -78,7 +79,7 @@ char* typename;
f_print(fout, "\t\txdr_%s = xdr_%s;\n", rname, stringfix(typename) );
}
-void
+static void
internal_proctype(plist)
proc_list *plist;
{
@@ -168,7 +169,7 @@ write_netid_register(transp)
f_print(fout, "%s\t\texit(1);\n", sp);
f_print(fout, "%s\t}\n", sp);
f_print(fout, "%s\t%s = svc_tli_create(RPC_ANYFD, nconf, 0, 0, 0);\n",
- sp, TRANSP, transp);
+ sp, TRANSP);
f_print(fout, "%s\tif (%s == NULL) {\n", sp, TRANSP);
(void) sprintf(_errbuf, "cannot create %s service.", transp);
print_err_message(tmpbuf);
@@ -290,7 +291,7 @@ write_programs(storage)
which calls server's defintion of actual function (e.g. printmsg_1(...)).
Unpacks single user argument of printmsg_1 to call-by-value format
expected by printmsg_1. */
-static
+static void
write_real_program(def)
definition *def;
{
@@ -345,7 +346,7 @@ write_real_program(def)
}
}
-static
+static void
write_program(def, storage)
definition *def;
char *storage;
@@ -488,7 +489,7 @@ write_program(def, storage)
}
}
-static
+static void
printerr(err, transp)
char *err;
char *transp;
@@ -496,7 +497,7 @@ printerr(err, transp)
f_print(fout, "\t\tsvcerr_%s(%s);\n", err, transp);
}
-static
+static void
printif(proc, transp, prefix, arg)
char *proc;
char *transp;
@@ -507,6 +508,7 @@ printif(proc, transp, prefix, arg)
proc, transp, arg, prefix, arg);
}
+int
nullproc(proc)
proc_list *proc;
{
@@ -518,7 +520,7 @@ nullproc(proc)
return (0);
}
-static
+static void
write_inetmost(infile)
char *infile;
{
@@ -547,7 +549,7 @@ write_inetmost(infile)
f_print(fout, "\t}\n");
}
-static
+static void
print_return(space)
char *space;
{
@@ -560,7 +562,7 @@ print_return(space)
}
}
-static
+static void
print_pmapunset(space)
char *space;
{
@@ -580,7 +582,7 @@ print_pmapunset(space)
}
}
-static
+static void
print_err_message(space)
char *space;
{
@@ -611,6 +613,7 @@ write_svc_aux( nomain )
* Write the _msgout function
*/
+void
write_msg_out()
{
f_print(fout, "\n");
@@ -637,7 +640,7 @@ write_msg_out()
/*
* Write the timeout function
*/
-static
+static void
write_timeout_func()
{
if (!timerflag)
@@ -667,7 +670,7 @@ write_timeout_func()
f_print(fout, "}\n");
}
-static
+static void
write_caller_func() /*EVAS*/
{
#define P(s) f_print(fout, s);
@@ -705,7 +708,7 @@ P("}\n");
/*
* Write the most of port monitor support
*/
-static
+static void
write_pm_most(infile, netflag)
char *infile;
int netflag;
@@ -792,7 +795,7 @@ write_pm_most(infile, netflag)
/*
* Support for backgrounding the server if self started.
*/
-static
+static void
write_rpc_svc_fg(infile, sp)
char *infile;
char *sp;
@@ -843,7 +846,7 @@ write_rpc_svc_fg(infile, sp)
open_log_file(infile, sp);
}
-static
+static void
open_log_file(infile, sp)
char *infile;
char *sp;
diff --git a/usr.bin/rpcgen/rpc_tblout.c b/usr.bin/rpcgen/rpc_tblout.c
index 6218104a570..8e4bd706cfd 100644
--- a/usr.bin/rpcgen/rpc_tblout.c
+++ b/usr.bin/rpcgen/rpc_tblout.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rpc_tblout.c,v 1.2 1996/06/26 05:38:41 deraadt Exp $ */
+/* $OpenBSD: rpc_tblout.c,v 1.3 2001/07/17 02:23:59 pvalchev Exp $ */
/* $NetBSD: rpc_tblout.c,v 1.3 1995/06/24 15:00:15 pk Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -39,7 +39,9 @@ static char sccsid[] = "@(#)rpc_tblout.c 1.4 89/02/22 (C) 1988 SMI";
*/
#include <sys/cdefs.h>
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
+#include "rpc_scan.h"
#include "rpc_parse.h"
#include "rpc_util.h"
@@ -58,8 +60,8 @@ static char null_entry[] = "\n\t(char *(*)())0,\n\
static char tbl_nproc[] = "int %s_nproc =\n\tsizeof(%s_table)/sizeof(%s_table[0]);\n\n";
-static write_table __P((definition *));
-static printit __P((char *, char *));
+static void write_table __P((definition *));
+static void printit __P((char *, char *));
void
write_tables()
@@ -76,7 +78,7 @@ write_tables()
}
}
-static
+static void
write_table(def)
definition *def;
{
@@ -143,7 +145,7 @@ write_table(def)
}
}
-static
+static void
printit(prefix, type)
char *prefix;
char *type;
diff --git a/usr.bin/rpcgen/rpc_util.c b/usr.bin/rpcgen/rpc_util.c
index e71ac973466..9d646f687a8 100644
--- a/usr.bin/rpcgen/rpc_util.c
+++ b/usr.bin/rpcgen/rpc_util.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rpc_util.c,v 1.2 1996/06/26 05:38:41 deraadt Exp $ */
+/* $OpenBSD: rpc_util.c,v 1.3 2001/07/17 02:23:59 pvalchev Exp $ */
/* $NetBSD: rpc_util.c,v 1.6 1995/08/29 23:05:57 cgd Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -41,6 +41,7 @@ static char sccsid[] = "@(#)rpc_util.c 1.11 89/02/22 (C) 1987 SMI";
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
#include <ctype.h>
#include "rpc_scan.h"
#include "rpc_parse.h"
@@ -68,6 +69,7 @@ list *defined; /* list of defined things */
/*
* Reinitialize the world
*/
+void
reinitialize()
{
memset(curline, 0, MAXLINESIZE);
@@ -79,6 +81,7 @@ reinitialize()
/*
* string equality
*/
+int
streq(a, b)
char *a;
char *b;
@@ -124,7 +127,7 @@ storeval(lstp, val)
*l = lst;
}
-static
+static int
findit(def, type)
definition *def;
char *type;
@@ -193,7 +196,7 @@ ptype(prefix, type, follow)
}
}
-static
+static int
typedefed(def, type)
definition *def;
char *type;
@@ -205,6 +208,7 @@ typedefed(def, type)
}
}
+int
isvectordef(type, rel)
char *type;
relation rel;
@@ -278,6 +282,7 @@ error(msg)
* Something went wrong, unlink any files that we may have created and then
* die.
*/
+void
crash()
{
int i;
@@ -400,7 +405,7 @@ toktostr(kind)
return (sp->str);
}
-static
+static void
printbuf()
{
char c;
@@ -409,7 +414,7 @@ printbuf()
# define TABSIZE 4
- for (i = 0; c = curline[i]; i++) {
+ for (i = 0; (c = curline[i]) != '\0'; i++) {
if (c == '\t') {
cnt = 8 - (i % TABSIZE);
c = ' ';
diff --git a/usr.bin/rpcgen/rpc_util.h b/usr.bin/rpcgen/rpc_util.h
index 42d4648540d..3ee9f738988 100644
--- a/usr.bin/rpcgen/rpc_util.h
+++ b/usr.bin/rpcgen/rpc_util.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: rpc_util.h,v 1.3 1997/10/11 21:10:42 deraadt Exp $ */
+/* $OpenBSD: rpc_util.h,v 1.4 2001/07/17 02:23:59 pvalchev Exp $ */
/* $NetBSD: rpc_util.h,v 1.3 1995/06/11 21:50:10 pk Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -104,6 +104,7 @@ definition *findval();
#define FINDVAL(list,item,finder) \
findval(list, item, finder)
+void reinitialize __P((void));
char *fixtype __P((char *));
char *stringfix __P((char *));
char *locase __P((char *));
@@ -113,20 +114,28 @@ void ptype __P((char *, char *, int));
int isvectordef __P((char *, relation));
int streq __P((char *, char *));
void error __P((char *));
+void crash __P((void));
void tabify __P((FILE *, int));
void record_open __P((char *));
bas_type *find_type __P((char *));
char *make_argname __P((char *, char *));
+void add_type __P((int, char *));
/*
* rpc_cout routines
*/
void emit __P((definition *));
+void emit_inline __P((declaration *, int));
+void emit_single_in_line __P((declaration *, int, relation));
+char *upcase __P((char *));
/*
* rpc_hout routines
*/
void print_datadef __P((definition *));
void print_funcdef __P((definition *));
+void pxdrfuncdecl __P((char *, int));
+void pprocdef __P((proc_list *, version_list *, char *, int, int));
+void pdeclaration __P((char *, declaration *, int, char *));
/*
* rpc_svcout routines
@@ -134,7 +143,9 @@ void print_funcdef __P((definition *));
void write_most __P((char *, int, int));
void write_rest __P((void));
void write_programs __P((char *));
+int nullproc __P((proc_list *));
void write_svc_aux __P((int));
+void write_msg_out __P((void));
void write_inetd_register __P((char *));
void write_netid_register __P((char *));
void write_nettype_register __P((char *));
@@ -155,4 +166,5 @@ void write_tables __P((void));
*/
void write_sample_svc __P((definition *));
int write_sample_clnt __P((definition *));
+void add_sample_msg __P((void));
void write_sample_clnt_main __P((void));