diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2001-07-18 22:26:01 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2001-07-18 22:26:01 +0000 |
commit | 2a73d8edb2be731bc3a885f71bc315e06a3c1598 (patch) | |
tree | 95857f8e7acaba4fdb9457173d6a6630b8f11536 /usr.bin | |
parent | dbf58eafcd9b0edb160c6680606b3907e1b50404 (diff) |
Uhmm, nope, this broke everything
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/rpcgen/rpc_clntout.c | 9 | ||||
-rw-r--r-- | usr.bin/rpcgen/rpc_cout.c | 95 | ||||
-rw-r--r-- | usr.bin/rpcgen/rpc_hout.c | 65 | ||||
-rw-r--r-- | usr.bin/rpcgen/rpc_main.c | 76 | ||||
-rw-r--r-- | usr.bin/rpcgen/rpc_parse.c | 55 | ||||
-rw-r--r-- | usr.bin/rpcgen/rpc_sample.c | 24 | ||||
-rw-r--r-- | usr.bin/rpcgen/rpc_scan.c | 42 | ||||
-rw-r--r-- | usr.bin/rpcgen/rpc_svcout.c | 67 | ||||
-rw-r--r-- | usr.bin/rpcgen/rpc_tblout.c | 12 | ||||
-rw-r--r-- | usr.bin/rpcgen/rpc_util.c | 15 | ||||
-rw-r--r-- | usr.bin/rpcgen/rpc_util.h | 14 |
11 files changed, 212 insertions, 262 deletions
diff --git a/usr.bin/rpcgen/rpc_clntout.c b/usr.bin/rpcgen/rpc_clntout.c index 6143aa33f60..bedeb643c72 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.4 2001/07/17 02:23:59 pvalchev Exp $ */ +/* $OpenBSD: rpc_clntout.c,v 1.5 2001/07/18 22:26:00 deraadt 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,9 +44,11 @@ static char sccsid[] = "@(#)rpc_clntout.c 1.11 89/02/22 (C) 1987 SMI"; #include "rpc_parse.h" #include "rpc_util.h" -static void write_program __P((definition *)); +static write_program __P((definition *)); static void printbody __P((proc_list *)); +extern pdeclaration(); + #define DEFAULT_TIMEOUT 25 /* in seconds */ static char RESULT[] = "clnt_res"; @@ -69,7 +71,7 @@ write_stubs() } } -static void +static write_program(def) definition *def; { @@ -163,6 +165,7 @@ 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 48f14d9c151..6411c09fb8e 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.5 2001/07/17 02:23:59 pvalchev Exp $ */ +/* $OpenBSD: rpc_cout.c,v 1.6 2001/07/18 22:26:00 deraadt 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,28 +41,27 @@ 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 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 *)); +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 *)); /* @@ -102,16 +101,11 @@ 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 int +static findtype(def, type) definition *def; char *type; @@ -124,7 +118,7 @@ findtype(def, type) } } -static int +static undefined(type) char *type; { @@ -136,7 +130,7 @@ undefined(type) return (def == NULL); } -static void +static print_generic_header(procname, pointerp) char *procname; int pointerp; @@ -160,11 +154,16 @@ print_generic_header(procname, pointerp) } } -static void +static 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)); @@ -179,14 +178,14 @@ print_header(def) } -static void +static print_prog_header(plist) proc_list *plist; { print_generic_header(plist->args.argname, 1); } -static void +static print_trailer() { f_print(fout, "\treturn (TRUE);\n"); @@ -194,7 +193,7 @@ print_trailer() } -static void +static print_ifopen(indent, name) int indent; char *name; @@ -203,14 +202,14 @@ print_ifopen(indent, name) f_print(fout, " if (!xdr_%s(xdrs", name); } -static void +static print_ifarg(arg) char *arg; { f_print(fout, ", %s", arg); } -static void +static print_ifsizeof(prefix, type) char *prefix; char *type; @@ -226,7 +225,7 @@ print_ifsizeof(prefix, type) } } -static void +static print_ifclose(indent) int indent; { @@ -237,7 +236,7 @@ print_ifclose(indent) f_print(fout, " }\n"); } -static void +static print_ifstat(indent, prefix, type, rel, amax, objname, name) int indent; char *prefix; @@ -315,7 +314,7 @@ print_ifstat(indent, prefix, type, rel, amax, objname, name) } /* ARGSUSED */ -static void +static emit_enum(def) definition *def; { @@ -324,7 +323,7 @@ emit_enum(def) print_ifclose(1); } -static void +static emit_program(def) definition *def; { @@ -346,7 +345,7 @@ emit_program(def) } -static void +static emit_union(def) definition *def; { @@ -408,7 +407,7 @@ emit_union(def) f_print(fout, "\t}\n"); } -static void +static emit_struct(def) definition *def; { @@ -515,7 +514,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 */ @@ -560,7 +559,6 @@ emit_struct(def) f_print(fout, "\t }\n"); } - } size = 0; i = 0; sizestr = NULL; @@ -568,7 +566,7 @@ emit_struct(def) } } - if (i > 0) { + if (i > 0) if (sizestr == NULL && size < doinline) { /* don't expand into inline code if size < * doinline */ @@ -612,7 +610,6 @@ emit_struct(def) } flag = GET; - } } f_print(fout, "\t return(TRUE);\n\t}\n\n"); @@ -622,7 +619,7 @@ emit_struct(def) print_stat(1, &dl->decl); } -static void +static emit_typedef(def) definition *def; { @@ -635,7 +632,7 @@ emit_typedef(def) print_ifstat(1, prefix, type, rel, amax, "objp", def->def_name); } -static void +static print_stat(indent, dec) declaration *dec; int indent; @@ -658,7 +655,6 @@ print_stat(indent, dec) char *upcase __P((char *)); -void emit_inline(decl, flag) declaration *decl; int flag; @@ -676,15 +672,10 @@ 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 6f1638b90fa..f705e4c5f3c 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.5 2001/07/17 02:23:59 pvalchev Exp $ */ +/* $OpenBSD: rpc_hout.c,v 1.6 2001/07/18 22:26:00 deraadt 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 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 *)); +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 *)); /* * Print the C-version of an xdr definition @@ -108,19 +108,12 @@ 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"); @@ -137,7 +130,7 @@ pxdrfuncdecl( name, pointerp ) } -static void +static pconstdef(def) definition *def; { @@ -147,7 +140,7 @@ pconstdef(def) /* print out the definitions for the arguments of functions in the header file */ -static void +static pargdef(def) definition *def; { @@ -180,7 +173,7 @@ pargdef(def) } -static void +static pstructdef(def) definition *def; { @@ -195,7 +188,7 @@ pstructdef(def) f_print(fout, "typedef struct %s %s;\n", name, name); } -static void +static puniondef(def) definition *def; { @@ -224,7 +217,7 @@ puniondef(def) f_print(fout, "typedef struct %s %s;\n", name, name); } -static void +static pdefine(name, num) char *name; char *num; @@ -232,7 +225,7 @@ pdefine(name, num) f_print(fout, "#define %s %s\n", name, num); } -static void +static puldefine(name, num) char *name; char *num; @@ -240,7 +233,7 @@ puldefine(name, num) f_print(fout, "#define %s ((u_long)%s)\n", name, num); } -static int +static define_printed(stop, start) proc_list *stop; version_list *start; @@ -261,7 +254,7 @@ define_printed(stop, start) /* NOTREACHED */ } -static void +static pprogramdef(def) definition *def; { @@ -316,7 +309,6 @@ pprogramdef(def) } } -void pprocdef(proc, vp, addargtype, server_p,mode) proc_list *proc; version_list *vp; @@ -343,7 +335,7 @@ pprocdef(proc, vp, addargtype, server_p,mode) /* print out argument list of procedure */ -static void +static parglist(proc, addargtype) proc_list *proc; char* addargtype; @@ -368,7 +360,7 @@ parglist(proc, addargtype) f_print(fout, "%s);\n", addargtype); } -static void +static penumdef(def) definition *def; { @@ -400,7 +392,7 @@ penumdef(def) f_print(fout, "typedef enum %s %s;\n", name, name); } -static void +static ptypedef(def) definition *def; { @@ -447,7 +439,6 @@ ptypedef(def) } } -void pdeclaration(name, dec, tab, separator) char *name; declaration *dec; @@ -505,7 +496,7 @@ pdeclaration(name, dec, tab, separator) f_print(fout, separator ); } -static int +static undefined2(type, stop) char *type; char *stop; diff --git a/usr.bin/rpcgen/rpc_main.c b/usr.bin/rpcgen/rpc_main.c index d01691d192e..327051bf9c7 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.6 2001/07/17 02:23:59 pvalchev Exp $ */ +/* $OpenBSD: rpc_main.c,v 1.7 2001/07/18 22:26:00 deraadt 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.6 2001/07/17 02:23:59 pvalchev Exp $"; +static char cvsid[] = "$OpenBSD: rpc_main.c,v 1.7 2001/07/18 22:26:00 deraadt Exp $"; #endif /* @@ -44,14 +44,12 @@ static char cvsid[] = "$OpenBSD: rpc_main.c,v 1.6 2001/07/17 02:23:59 pvalchev E #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 @@ -129,31 +127,24 @@ int tirpcflag = 0; /* generating code for tirpc, by default */ static char *dos_cppfile = NULL; #endif -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 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 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 void usage __P((void)); -static void options_usage __P((void)); +static int parseargs __P((int, char **, struct commandline *)); +static usage __P((void)); +static options_usage __P((void)); + + -int main(argc, argv) int argc; char *argv[]; @@ -257,7 +248,7 @@ extendfile(path, ext) /* * Open output file with given extension */ -static void +static open_output(infile, outfile) char *infile; char *outfile; @@ -283,7 +274,7 @@ open_output(infile, outfile) } -static void +static add_warning() { f_print(fout, "/*\n"); @@ -323,7 +314,7 @@ static void find_cpp() /* * Open input file with given define for C-preprocessor */ -static void +static open_input(infile, define) char *infile; char *define; @@ -441,7 +432,7 @@ char* list_to_check[]; * Compile into an XDR routine output file */ -static void +static c_output(infile, define, extend, outfile) char *infile; char *define; @@ -474,7 +465,6 @@ c_output(infile, define, extend, outfile) } -static void c_initialize() { @@ -524,7 +514,7 @@ char* generate_guard( pathname ) * Compile into an XDR header file */ -static void +static h_output(infile, define, extend, outfile) char *infile; char *define; @@ -572,7 +562,7 @@ h_output(infile, define, extend, outfile) /* * Compile into an RPC service */ -static void +static s_output(argc, argv, infile, define, extend, outfile, nomain, netflag) int argc; char *argv[]; @@ -680,7 +670,7 @@ s_output(argc, argv, infile, define, extend, outfile, nomain, netflag) /* * generate client side stubs */ -static void +static l_output(infile, define, extend, outfile) char *infile; char *define; @@ -716,7 +706,7 @@ l_output(infile, define, extend, outfile) /* * generate the dispatch table */ -static void +static t_output(infile, define, extend, outfile) char *infile; char *define; @@ -742,7 +732,7 @@ t_output(infile, define, extend, outfile) } /* sample routine for the server template */ -static void +static svc_output(infile, define, extend, outfile) char *infile; char *define; @@ -778,7 +768,7 @@ svc_output(infile, define, extend, outfile) /* sample main routine for client */ -static void +static clnt_output(infile, define, extend, outfile) char *infile; char *define; @@ -820,8 +810,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[]; { @@ -889,8 +879,8 @@ putarg(where, cp) static void checkfiles(infile, outfile) - char *infile; - char *outfile; +char *infile; +char *outfile; { struct stat buf; @@ -925,7 +915,7 @@ parseargs(argc, argv, cmd) { int i; int j; - int c; + char c; char flag[(1 << 8 * sizeof(char))]; int nflags; @@ -1120,7 +1110,7 @@ parseargs(argc, argv, cmd) return (1); } -static void +static usage() { f_print(stderr, "usage: %s infile\n", cmdname); @@ -1134,7 +1124,7 @@ usage() exit(1); } -static void +static options_usage() { f_print(stderr, "options:\n"); diff --git a/usr.bin/rpcgen/rpc_parse.c b/usr.bin/rpcgen/rpc_parse.c index c58fa316f91..3e16e172267 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.3 2001/07/17 02:23:59 pvalchev Exp $ */ +/* $OpenBSD: rpc_parse.c,v 1.4 2001/07/18 22:26:00 deraadt 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 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 **)); +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 **)); /* * return the next definition you see @@ -100,14 +100,14 @@ get_definition() return (defp); } -static void +static isdefined(defp) definition *defp; { STOREVAL(&defined, defp); } -static void +static def_struct(defp) definition *defp; { @@ -135,7 +135,7 @@ def_struct(defp) *tailp = NULL; } -static void +static def_program(defp) definition *defp; { @@ -241,7 +241,7 @@ def_program(defp) } -static void +static def_enum(defp) definition *defp; { @@ -271,7 +271,7 @@ def_enum(defp) *tailp = NULL; } -static void +static def_const(defp) definition *defp; { @@ -285,13 +285,13 @@ def_const(defp) defp->def.co = tok.str; } -static void +static def_union(defp) definition *defp; { token tok; declaration dec; - case_list *cases; + case_list *cases,*tcase; case_list **tailp; int flag; @@ -383,10 +383,9 @@ 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 void -check_type_name( name, new_type ) - int new_type; - char* name; +static check_type_name( name, new_type ) +int new_type; +char* name; { int i; char tmp[100]; @@ -409,7 +408,7 @@ check_type_name( name, new_type ) } } -static void +static def_typedef(defp) definition *defp; { @@ -425,7 +424,7 @@ def_typedef(defp) defp->def.ty.array_max = dec.array_max; } -static void +static get_declaration(dec, dkind) declaration *dec; defkind dkind; @@ -478,7 +477,7 @@ get_declaration(dec, dkind) } } -static void +static get_prog_declaration(dec, dkind, num) declaration *dec; defkind dkind; @@ -547,7 +546,7 @@ get_prog_declaration(dec, dkind, num) -static void +static get_type(prefixp, typep, dkind) char **prefixp; char **typep; @@ -599,7 +598,7 @@ get_type(prefixp, typep, dkind) } } -static void +static unsigned_dec(typep) char **typep; { diff --git a/usr.bin/rpcgen/rpc_sample.c b/usr.bin/rpcgen/rpc_sample.c index dd90624de1d..37e47ae4d38 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.4 2001/07/17 02:23:59 pvalchev Exp $ */ +/* $OpenBSD: rpc_sample.c,v 1.5 2001/07/18 22:26:00 deraadt 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,16 +42,15 @@ 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 void write_sample_client __P((char *, version_list *)); -static void write_sample_server __P((definition *)); -static void return_type __P((proc_list *)); +static write_sample_client __P((char *, version_list *)); +static write_sample_server __P((definition *)); +static return_type __P((proc_list *)); void write_sample_svc(def) @@ -82,7 +81,7 @@ write_sample_clnt(def) } -static void +static write_sample_client(program_name, vp ) char* program_name; version_list *vp; @@ -165,7 +164,7 @@ write_sample_client(program_name, vp ) f_print(fout, "}\n"); } -static void +static write_sample_server(def) definition *def; { @@ -185,11 +184,11 @@ write_sample_server(def) f_print(fout, "{\n"); f_print(fout, "\n\tstatic "); - if(streq( proc->res_type, "void")) - f_print(fout, "char*"); /* cannot have void type */ - else + if( !streq( proc->res_type, "void") ) return_type(proc); - f_print(fout, " result;\n"); + else + f_print(fout, "char*" ); /* cannot have void type */ + f_print(fout, " result;\n", proc->res_type); f_print(fout, "\n\t/*\n\t * insert server code here\n\t */\n\n"); if( !streq( proc->res_type, "void") ) @@ -204,14 +203,13 @@ write_sample_server(def) } } -static void +static 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 4ff702b372a..7b60cf6c70e 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.3 2001/07/17 02:23:59 pvalchev Exp $ */ +/* $OpenBSD: rpc_scan.c,v 1.4 2001/07/18 22:26:00 deraadt 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 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 **)); +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 **)); #define startcomment(where) (where[0] == '/' && where[1] == '*') #define endcomment(where) (where[-1] == '*' && where[0] == '/') @@ -308,7 +308,7 @@ get_token(tokp) } } -static void +static unget_token(tokp) token *tokp; { @@ -316,7 +316,7 @@ unget_token(tokp) pushed = 1; } -static void +static 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 void +static 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 void +static findconst(str, val) char **str; char **val; @@ -416,7 +416,7 @@ static token symbols[] = { {TOK_EOF, "??????"}, }; -static void +static findkind(mark, tokp) char **mark; token *tokp; @@ -445,28 +445,28 @@ findkind(mark, tokp) *mark = str + len; } -static int +static cppline(line) char *line; { return (line == curline && *line == '#'); } -static int +static directive(line) char *line; { return (line == curline && *line == '%'); } -static void +static printdirective(line) char *line; { f_print(fout, "%s", line + 1); } -static void +static 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 2b492cfd983..0e6bf01665a 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.4 2001/07/17 02:23:59 pvalchev Exp $ */ +/* $OpenBSD: rpc_svcout.c,v 1.5 2001/07/18 22:26:00 deraadt 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,7 +40,6 @@ #include <sys/cdefs.h> #include <stdio.h> #include <string.h> -#include "rpc_scan.h" #include "rpc_parse.h" #include "rpc_util.h" @@ -52,22 +51,22 @@ static char ROUTINE[] = "local"; char _errbuf[256]; /* For all messages */ -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 +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 p_xdrfunc( rname, typename ) char* rname; char* typename; @@ -79,7 +78,7 @@ char* typename; f_print(fout, "\t\txdr_%s = xdr_%s;\n", rname, stringfix(typename) ); } -static void +void internal_proctype(plist) proc_list *plist; { @@ -169,7 +168,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); + sp, TRANSP, transp); f_print(fout, "%s\tif (%s == NULL) {\n", sp, TRANSP); (void) sprintf(_errbuf, "cannot create %s service.", transp); print_err_message(tmpbuf); @@ -291,7 +290,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 void +static write_real_program(def) definition *def; { @@ -346,7 +345,7 @@ write_real_program(def) } } -static void +static write_program(def, storage) definition *def; char *storage; @@ -489,7 +488,7 @@ write_program(def, storage) } } -static void +static printerr(err, transp) char *err; char *transp; @@ -497,7 +496,7 @@ printerr(err, transp) f_print(fout, "\t\tsvcerr_%s(%s);\n", err, transp); } -static void +static printif(proc, transp, prefix, arg) char *proc; char *transp; @@ -508,7 +507,6 @@ printif(proc, transp, prefix, arg) proc, transp, arg, prefix, arg); } -int nullproc(proc) proc_list *proc; { @@ -520,7 +518,7 @@ nullproc(proc) return (0); } -static void +static write_inetmost(infile) char *infile; { @@ -549,7 +547,7 @@ write_inetmost(infile) f_print(fout, "\t}\n"); } -static void +static print_return(space) char *space; { @@ -562,7 +560,7 @@ print_return(space) } } -static void +static print_pmapunset(space) char *space; { @@ -582,7 +580,7 @@ print_pmapunset(space) } } -static void +static print_err_message(space) char *space; { @@ -613,7 +611,6 @@ write_svc_aux( nomain ) * Write the _msgout function */ -void write_msg_out() { f_print(fout, "\n"); @@ -640,7 +637,7 @@ write_msg_out() /* * Write the timeout function */ -static void +static write_timeout_func() { if (!timerflag) @@ -670,7 +667,7 @@ write_timeout_func() f_print(fout, "}\n"); } -static void +static write_caller_func() /*EVAS*/ { #define P(s) f_print(fout, s); @@ -708,7 +705,7 @@ P("}\n"); /* * Write the most of port monitor support */ -static void +static write_pm_most(infile, netflag) char *infile; int netflag; @@ -795,7 +792,7 @@ write_pm_most(infile, netflag) /* * Support for backgrounding the server if self started. */ -static void +static write_rpc_svc_fg(infile, sp) char *infile; char *sp; @@ -846,7 +843,7 @@ write_rpc_svc_fg(infile, sp) open_log_file(infile, sp); } -static void +static 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 8e4bd706cfd..c0851addc6f 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.3 2001/07/17 02:23:59 pvalchev Exp $ */ +/* $OpenBSD: rpc_tblout.c,v 1.4 2001/07/18 22:26:00 deraadt 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,9 +39,7 @@ 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" @@ -60,8 +58,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 void write_table __P((definition *)); -static void printit __P((char *, char *)); +static write_table __P((definition *)); +static printit __P((char *, char *)); void write_tables() @@ -78,7 +76,7 @@ write_tables() } } -static void +static write_table(def) definition *def; { @@ -145,7 +143,7 @@ write_table(def) } } -static void +static printit(prefix, type) char *prefix; char *type; diff --git a/usr.bin/rpcgen/rpc_util.c b/usr.bin/rpcgen/rpc_util.c index 9d646f687a8..1f7c73098e3 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.3 2001/07/17 02:23:59 pvalchev Exp $ */ +/* $OpenBSD: rpc_util.c,v 1.4 2001/07/18 22:26:00 deraadt 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,7 +41,6 @@ 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" @@ -69,7 +68,6 @@ list *defined; /* list of defined things */ /* * Reinitialize the world */ -void reinitialize() { memset(curline, 0, MAXLINESIZE); @@ -81,7 +79,6 @@ reinitialize() /* * string equality */ -int streq(a, b) char *a; char *b; @@ -127,7 +124,7 @@ storeval(lstp, val) *l = lst; } -static int +static findit(def, type) definition *def; char *type; @@ -196,7 +193,7 @@ ptype(prefix, type, follow) } } -static int +static typedefed(def, type) definition *def; char *type; @@ -208,7 +205,6 @@ typedefed(def, type) } } -int isvectordef(type, rel) char *type; relation rel; @@ -282,7 +278,6 @@ error(msg) * Something went wrong, unlink any files that we may have created and then * die. */ -void crash() { int i; @@ -405,7 +400,7 @@ toktostr(kind) return (sp->str); } -static void +static printbuf() { char c; @@ -414,7 +409,7 @@ printbuf() # define TABSIZE 4 - for (i = 0; (c = curline[i]) != '\0'; i++) { + for (i = 0; c = curline[i]; 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 3ee9f738988..2dda71c74d1 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.4 2001/07/17 02:23:59 pvalchev Exp $ */ +/* $OpenBSD: rpc_util.h,v 1.5 2001/07/18 22:26:00 deraadt 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,7 +104,6 @@ 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 *)); @@ -114,28 +113,20 @@ 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 @@ -143,9 +134,7 @@ void pdeclaration __P((char *, declaration *, int, char *)); 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 *)); @@ -166,5 +155,4 @@ 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)); |