From d0cc804bba69cab19f4455c5d40bb9685b4f22ae Mon Sep 17 00:00:00 2001 From: Stefan Farfeleder Date: Wed, 31 Aug 2005 20:45:15 +0000 Subject: [PATCH] - Use prototypes in headers. - Include rpc_scan.h before rpc_util.h for the tok_kind enum. - Nuke unused declarations. --- usr.bin/rpcgen/rpc_clntout.c | 1 + usr.bin/rpcgen/rpc_cout.c | 1 + usr.bin/rpcgen/rpc_hout.c | 1 + usr.bin/rpcgen/rpc_main.c | 2 +- usr.bin/rpcgen/rpc_parse.h | 2 +- usr.bin/rpcgen/rpc_sample.c | 1 + usr.bin/rpcgen/rpc_scan.h | 14 ++++---- usr.bin/rpcgen/rpc_svcout.c | 1 + usr.bin/rpcgen/rpc_tblout.c | 1 + usr.bin/rpcgen/rpc_util.h | 68 ++++++++++++++++++------------------ 10 files changed, 49 insertions(+), 43 deletions(-) diff --git a/usr.bin/rpcgen/rpc_clntout.c b/usr.bin/rpcgen/rpc_clntout.c index 1e328761ebc3..e12eee415fd6 100644 --- a/usr.bin/rpcgen/rpc_clntout.c +++ b/usr.bin/rpcgen/rpc_clntout.c @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include #include #include "rpc_parse.h" +#include "rpc_scan.h" #include "rpc_util.h" extern void pdeclaration( char *, declaration *, int, char * ); diff --git a/usr.bin/rpcgen/rpc_cout.c b/usr.bin/rpcgen/rpc_cout.c index f8a18d466752..39f702421687 100644 --- a/usr.bin/rpcgen/rpc_cout.c +++ b/usr.bin/rpcgen/rpc_cout.c @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include #include #include "rpc_parse.h" +#include "rpc_scan.h" #include "rpc_util.h" static void print_header( definition * ); diff --git a/usr.bin/rpcgen/rpc_hout.c b/usr.bin/rpcgen/rpc_hout.c index fb25e524c719..c4f089ec144d 100644 --- a/usr.bin/rpcgen/rpc_hout.c +++ b/usr.bin/rpcgen/rpc_hout.c @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include #include #include "rpc_parse.h" +#include "rpc_scan.h" #include "rpc_util.h" void storexdrfuncdecl( char *, int ); diff --git a/usr.bin/rpcgen/rpc_main.c b/usr.bin/rpcgen/rpc_main.c index 5e598489767a..f2b30e8ab246 100644 --- a/usr.bin/rpcgen/rpc_main.c +++ b/usr.bin/rpcgen/rpc_main.c @@ -53,8 +53,8 @@ __FBSDID("$FreeBSD$"); #include #include #include "rpc_parse.h" -#include "rpc_util.h" #include "rpc_scan.h" +#include "rpc_util.h" extern void write_sample_svc( definition * ); extern int write_sample_clnt( definition * ); diff --git a/usr.bin/rpcgen/rpc_parse.h b/usr.bin/rpcgen/rpc_parse.h index 4f3547bc5f80..1ddad6de2986 100644 --- a/usr.bin/rpcgen/rpc_parse.h +++ b/usr.bin/rpcgen/rpc_parse.h @@ -187,7 +187,7 @@ struct definition { }; typedef struct definition definition; -definition *get_definition(); +definition *get_definition(void); struct bas_type diff --git a/usr.bin/rpcgen/rpc_sample.c b/usr.bin/rpcgen/rpc_sample.c index b960cd681c14..b162bdfe356a 100644 --- a/usr.bin/rpcgen/rpc_sample.c +++ b/usr.bin/rpcgen/rpc_sample.c @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$"); #include #include #include "rpc_parse.h" +#include "rpc_scan.h" #include "rpc_util.h" diff --git a/usr.bin/rpcgen/rpc_scan.h b/usr.bin/rpcgen/rpc_scan.h index 1b887b091f53..71f995c63ddb 100644 --- a/usr.bin/rpcgen/rpc_scan.h +++ b/usr.bin/rpcgen/rpc_scan.h @@ -127,10 +127,10 @@ typedef struct token token; /* * routine interface */ -void scan(); -void scan2(); -void scan3(); -void scan_num(); -void peek(); -int peekscan(); -void get_token(); +void scan(tok_kind expect, token *tokp); +void scan2(tok_kind expect1, tok_kind expect2, token *tokp); +void scan3(tok_kind expect1, tok_kind expect2, tok_kind expect3, token *tokp); +void scan_num(token *tokp); +void peek(token *tokp); +int peekscan(tok_kind expect, token *tokp); +void get_token(token *tokp); diff --git a/usr.bin/rpcgen/rpc_svcout.c b/usr.bin/rpcgen/rpc_svcout.c index 2450142ff595..b174b6eaef10 100644 --- a/usr.bin/rpcgen/rpc_svcout.c +++ b/usr.bin/rpcgen/rpc_svcout.c @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include #include #include "rpc_parse.h" +#include "rpc_scan.h" #include "rpc_util.h" extern int tirpc_socket; diff --git a/usr.bin/rpcgen/rpc_tblout.c b/usr.bin/rpcgen/rpc_tblout.c index aaa71c912dd6..082e46a2c9f8 100644 --- a/usr.bin/rpcgen/rpc_tblout.c +++ b/usr.bin/rpcgen/rpc_tblout.c @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include #include #include "rpc_parse.h" +#include "rpc_scan.h" #include "rpc_util.h" #define TABSIZE 8 diff --git a/usr.bin/rpcgen/rpc_util.h b/usr.bin/rpcgen/rpc_util.h index ce21d4ea812a..3e53a5167519 100644 --- a/usr.bin/rpcgen/rpc_util.h +++ b/usr.bin/rpcgen/rpc_util.h @@ -151,10 +151,10 @@ extern pid_t childpid; /* * rpc_util routines */ -void reinitialize(); -void crash(); +void reinitialize(void); +void crash(void); void add_type(int len, char *type); -void storeval(); +void storeval(list **lstp, definition *val); void *xmalloc(size_t size); void *xrealloc(void *ptr, size_t size); char *xstrdup(const char *str); @@ -162,56 +162,56 @@ char *xstrdup(const char *str); #define STOREVAL(list,item) \ storeval(list,item) -definition *findval(); +definition *findval(list *lst, char *val, int (*cmp)(char *, char *)); #define FINDVAL(list,item,finder) \ findval(list, item, finder) -char *fixtype(); -char *stringfix(); -char *locase(); -void pvname_svc(); -void pvname(); -void ptype(); -int isvectordef(); -int streq(); -void error(); -void expected1(); -void expected2(); -void expected3(); -void tabify(); -void record_open(); -bas_type *find_type(); +char *fixtype(char *type); +char *stringfix(char *type); +char *locase(char *str); +void pvname_svc(char *pname, char *vnum); +void pvname(char *pname, char *vnum); +void ptype(char *prefix, char *type, int follow); +int isvectordef(char *type, relation rel); +int streq(char *a, char *b); +void error(char *msg); +void expected1(tok_kind exp1); +void expected2(tok_kind exp1, tok_kind exp2); +void expected3(tok_kind exp1, tok_kind exp2, tok_kind exp3); +void tabify(FILE *f, int tab); +void record_open(char *file); +bas_type *find_type(char *type); + /* * rpc_cout routines */ -void cprint(); -void emit(); +void emit(definition *def); /* * rpc_hout routines */ -void print_datadef(); -void print_funcdef(); -void print_xdr_func_def(); +void print_datadef(definition *def); +void print_funcdef(definition *def); +void print_xdr_func_def(char* name, int pointerp, int i); /* * rpc_svcout routines */ -void write_most(); -void write_register(); -void write_rest(); -void write_programs(); -void write_svc_aux(); -void write_inetd_register(); -void write_netid_register(); -void write_nettype_register(); +void write_most(char *infile, int netflag, int nomain); +void write_rest(void); +void write_programs(char *storage); +void write_svc_aux(int nomain); +void write_inetd_register(char *transp); +void write_netid_register(char *transp); +void write_nettype_register(char *transp); + /* * rpc_clntout routines */ -void write_stubs(); +void write_stubs(void); /* * rpc_tblout routines */ -void write_tables(); +void write_tables(void);