diff options
author | jkh <jkh@FreeBSD.org> | 1996-07-12 19:08:36 +0000 |
---|---|---|
committer | jkh <jkh@FreeBSD.org> | 1996-07-12 19:08:36 +0000 |
commit | 730964efd28b80be48ed35a215a362dde2b6b7a7 (patch) | |
tree | b07c215aa55db3fb81db462f4bc70f61cd56c57f /usr.bin/rpcgen | |
parent | c4d4a99d31762beef936f34571330923e9300da9 (diff) | |
download | FreeBSD-src-730964efd28b80be48ed35a215a362dde2b6b7a7.zip FreeBSD-src-730964efd28b80be48ed35a215a362dde2b6b7a7.tar.gz |
General -Wall warning cleanup, part I.
Submitted-By: Kent Vander Velden <graphix@iastate.edu>
Diffstat (limited to 'usr.bin/rpcgen')
-rw-r--r-- | usr.bin/rpcgen/rpc_clntout.c | 11 | ||||
-rw-r--r-- | usr.bin/rpcgen/rpc_cout.c | 68 | ||||
-rw-r--r-- | usr.bin/rpcgen/rpc_hout.c | 54 | ||||
-rw-r--r-- | usr.bin/rpcgen/rpc_main.c | 79 | ||||
-rw-r--r-- | usr.bin/rpcgen/rpc_parse.c | 49 | ||||
-rw-r--r-- | usr.bin/rpcgen/rpc_sample.c | 13 | ||||
-rw-r--r-- | usr.bin/rpcgen/rpc_scan.c | 36 | ||||
-rw-r--r-- | usr.bin/rpcgen/rpc_svcout.c | 62 | ||||
-rw-r--r-- | usr.bin/rpcgen/rpc_tblout.c | 9 | ||||
-rw-r--r-- | usr.bin/rpcgen/rpc_util.c | 23 | ||||
-rw-r--r-- | usr.bin/rpcgen/rpc_util.h | 4 |
11 files changed, 221 insertions, 187 deletions
diff --git a/usr.bin/rpcgen/rpc_clntout.c b/usr.bin/rpcgen/rpc_clntout.c index 9137ce1..e4a9db7 100644 --- a/usr.bin/rpcgen/rpc_clntout.c +++ b/usr.bin/rpcgen/rpc_clntout.c @@ -43,10 +43,10 @@ static char sccsid[] = "@(#)rpc_clntout.c 1.11 89/02/22 (C) 1987 SMI"; #include "rpc_parse.h" #include "rpc_util.h" -extern int pdeclaration __P(( char *, declaration *, int, char * )); +extern void pdeclaration __P(( char *, declaration *, int, char * )); void printarglist __P(( proc_list *, char *, char *, char *)); -static int write_program __P(( definition * )); -static int printbody __P(( proc_list * )); +static void write_program __P(( definition * )); +static void printbody __P(( proc_list * )); static char RESULT[] = "clnt_res"; @@ -72,7 +72,7 @@ write_stubs() } } -static +static void write_program(def) definition *def; { @@ -218,13 +218,12 @@ ampr(type) } } -static +static void printbody(proc) proc_list *proc; { decl_list *l; bool_t args2 = (proc->arg_num > 1); - int i; /* * For new style with multiple arguments, need a structure in which diff --git a/usr.bin/rpcgen/rpc_cout.c b/usr.bin/rpcgen/rpc_cout.c index e79ac9d..7445fd7 100644 --- a/usr.bin/rpcgen/rpc_cout.c +++ b/usr.bin/rpcgen/rpc_cout.c @@ -39,17 +39,20 @@ static char sccsid[] = "@(#)rpc_cout.c 1.13 89/02/22 (C) 1987 SMI"; */ #include <stdio.h> #include <string.h> +#include <ctype.h> #include "rpc_parse.h" #include "rpc_util.h" -static int print_header __P(( definition * )); -static int print_trailer __P(( void )); -static int print_stat __P(( int , declaration * )); -static int emit_enum __P(( definition * )); -static int emit_program __P(( definition * )); -static int emit_union __P(( definition * )); -static int emit_struct __P(( definition * )); -static int emit_typedef __P(( definition * )); +static void print_header __P(( definition * )); +static void print_trailer __P(( void )); +static void print_stat __P(( int , declaration * )); +static void emit_enum __P(( definition * )); +static void emit_program __P(( definition * )); +static void emit_union __P(( definition * )); +static void emit_struct __P(( definition * )); +static void emit_typedef __P(( definition * )); +static void emit_inline __P(( int, declaration *, int )); +static void emit_single_in_line __P(( int, declaration *, int, relation )); /* * Emit the C-routine for the given definition @@ -89,11 +92,13 @@ emit(def) case DEF_TYPEDEF: emit_typedef(def); break; + /* DEF_CONST and DEF_PROGRAM have already been handled */ + default: } print_trailer(); } -static +static int findtype(def, type) definition *def; char *type; @@ -106,7 +111,7 @@ findtype(def, type) } } -static +static int undefined(type) char *type; { @@ -117,7 +122,7 @@ undefined(type) } -static +static void print_generic_header(procname, pointerp) char* procname; int pointerp; @@ -141,15 +146,10 @@ 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, @@ -162,14 +162,14 @@ print_header(def) f_print(fout, "\tregister long *buf;\n\n"); } -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"); @@ -177,7 +177,7 @@ print_trailer() } -static +static void print_ifopen(indent, name) int indent; char *name; @@ -186,14 +186,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(indent, prefix, type) int indent; char *prefix; @@ -216,7 +216,7 @@ print_ifsizeof(indent, prefix, type) } } -static +static void print_ifclose(indent) int indent; { @@ -225,7 +225,7 @@ print_ifclose(indent) f_print(fout, "\treturn (FALSE);\n"); } -static +static void print_ifstat(indent, prefix, type, rel, amax, objname, name) int indent; char *prefix; @@ -302,7 +302,7 @@ print_ifstat(indent, prefix, type, rel, amax, objname, name) } /* ARGSUSED */ -static +static void emit_enum(def) definition *def; { @@ -311,7 +311,7 @@ emit_enum(def) print_ifclose(1); } -static +static void emit_program(def) definition *def; { @@ -332,7 +332,7 @@ emit_program(def) } -static +static void emit_union(def) definition *def; { @@ -385,6 +385,9 @@ strlen(dflt->name) + 1); dflt->array_max, object, dflt->name); free(object); f_print(fout, "\t\tbreak;\n"); + } else { + f_print(fout, "\tdefault:\n"); + f_print(fout, "\t\tbreak;\n"); } } else { f_print(fout, "\tdefault:\n"); @@ -553,12 +556,12 @@ int flag; } } -static +static void emit_struct(def) definition *def; { decl_list *dl; - int i, j, size, flag; + int j, size, flag; bas_type *ptr; int can_inline; @@ -623,7 +626,7 @@ emit_struct(def) } -static +static void emit_typedef(def) definition *def; { @@ -635,7 +638,7 @@ emit_typedef(def) print_ifstat(1, prefix, type, rel, amax, "objp", def->def_name); } -static +static void print_stat(indent, dec) int indent; declaration *dec; @@ -657,6 +660,7 @@ print_stat(indent, dec) char *upcase (); +static void emit_inline(indent, decl, flag) int indent; declaration *decl; @@ -681,9 +685,11 @@ int flag; f_print(fout, "}\n"); tabify(fout, indent); f_print(fout, "}\n"); + default: } } +static void emit_single_in_line(indent, decl, flag, rel) int indent; declaration *decl; diff --git a/usr.bin/rpcgen/rpc_hout.c b/usr.bin/rpcgen/rpc_hout.c index ae73454..8dce77de 100644 --- a/usr.bin/rpcgen/rpc_hout.c +++ b/usr.bin/rpcgen/rpc_hout.c @@ -43,16 +43,18 @@ static char sccsid[] = "@(#)rpc_hout.c 1.12 89/02/22 (C) 1987 SMI"; #include "rpc_util.h" void storexdrfuncdecl __P(( char *, int )); -static int pconstdef __P(( definition * )); -static int pstructdef __P(( definition * )); -static int puniondef __P(( definition * )); -static int pprogramdef __P(( definition * )); -static int pstructdef __P(( definition * )); -static int penumdef __P(( definition * )); -static int ptypedef __P(( definition * )); -static int pdefine __P(( char *, char * )); +static void pconstdef __P(( definition * )); +static void pstructdef __P(( definition * )); +static void puniondef __P(( definition * )); +static void pprogramdef __P(( definition * )); +static void pstructdef __P(( definition * )); +static void penumdef __P(( definition * )); +static void ptypedef __P(( definition * )); +static void pdefine __P(( char *, char * )); static int undefined2 __P(( char *, char * )); -static int parglist __P(( proc_list *, char * )); +static void parglist __P(( proc_list *, char * )); +static void pprocdef __P(( proc_list *, version_list *, char *, int, int )); +void pdeclaration __P(( char *, declaration *, int, char * )); static char RESULT[] = "clnt_res"; @@ -109,7 +111,8 @@ print_funcdef(def) f_print(fout, "\n"); pprogramdef(def); break; - } + default: + } } /* store away enough information to allow the XDR functions to be spat @@ -157,7 +160,7 @@ int i; } -static +static void pconstdef(def) definition *def; { @@ -167,7 +170,7 @@ pconstdef(def) /* print out the definitions for the arguments of functions in the header file */ -static +static void pargdef(def) definition *def; { @@ -201,7 +204,7 @@ pargdef(def) } -static +static void pstructdef(def) definition *def; { @@ -216,7 +219,7 @@ pstructdef(def) f_print(fout, "typedef struct %s %s;\n", name, name); } -static +static void puniondef(def) definition *def; { @@ -245,7 +248,7 @@ puniondef(def) f_print(fout, "typedef struct %s %s;\n", name, name); } -static +static void pdefine(name, num) char *name; char *num; @@ -253,7 +256,7 @@ pdefine(name, num) f_print(fout, "#define\t%s %s\n", name, num); } -static +static void puldefine(name, num) char *name; char *num; @@ -261,7 +264,7 @@ puldefine(name, num) f_print(fout, "#define\t%s ((unsigned long)(%s))\n", name, num); } -static +static int define_printed(stop, start) proc_list *stop; version_list *start; @@ -282,7 +285,7 @@ define_printed(stop, start) /* NOTREACHED */ } -static +static void pfreeprocdef(char * name, char *vers, int mode) { f_print(fout, "extern int "); @@ -295,7 +298,7 @@ pfreeprocdef(char * name, char *vers, int mode) } -static +static void pprogramdef(def) definition *def; { @@ -371,6 +374,7 @@ pprogramdef(def) } } +static void pprocdef(proc, vp, addargtype, server_p, mode) proc_list *proc; version_list *vp; @@ -399,15 +403,12 @@ pprocdef(proc, vp, addargtype, server_p, mode) parglist(proc, addargtype); else f_print(fout, "();\n"); - - - } /* print out argument list of procedure */ -static +static void parglist(proc, addargtype) proc_list *proc; char* addargtype; @@ -438,7 +439,7 @@ parglist(proc, addargtype) } -static +static void penumdef(def) definition *def; { @@ -470,7 +471,7 @@ penumdef(def) f_print(fout, "typedef enum %s %s;\n", name, name); } -static +static void ptypedef(def) definition *def; { @@ -517,6 +518,7 @@ ptypedef(def) } } +void pdeclaration(name, dec, tab, separator) char *name; declaration *dec; @@ -575,7 +577,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 6902530..59431c3 100644 --- a/usr.bin/rpcgen/rpc_main.c +++ b/usr.bin/rpcgen/rpc_main.c @@ -42,6 +42,7 @@ static char sccsid[] = "@(#)rpc_main.c 1.30 89/03/30 (C) 1987 SMI"; #include <stdio.h> #include <string.h> #include <unistd.h> +#include <ctype.h> #include <sys/types.h> #include <sys/param.h> #include <sys/file.h> @@ -53,23 +54,26 @@ static char sccsid[] = "@(#)rpc_main.c 1.30 89/03/30 (C) 1987 SMI"; extern void write_sample_svc __P(( definition * )); extern int write_sample_clnt __P(( definition * )); extern void write_sample_clnt_main __P(( void )); -static int c_output __P(( char *, char *, int, char * )); -static int h_output __P(( char *, char *, int, char * )); -static int l_output __P(( char *, char *, int, char * )); -static int t_output __P(( char *, char *, int, char * )); -static int clnt_output __P(( char *, char *, int, char * )); +extern void add_sample_msg __P(( void )); +static void c_output __P(( char *, char *, int, char * )); +static void h_output __P(( char *, char *, int, char * )); +static void l_output __P(( char *, char *, int, char * )); +static void t_output __P(( char *, char *, int, char * )); +static void clnt_output __P(( char *, char *, int, char * )); + +void c_initialize __P(( void )); #ifndef __FreeBSD__ char * rindex(); #endif -static int usage __P(( void )); -static int options_usage __P (( void )); +static void usage __P(( void )); +static void options_usage __P (( void )); static int do_registers __P(( int, char ** )); static int parseargs __P(( int, char **, struct commandline * )); -static int svc_output __P(( char *, char *, int, char * )); +static void svc_output __P(( char *, char *, int, char * )); static void mkfile_output __P(( struct commandline * )); -static int s_output __P(( int, char **, char *, char *, int, char *, int, int )); +static void s_output __P(( int, char **, char *, char *, int, char *, int, int )); #define EXTEND 1 /* alias for TRUE */ #define DONT_EXTEND 0 /* alias for FALSE */ @@ -156,6 +160,7 @@ xdrfunc *xdrfunc_tail = NULL; /* xdr function list */ pid_t childpid; +int main(argc, argv) int argc; char *argv[]; @@ -274,7 +279,7 @@ extendfile(file, ext) /* * Open output file with given extension */ -static +static void open_output(infile, outfile) char *infile; char *outfile; @@ -298,9 +303,10 @@ open_output(infile, outfile) } record_open(outfile); + return; } -static +static void add_warning() { f_print(fout, "/*\n"); @@ -342,7 +348,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 +438,7 @@ char *ext; } -static +static void c_output(infile, define, extend, outfile) char *infile; char *define; @@ -456,7 +462,7 @@ c_output(infile, define, extend, outfile) } else f_print(fout, "#include <rpc/rpc.h>\n"); tell = ftell(fout); - while (def = get_definition()) { + while ( (def = get_definition()) ) { emit(def); } if (extend && tell == ftell(fout)) { @@ -465,6 +471,7 @@ c_output(infile, define, extend, outfile) } +void c_initialize() { @@ -512,7 +519,7 @@ char *generate_guard(pathname) */ -static +static void h_output(infile, define, extend, outfile) char *infile; char *define; @@ -558,7 +565,7 @@ h_output(infile, define, extend, outfile) tell = ftell(fout); /* print data definitions */ - while (def = get_definition()) { + while ( (def = get_definition()) ) { print_datadef(def); } @@ -627,7 +634,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[]; @@ -710,7 +717,7 @@ s_output(argc, argv, infile, define, extend, outfile, nomain, netflag) if (timerflag) f_print(fout, "\n#define _RPCSVC_CLOSEDOWN %s\n", svcclosetime); - while (def = get_definition()) { + while ( (def = get_definition()) ) { foundprogram |= (def->def_kind == DEF_PROGRAM); } if (extend && !foundprogram) { @@ -731,7 +738,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; @@ -754,7 +761,7 @@ l_output(infile, define, extend, outfile) free(include); } else f_print(fout, "#include <rpc/rpc.h>\n"); - while (def = get_definition()) { + while ( (def = get_definition()) ) { foundprogram |= (def->def_kind == DEF_PROGRAM); } if (extend && !foundprogram) { @@ -767,7 +774,7 @@ l_output(infile, define, extend, outfile) /* * generate the dispatch table */ -static +static void t_output(infile, define, extend, outfile) char *infile; char *define; @@ -782,7 +789,7 @@ t_output(infile, define, extend, outfile) outfilename = extend ? extendfile(infile, outfile) : outfile; open_output(infile, outfilename); add_warning(); - while (def = get_definition()) { + while ( (def = get_definition()) ) { foundprogram |= (def->def_kind == DEF_PROGRAM); } if (extend && !foundprogram) { @@ -793,7 +800,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; @@ -821,7 +828,7 @@ svc_output(infile, define, extend, outfile) f_print(fout, "#include <rpc/rpc.h>\n"); tell = ftell(fout); - while (def = get_definition()) { + while ( (def = get_definition()) ) { write_sample_svc(def); } if (extend && tell == ftell(fout)) { @@ -830,7 +837,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; @@ -859,7 +866,7 @@ clnt_output(infile, define, extend, outfile) } else f_print(fout, "#include <rpc/rpc.h>\n"); tell = ftell(fout); - while (def = get_definition()) { + while ( (def = get_definition()) ) { has_program += write_sample_clnt(def); } @@ -981,8 +988,8 @@ $(OBJECTS_SVC) $(CLIENT) $(SERVER)\n\n"); * 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[]; { @@ -1078,7 +1085,7 @@ char *outfile; /* * Parse command line arguments */ -static +static int parseargs(argc, argv, cmd) int argc; char *argv[]; @@ -1129,10 +1136,10 @@ parseargs(argc, argv, cmd) case 'l': case 'm': case 't': - if (flag[c]) { + if (flag[(int)c]) { return (0); } - flag[c] = 1; + flag[(int)c] = 1; break; case 'S': /* @@ -1151,10 +1158,10 @@ parseargs(argc, argv, cmd) else return (0); - if (flag[ch]) { + if (flag[(int)ch]) { return (0); } - flag[ch] = 1; + flag[(int)ch] = 1; break; case 'C': /* ANSI C syntax */ Cflag = 1; @@ -1211,7 +1218,7 @@ parseargs(argc, argv, cmd) argv[i][j + 1] != 0) { return (0); } - flag[c] = 1; + flag[(int)c] = 1; if (++i == argc) { return (0); } @@ -1306,7 +1313,7 @@ parseargs(argc, argv, cmd) return (1); } -static +static void usage() { f_print(stderr, "usage: %s infile\n", cmdname); @@ -1324,7 +1331,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 fb8eec1..5431520 100644 --- a/usr.bin/rpcgen/rpc_parse.c +++ b/usr.bin/rpcgen/rpc_parse.c @@ -47,17 +47,17 @@ static char sccsid[] = "@(#)rpc_parse.c 1.8 89/02/22 (C) 1987 SMI"; #define ARGNAME "arg" extern char *make_argname __P(( char *, char * )); -static int isdefined __P(( definition * )); -static int def_struct __P(( definition * )); -static int def_program __P(( definition * )); -static int def_enum __P(( definition * )); -static int def_const __P(( definition * )); -static int def_union __P(( definition * )); -static int def_typedef __P(( definition * )); -static int get_declaration __P(( declaration *, defkind )); -static int get_prog_declaration __P(( declaration *, defkind, int )); -static int get_type __P(( char **, char **, defkind )); -static int 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 ** )); #ifndef __FreeBSD__ extern char *strdup(); @@ -103,14 +103,14 @@ get_definition() return (defp); } -static +static void isdefined(defp) definition *defp; { STOREVAL(&defined, defp); } -static +static void def_struct(defp) definition *defp; { @@ -138,7 +138,7 @@ def_struct(defp) *tailp = NULL; } -static +static void def_program(defp) definition *defp; { @@ -245,7 +245,7 @@ def_program(defp) } -static +static void def_enum(defp) definition *defp; { @@ -275,7 +275,7 @@ def_enum(defp) *tailp = NULL; } -static +static void def_const(defp) definition *defp; { @@ -289,13 +289,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; @@ -388,7 +388,8 @@ 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) +static void +check_type_name(name, new_type) int new_type; char* name; { @@ -417,7 +418,7 @@ char* name; -static +static void def_typedef(defp) definition *defp; { @@ -433,7 +434,7 @@ def_typedef(defp) defp->def.ty.array_max = dec.array_max; } -static +static void get_declaration(dec, dkind) declaration *dec; defkind dkind; @@ -486,7 +487,7 @@ get_declaration(dec, dkind) } -static +static void get_prog_declaration(dec, dkind, num) declaration *dec; defkind dkind; @@ -559,7 +560,7 @@ get_prog_declaration(dec, dkind, num) -static +static void get_type(prefixp, typep, dkind) char **prefixp; char **typep; @@ -617,7 +618,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 435bb44..1de374c 100644 --- a/usr.bin/rpcgen/rpc_sample.c +++ b/usr.bin/rpcgen/rpc_sample.c @@ -43,9 +43,9 @@ static char RQSTP[] = "rqstp"; extern void printarglist __P(( proc_list *, char *, char *, char *)); -static int write_sample_client __P(( char *, version_list * )); -static int write_sample_server __P(( definition * )); -static int 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) @@ -76,7 +76,7 @@ write_sample_clnt(def) } -static +static void write_sample_client(program_name, vp) char *program_name; version_list *vp; @@ -192,7 +192,7 @@ write_sample_client(program_name, vp) f_print(fout, "}\n"); } -static +static void write_sample_server(def) definition *def; { @@ -261,13 +261,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 e65b799..d1d03aa 100644 --- a/usr.bin/rpcgen/rpc_scan.c +++ b/usr.bin/rpcgen/rpc_scan.c @@ -52,15 +52,15 @@ static char sccsid[] = "@(#)rpc_scan.c 1.11 89/02/22 (C) 1987 SMI"; static int pushed = 0; /* is a token pushed */ static token lasttok; /* last token, if pushed */ -static int unget_token __P(( token * )); -static int findstrconst __P(( char **, char **)); -static int findchrconst __P(( char **, char **)); -static int findconst __P(( char **, char **)); -static int findkind __P(( char **, token * )); +static void unget_token __P(( token * )); +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 int printdirective __P(( char * )); -static int docppline __P(( char *, int *, char ** )); +static void printdirective __P(( char * )); +static void docppline __P(( char *, int *, char ** )); /* * scan expecting 1 given token @@ -315,7 +315,7 @@ get_token(tokp) } } -static +static void unget_token(tokp) token *tokp; { @@ -323,7 +323,7 @@ unget_token(tokp) pushed = 1; } -static +static void findstrconst(str, val) char **str; char **val; @@ -333,7 +333,7 @@ findstrconst(str, val) p = *str; do { - *p++; + p++; } while (*p && *p != '"'); if (*p == 0) { error("unterminated string constant"); @@ -346,7 +346,7 @@ findstrconst(str, val) *str = p; } -static +static void findchrconst(str, val) char **str; char **val; @@ -356,7 +356,7 @@ findchrconst(str, val) p = *str; do { - *p++; + p++; } while (*p && *p != '\''); if (*p == 0) { error("unterminated string constant"); @@ -372,7 +372,7 @@ findchrconst(str, val) *str = p; } -static +static void findconst(str, val) char **str; char **val; @@ -425,7 +425,7 @@ static token symbols[] = { {TOK_EOF, "??????"}, }; -static +static void findkind(mark, tokp) char **mark; token *tokp; @@ -454,28 +454,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 a7b7d87..cb26f22 100644 --- a/usr.bin/rpcgen/rpc_svcout.c +++ b/usr.bin/rpcgen/rpc_svcout.c @@ -52,21 +52,23 @@ static char RETVAL[] = "retval"; char _errbuf[256]; /* For all messages */ void internal_proctype __P(( proc_list * )); -static int write_real_program __P(( definition * )); -static int write_program __P(( definition *, char * )); -static int printerr __P(( char *, char * )); -static int printif __P(( char *, char *, char *, char * )); -static int write_inetmost __P(( char * )); -static int print_return __P(( char * )); -static int print_pmapunset __P(( char * )); -static int print_err_message __P(( char * )); -static int write_timeout_func __P(( void )); -static int write_pm_most __P(( char *, int )); -static int write_rpc_svc_fg __P(( char *, char * )); -static int open_log_file __P(( char *, char * )); - - -static +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_rpc_svc_fg __P(( char *, char * )); +static void open_log_file __P(( char *, char * )); +static void write_msg_out __P(( void )); +int nullproc __P(( proc_list * )); + + +static void p_xdrfunc(rname, typename) char* rname; char* typename; @@ -320,7 +322,7 @@ write_programs(storage) * 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; { @@ -399,7 +401,7 @@ write_real_program(def) } } -static +static void write_program(def, storage) definition *def; char *storage; @@ -618,7 +620,7 @@ write_program(def, storage) } } -static +static void printerr(err, transp) char *err; char *transp; @@ -626,7 +628,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; @@ -637,6 +639,7 @@ printif(proc, transp, prefix, arg) proc, transp, arg, prefix, arg); } +int nullproc(proc) proc_list *proc; { @@ -648,7 +651,7 @@ nullproc(proc) return (0); } -static +static void write_inetmost(infile) char *infile; { @@ -677,7 +680,7 @@ write_inetmost(infile) f_print(fout, "\t}\n"); } -static +static void print_return(space) char *space; { @@ -695,7 +698,7 @@ print_return(space) } } -static +static void print_pmapunset(space) char *space; { @@ -715,7 +718,7 @@ print_pmapunset(space) } } -static +static void print_err_message(space) char *space; { @@ -744,7 +747,8 @@ write_svc_aux(nomain) * Write the _msgout function */ -write_msg_out() +static void +write_msg_out(void) { f_print(fout, "\n"); /* @@ -776,8 +780,8 @@ write_msg_out() /* * Write the timeout function */ -static -write_timeout_func() +static void +write_timeout_func(void) { if (!timerflag) return; @@ -841,7 +845,7 @@ write_timeout_func() /* * Write the most of port monitor support */ -static +static void write_pm_most(infile, netflag) char *infile; int netflag; @@ -940,7 +944,7 @@ ioctl(0, I_PUSH, \"timod\")) {\n"); /* * Support for backgrounding the server if self started. */ -static +static void write_rpc_svc_fg(infile, sp) char *infile; char *sp; @@ -992,7 +996,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 e851ded..f8b56798 100644 --- a/usr.bin/rpcgen/rpc_tblout.c +++ b/usr.bin/rpcgen/rpc_tblout.c @@ -58,8 +58,9 @@ 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 int write_table __P(( definition * )); -static int printit __P(( char *, char * )); +extern int nullproc __P(( proc_list * )); +static void write_table __P(( definition * )); +static void printit __P(( char *, char * )); void write_tables() @@ -76,7 +77,7 @@ write_tables() } } -static +static void write_table(def) definition *def; { @@ -143,7 +144,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 5d3fa06..1ade911 100644 --- a/usr.bin/rpcgen/rpc_util.c +++ b/usr.bin/rpcgen/rpc_util.c @@ -38,7 +38,9 @@ static char sccsid[] = "@(#)rpc_util.c 1.11 89/02/22 (C) 1987 SMI"; * Copyright (C) 1989, Sun Microsystems, Inc. */ #include <stdio.h> +#include <string.h> #include <ctype.h> +#include <unistd.h> #include "rpc_scan.h" #include "rpc_parse.h" #include "rpc_util.h" @@ -60,11 +62,12 @@ FILE *fin; /* file pointer of current input */ list *defined; /* list of defined things */ -static int printwhere __P(( void )); +static void printwhere __P(( void )); /* * Reinitialize the world */ +void reinitialize() { memset(curline, 0, MAXLINESIZE); @@ -76,6 +79,7 @@ reinitialize() /* * string equality */ +int streq(a, b) char *a; char *b; @@ -119,7 +123,7 @@ storeval(lstp, val) *l = lst; } -static +static int findit(def, type) definition *def; char *type; @@ -192,7 +196,7 @@ ptype(prefix, type, follow) } } -static +static int typedefed(def, type) definition *def; char *type; @@ -204,6 +208,7 @@ typedefed(def, type) } } +int isvectordef(type, rel) char *type; relation rel; @@ -227,6 +232,8 @@ isvectordef(type, rel) rel = def->def.ty.rel; } } + + return (0); } char * @@ -237,7 +244,7 @@ locase(str) static char buf[100]; char *p = buf; - while (c = *str++) { + while ( (c = *str++) ) { *p++ = (c >= 'A' && c <= 'Z') ? (c - 'A' + 'a') : c; } *p = 0; @@ -277,6 +284,7 @@ error(msg) * Something went wrong, unlink any files that we may have created and then * die. */ +void crash() { int i; @@ -399,7 +407,7 @@ toktostr(kind) return (sp->str); } -static +static void printbuf() { char c; @@ -408,7 +416,7 @@ printbuf() # define TABSIZE 4 - for (i = 0; c = curline[i]; i++) { + for (i = 0; (c = curline[i]); i++) { if (c == '\t') { cnt = 8 - (i % TABSIZE); c = ' '; @@ -421,7 +429,7 @@ printbuf() } } -static +static void printwhere() { int i; @@ -462,6 +470,7 @@ make_argname(pname, vname) bas_type *typ_list_h; bas_type *typ_list_t; +void add_type(len, type) int len; char *type; diff --git a/usr.bin/rpcgen/rpc_util.h b/usr.bin/rpcgen/rpc_util.h index 259860f..f465bfc 100644 --- a/usr.bin/rpcgen/rpc_util.h +++ b/usr.bin/rpcgen/rpc_util.h @@ -149,6 +149,10 @@ extern pid_t childpid; /* * rpc_util routines */ +void reinitialize(); +void crash(); +void add_type(int len, char *type); + void storeval(); #define STOREVAL(list,item) \ |