git: 9ff592d86890 - stable/13 - ipflter: ANSIfy userland function declarations

From: Cy Schubert <cy_at_FreeBSD.org>
Date: Mon, 07 Feb 2022 13:51:54 UTC
The branch stable/13 has been updated by cy:

URL: https://cgit.FreeBSD.org/src/commit/?id=9ff592d86890e9adddabc557111a18a99ca29ccf

commit 9ff592d86890e9adddabc557111a18a99ca29ccf
Author:     Cy Schubert <cy@FreeBSD.org>
AuthorDate: 2021-12-20 17:07:20 +0000
Commit:     Cy Schubert <cy@FreeBSD.org>
CommitDate: 2022-02-07 13:51:15 +0000

    ipflter: ANSIfy userland function declarations
    
    Convert ipfilter userland function declarations from K&R to ANSI. This
    syncs our function declarations with NetBSD hg commit 75edcd7552a0
    (apply our changes). Though not copied from NetBSD, this change was
    partially inspired by NetBSD's work and inspired by style(9).
    
    Reviewed by:            glebius (for #network)
    Differential Revision:  https://reviews.freebsd.org/D33595
    
    (cherry picked from commit efeb8bffe34422937c7f8df836afb5b817366d16)
---
 sbin/ipf/common/ipf_y.y                   | 112 +++++++--------
 sbin/ipf/common/lexer.c                   |  54 +++----
 sbin/ipf/ipf/ipf.c                        |  55 +++----
 sbin/ipf/ipf/ipfcomp.c                    |  71 ++++-----
 sbin/ipf/ipfs/ipfs.c                      |  41 ++----
 sbin/ipf/ipfstat/ipfstat.c                | 143 +++++-------------
 sbin/ipf/ipftest/ipftest.c                |  55 ++++---
 sbin/ipf/ipftest/md5.c                    |  16 +--
 sbin/ipf/iplang/iplang_l.l                |  14 +-
 sbin/ipf/iplang/iplang_y.y                | 212 ++++++++++-----------------
 sbin/ipf/ipmon/ipmon.c                    | 109 ++++++--------
 sbin/ipf/ipmon/ipmon_y.y                  |  40 ++----
 sbin/ipf/ipnat/ipnat.c                    |  53 +++----
 sbin/ipf/ipnat/ipnat_y.y                  |  64 +++------
 sbin/ipf/ippool/ippool.c                  |  61 ++------
 sbin/ipf/ippool/ippool_y.y                |  24 ++--
 sbin/ipf/ipscan/ipscan_y.y                |  43 +++---
 sbin/ipf/ipsend/44arp.c                   |   6 +-
 sbin/ipf/ipsend/arp.c                     |   3 +-
 sbin/ipf/ipsend/dlcommon.c                | 232 +++++++++---------------------
 sbin/ipf/ipsend/ip.c                      |  39 ++---
 sbin/ipf/ipsend/ipresend.c                |   5 +-
 sbin/ipf/ipsend/ipsend.c                  |  17 +--
 sbin/ipf/ipsend/ipsopt.c                  |  10 +-
 sbin/ipf/ipsend/iptest.c                  |   5 +-
 sbin/ipf/ipsend/iptests.c                 |  48 ++-----
 sbin/ipf/ipsend/resend.c                  |  13 +-
 sbin/ipf/ipsend/sbpf.c                    |  10 +-
 sbin/ipf/ipsend/sdlpi.c                   |   8 +-
 sbin/ipf/ipsend/snit.c                    |   8 +-
 sbin/ipf/ipsend/sock.c                    |  21 ++-
 sbin/ipf/ipsend/sockraw.c                 |   3 +-
 sbin/ipf/libipf/addipopt.c                |   7 +-
 sbin/ipf/libipf/alist_free.c              |   3 +-
 sbin/ipf/libipf/allocmbt.c                |   3 +-
 sbin/ipf/libipf/assigndefined.c           |   4 +-
 sbin/ipf/libipf/bcopywrap.c               |   5 +-
 sbin/ipf/libipf/binprint.c                |   5 +-
 sbin/ipf/libipf/buildopts.c               |   5 +-
 sbin/ipf/libipf/checkrev.c                |   4 +-
 sbin/ipf/libipf/count4bits.c              |   4 +-
 sbin/ipf/libipf/count6bits.c              |   4 +-
 sbin/ipf/libipf/dupmbt.c                  |   4 +-
 sbin/ipf/libipf/facpri.c                  |  12 +-
 sbin/ipf/libipf/familyname.c              |   3 +-
 sbin/ipf/libipf/fill6bits.c               |   5 +-
 sbin/ipf/libipf/findword.c                |   5 +-
 sbin/ipf/libipf/freembt.c                 |   4 +-
 sbin/ipf/libipf/ftov.c                    |   3 +-
 sbin/ipf/libipf/gethost.c                 |   6 +-
 sbin/ipf/libipf/geticmptype.c             |   5 +-
 sbin/ipf/libipf/getifname.c               |   4 +-
 sbin/ipf/libipf/getnattype.c              |   3 +-
 sbin/ipf/libipf/getport.c                 |   6 +-
 sbin/ipf/libipf/getportproto.c            |   5 +-
 sbin/ipf/libipf/getproto.c                |   6 +-
 sbin/ipf/libipf/getsumd.c                 |   4 +-
 sbin/ipf/libipf/icmptypename.c            |   4 +-
 sbin/ipf/libipf/inet_addr.c               |   7 +-
 sbin/ipf/libipf/interror.c                |  10 +-
 sbin/ipf/libipf/ipf_dotuning.c            |   5 +-
 sbin/ipf/libipf/ipf_perror.c              |  13 +-
 sbin/ipf/libipf/ipft_hx.c                 |  17 ++-
 sbin/ipf/libipf/ipft_pc.c                 |  26 ++--
 sbin/ipf/libipf/ipft_tx.c                 |  36 ++---
 sbin/ipf/libipf/ipoptsec.c                |   8 +-
 sbin/ipf/libipf/kmem.c                    |  16 +--
 sbin/ipf/libipf/kmemcpywrap.c             |   5 +-
 sbin/ipf/libipf/kvatoname.c               |   5 +-
 sbin/ipf/libipf/load_dstlist.c            |   5 +-
 sbin/ipf/libipf/load_dstlistnode.c        |   7 +-
 sbin/ipf/libipf/load_hash.c               |   5 +-
 sbin/ipf/libipf/load_hashnode.c           |   8 +-
 sbin/ipf/libipf/load_pool.c               |   4 +-
 sbin/ipf/libipf/load_poolnode.c           |   8 +-
 sbin/ipf/libipf/mb_hexdump.c              |   4 +-
 sbin/ipf/libipf/msgdsize.c                |   3 +-
 sbin/ipf/libipf/mutex_emul.c              |  18 +--
 sbin/ipf/libipf/nametokva.c               |   5 +-
 sbin/ipf/libipf/nat_setgroupmap.c         |   4 +-
 sbin/ipf/libipf/ntomask.c                 |   5 +-
 sbin/ipf/libipf/optname.c                 |   6 +-
 sbin/ipf/libipf/optprint.c                |   5 +-
 sbin/ipf/libipf/optprintv6.c              |   5 +-
 sbin/ipf/libipf/optvalue.c                |   8 +-
 sbin/ipf/libipf/parsefields.c             |   4 +-
 sbin/ipf/libipf/parseipfexpr.c            |   4 +-
 sbin/ipf/libipf/parsewhoisline.c          |   5 +-
 sbin/ipf/libipf/poolio.c                  |   6 +-
 sbin/ipf/libipf/prependmbt.c              |   4 +-
 sbin/ipf/libipf/print_toif.c              |   6 +-
 sbin/ipf/libipf/printactiveaddr.c         |   5 +-
 sbin/ipf/libipf/printactivenat.c          |   5 +-
 sbin/ipf/libipf/printaddr.c               |   6 +-
 sbin/ipf/libipf/printaps.c                |   4 +-
 sbin/ipf/libipf/printbuf.c                |   4 +-
 sbin/ipf/libipf/printdstl_live.c          |   8 +-
 sbin/ipf/libipf/printdstlist.c            |   9 +-
 sbin/ipf/libipf/printdstlistdata.c        |   4 +-
 sbin/ipf/libipf/printdstlistnode.c        |   7 +-
 sbin/ipf/libipf/printdstlistpolicy.c      |   3 +-
 sbin/ipf/libipf/printfieldhdr.c           |   3 +-
 sbin/ipf/libipf/printfr.c                 |   4 +-
 sbin/ipf/libipf/printfraginfo.c           |   4 +-
 sbin/ipf/libipf/printhash.c               |   8 +-
 sbin/ipf/libipf/printhash_live.c          |   7 +-
 sbin/ipf/libipf/printhashdata.c           |   4 +-
 sbin/ipf/libipf/printhashnode.c           |   8 +-
 sbin/ipf/libipf/printhost.c               |   4 +-
 sbin/ipf/libipf/printhostmap.c            |   4 +-
 sbin/ipf/libipf/printhostmask.c           |   4 +-
 sbin/ipf/libipf/printifname.c             |   4 +-
 sbin/ipf/libipf/printip.c                 |   4 +-
 sbin/ipf/libipf/printipfexpr.c            |  15 +-
 sbin/ipf/libipf/printiphdr.c              |   3 +-
 sbin/ipf/libipf/printlog.c                |   3 +-
 sbin/ipf/libipf/printlookup.c             |   4 +-
 sbin/ipf/libipf/printmask.c               |   4 +-
 sbin/ipf/libipf/printnat.c                |   4 +-
 sbin/ipf/libipf/printnataddr.c            |   6 +-
 sbin/ipf/libipf/printnatfield.c           |   4 +-
 sbin/ipf/libipf/printnatside.c            |   4 +-
 sbin/ipf/libipf/printpacket.c             |   4 +-
 sbin/ipf/libipf/printpacket6.c            |   4 +-
 sbin/ipf/libipf/printpool.c               |   8 +-
 sbin/ipf/libipf/printpool_live.c          |   8 +-
 sbin/ipf/libipf/printpooldata.c           |   4 +-
 sbin/ipf/libipf/printpoolfield.c          |   5 +-
 sbin/ipf/libipf/printpoolnode.c           |   5 +-
 sbin/ipf/libipf/printportcmp.c            |   4 +-
 sbin/ipf/libipf/printproto.c              |   5 +-
 sbin/ipf/libipf/printsbuf.c               |   6 +-
 sbin/ipf/libipf/printstatefields.c        |   4 +-
 sbin/ipf/libipf/printtcpflags.c           |   3 +-
 sbin/ipf/libipf/printtqtable.c            |   3 +-
 sbin/ipf/libipf/printtunable.c            |   3 +-
 sbin/ipf/libipf/printunit.c               |   3 +-
 sbin/ipf/libipf/remove_hash.c             |   4 +-
 sbin/ipf/libipf/remove_hashnode.c         |   6 +-
 sbin/ipf/libipf/remove_pool.c             |   4 +-
 sbin/ipf/libipf/remove_poolnode.c         |   7 +-
 sbin/ipf/libipf/resetlexer.c              |   2 +-
 sbin/ipf/libipf/rwlock_emul.c             |  32 ++---
 sbin/ipf/libipf/save_execute.c            |  10 +-
 sbin/ipf/libipf/save_file.c               |  19 +--
 sbin/ipf/libipf/save_nothing.c            |   7 +-
 sbin/ipf/libipf/save_syslog.c             |  10 +-
 sbin/ipf/libipf/save_v1trap.c             |  40 ++----
 sbin/ipf/libipf/save_v2trap.c             |  37 ++---
 sbin/ipf/libipf/tcp_flags.c               |   5 +-
 sbin/ipf/libipf/tcpflags.c                |   3 +-
 sbin/ipf/libipf/v6optvalue.c              |   6 +-
 sbin/ipf/libipf/var.c                     |  12 +-
 sbin/ipf/libipf/vtof.c                    |   3 +-
 share/examples/ipfilter/l4check/l4check.c |  60 ++++----
 155 files changed, 864 insertions(+), 1627 deletions(-)

diff --git a/sbin/ipf/common/ipf_y.y b/sbin/ipf/common/ipf_y.y
index 2013fe5b9452..861d0ccd9a13 100644
--- a/sbin/ipf/common/ipf_y.y
+++ b/sbin/ipf/common/ipf_y.y
@@ -1983,11 +1983,8 @@ static	struct	wordtab logwords[] = {
 
 
 
-int ipf_parsefile(fd, addfunc, iocfuncs, filename)
-int fd;
-addfunc_t addfunc;
-ioctlfunc_t *iocfuncs;
-char *filename;
+int
+ipf_parsefile(int fd, addfunc_t addfunc, ioctlfunc_t *iocfuncs, char *filename)
 {
 	FILE *fp = NULL;
 	char *s;
@@ -2019,11 +2016,8 @@ char *filename;
 }
 
 
-int ipf_parsesome(fd, addfunc, iocfuncs, fp)
-int fd;
-addfunc_t addfunc;
-ioctlfunc_t *iocfuncs;
-FILE *fp;
+int
+ipf_parsesome(int fd, addfunc_t addfunc, ioctlfunc_t *iocfuncs, FILE *fp)
 {
 	char *s;
 	int i;
@@ -2054,7 +2048,8 @@ FILE *fp;
 }
 
 
-static void newrule()
+static void
+newrule(void)
 {
 	frentry_t *frn;
 
@@ -2086,7 +2081,8 @@ static void newrule()
 }
 
 
-static void setipftype()
+static void
+setipftype(void)
 {
 	for (fr = frc; fr != NULL; fr = fr->fr_next) {
 		if (fr->fr_type == FR_T_NONE) {
@@ -2111,7 +2107,8 @@ static void setipftype()
 }
 
 
-static frentry_t *addrule()
+static frentry_t *
+addrule(void)
 {
 	frentry_t *f, *f1, *f2;
 	int count;
@@ -2141,9 +2138,7 @@ static frentry_t *addrule()
 
 
 static int
-lookuphost(name, addrp)
-	char *name;
-	i6addr_t *addrp;
+lookuphost(char *name, i6addr_t *addrp)
 {
 	int i;
 
@@ -2169,9 +2164,8 @@ lookuphost(name, addrp)
 }
 
 
-static void dobpf(v, phrase)
-int v;
-char *phrase;
+static void
+dobpf(int v, char *phrase)
 {
 #ifdef IPFILTER_BPF
 	struct bpf_program bpf;
@@ -2264,7 +2258,8 @@ char *phrase;
 }
 
 
-static void resetaddr()
+static void
+resetaddr(void)
 {
 	hashed = 0;
 	pooled = 0;
@@ -2272,8 +2267,8 @@ static void resetaddr()
 }
 
 
-static alist_t *newalist(ptr)
-alist_t *ptr;
+static alist_t *
+newalist(alist_t *ptr)
 {
 	alist_t *al;
 
@@ -2287,8 +2282,7 @@ alist_t *ptr;
 
 
 static int
-makepool(list)
-	alist_t *list;
+makepool(alist_t *list)
 {
 	ip_pool_node_t *n, *top;
 	ip_pool_t pool;
@@ -2344,8 +2338,8 @@ makepool(list)
 }
 
 
-static u_int makehash(list)
-alist_t *list;
+static u_int
+makehash(alist_t *list)
 {
 	iphtent_t *n, *top;
 	iphtable_t iph;
@@ -2393,10 +2387,8 @@ alist_t *list;
 }
 
 
-int ipf_addrule(fd, ioctlfunc, ptr)
-int fd;
-ioctlfunc_t ioctlfunc;
-void *ptr;
+int
+ipf_addrule(int fd, ioctlfunc_t ioctlfunc, void *ptr)
 {
 	ioctlcmd_t add, del;
 	frentry_t *fr;
@@ -2487,22 +2479,24 @@ void *ptr;
 	return 0;
 }
 
-static void setsyslog()
+static void
+setsyslog(void)
 {
 	yysetdict(logwords);
 	yybreakondot = 1;
 }
 
 
-static void unsetsyslog()
+static void
+unsetsyslog(void)
 {
 	yyresetdict();
 	yybreakondot = 0;
 }
 
 
-static void fillgroup(fr)
-frentry_t *fr;
+static void
+fillgroup(frentry_t *fr)
 {
 	frentry_t *f;
 
@@ -2544,8 +2538,8 @@ frentry_t *fr;
 }
 
 
-static void doipfexpr(line)
-char *line;
+static void
+doipfexpr(char *line)
 {
 	int *array;
 	char *error;
@@ -2563,9 +2557,8 @@ char *line;
 }
 
 
-static void do_tuneint(varname, value)
-char *varname;
-int value;
+static void
+do_tuneint(char *varname, int value)
 {
 	char buffer[80];
 
@@ -2577,8 +2570,8 @@ int value;
 }
 
 
-static void do_tunestr(varname, value)
-char *varname, *value;
+static void
+do_tunestr(char *varname, char *value)
 {
 
 	if (!strcasecmp(value, "true")) {
@@ -2591,10 +2584,8 @@ char *varname, *value;
 }
 
 
-static void setifname(frp, idx, name)
-frentry_t **frp;
-int idx;
-char *name;
+static void
+setifname(frentry_t **frp, int idx, char *name)
 {
 	int pos;
 
@@ -2605,9 +2596,8 @@ char *name;
 }
 
 
-static int addname(frp, name)
-frentry_t **frp;
-char *name;
+static int
+addname(frentry_t **frp, char *name)
 {
 	frentry_t *f;
 	int nlen;
@@ -2631,7 +2621,8 @@ char *name;
 }
 
 
-static frentry_t *allocfr()
+static frentry_t *
+allocfr(void)
 {
 	frentry_t *fr;
 
@@ -2654,9 +2645,8 @@ static frentry_t *allocfr()
 }
 
 
-static void setgroup(frp, name)
-frentry_t **frp;
-char *name;
+static void
+setgroup(frentry_t **frp, char *name)
 {
 	int pos;
 
@@ -2667,9 +2657,8 @@ char *name;
 }
 
 
-static void setgrhead(frp, name)
-frentry_t **frp;
-char *name;
+static void
+setgrhead(frentry_t **frp, char *name)
 {
 	int pos;
 
@@ -2680,9 +2669,8 @@ char *name;
 }
 
 
-static void seticmphead(frp, name)
-frentry_t **frp;
-char *name;
+static void
+seticmphead(frentry_t **frp, char *name)
 {
 	int pos;
 
@@ -2694,9 +2682,7 @@ char *name;
 
 
 static void
-build_dstaddr_af(fp, ptr)
-	frentry_t *fp;
-	void *ptr;
+build_dstaddr_af(frentry_t *fp, void *ptr)
 {
 	struct ipp_s *ipp = ptr;
 	frentry_t *f = fp;
@@ -2725,9 +2711,7 @@ build_dstaddr_af(fp, ptr)
 
 
 static void
-build_srcaddr_af(fp, ptr)
-	frentry_t *fp;
-	void *ptr;
+build_srcaddr_af(frentry_t *fp, void *ptr)
 {
 	struct ipp_s *ipp = ptr;
 	frentry_t *f = fp;
diff --git a/sbin/ipf/common/lexer.c b/sbin/ipf/common/lexer.c
index 2dc2c3e8fe8c..bb401612ad9d 100644
--- a/sbin/ipf/common/lexer.c
+++ b/sbin/ipf/common/lexer.c
@@ -60,8 +60,8 @@ static	char		*yytexttostr(int, int);
 static	void		yystrtotext(char *);
 static	char		*yytexttochar(void);
 
-static int yygetc(docont)
-	int docont;
+static int
+yygetc(int docont)
 {
 	int c;
 
@@ -98,8 +98,8 @@ static int yygetc(docont)
 }
 
 
-static void yyunputc(c)
-	int c;
+static void
+yyunputc(int c)
 {
 	if (c == '\n')
 		yylineNum--;
@@ -107,8 +107,8 @@ static void yyunputc(c)
 }
 
 
-static int yyswallow(last)
-	int last;
+static int
+yyswallow(int last)
 {
 	int c;
 
@@ -123,7 +123,8 @@ static int yyswallow(last)
 }
 
 
-static char *yytexttochar()
+static char *
+yytexttochar(void)
 {
 	int i;
 
@@ -134,8 +135,8 @@ static char *yytexttochar()
 }
 
 
-static void yystrtotext(str)
-	char *str;
+static void
+yystrtotext(char *str)
 {
 	int len;
 	char *s;
@@ -150,8 +151,8 @@ static void yystrtotext(str)
 }
 
 
-static char *yytexttostr(offset, max)
-	int offset, max;
+static char *
+yytexttostr(int offset, int max)
 {
 	char *str;
 	int i;
@@ -174,7 +175,8 @@ static char *yytexttostr(offset, max)
 }
 
 
-int yylex()
+int
+yylex(void)
 {
 	static int prior = 0;
 	static int priornum = 0;
@@ -616,8 +618,8 @@ static wordtab_t *yyfindkey(key)
 }
 
 
-char *yykeytostr(num)
-	int num;
+char *
+yykeytostr(int num)
 {
 	wordtab_t *w;
 
@@ -631,8 +633,8 @@ char *yykeytostr(num)
 }
 
 
-wordtab_t *yysettab(words)
-	wordtab_t *words;
+wordtab_t *
+yysettab(wordtab_t *words)
 {
 	wordtab_t *save;
 
@@ -642,8 +644,8 @@ wordtab_t *yysettab(words)
 }
 
 
-void yyerror(msg)
-	char *msg;
+void
+yyerror(char *msg)
 {
 	char *txt, letter[2];
 	int freetxt = 0;
@@ -669,8 +671,8 @@ void yyerror(msg)
 }
 
 
-void yysetfixeddict(newdict)
-	wordtab_t *newdict;
+void
+yysetfixeddict(wordtab_t *newdict)
 {
 	if (yydebug)
 		printf("yysetfixeddict(%lx)\n", (u_long)newdict);
@@ -688,8 +690,8 @@ void yysetfixeddict(newdict)
 }
 
 
-void yysetdict(newdict)
-	wordtab_t *newdict;
+void
+yysetdict(wordtab_t *newdict)
 {
 	if (yydebug)
 		printf("yysetdict(%lx)\n", (u_long)newdict);
@@ -705,7 +707,8 @@ void yysetdict(newdict)
 		printf("yysavedepth++ => %d\n", yysavedepth);
 }
 
-void yyresetdict()
+void
+yyresetdict(void)
 {
 	if (yydebug)
 		printf("yyresetdict(%d)\n", yysavedepth);
@@ -720,9 +723,8 @@ void yyresetdict()
 
 
 #ifdef	TEST_LEXER
-int main(argc, argv)
-	int argc;
-	char *argv[];
+int
+main(int argc, char *argv[])
 {
 	int n;
 
diff --git a/sbin/ipf/ipf/ipf.c b/sbin/ipf/ipf/ipf.c
index 406737e25d8e..3567a82484fb 100644
--- a/sbin/ipf/ipf/ipf.c
+++ b/sbin/ipf/ipf/ipf.c
@@ -66,9 +66,8 @@ static void usage()
 }
 
 
-int main(argc,argv)
-	int argc;
-	char *argv[];
+int
+main(int argc, char *argv[])
 {
 	int c, *filter = NULL;
 
@@ -171,9 +170,8 @@ int main(argc,argv)
 }
 
 
-static int opendevice(ipfdev, check)
-	char *ipfdev;
-	int check;
+static int
+opendevice(char *ipfdev, int check)
 {
 	if (opts & OPT_DONOTHING)
 		return -2;
@@ -194,14 +192,16 @@ static int opendevice(ipfdev, check)
 }
 
 
-static void closedevice()
+static void
+closedevice(void)
 {
 	close(fd);
 	fd = -1;
 }
 
 
-static	int	get_flags()
+static int
+get_flags(void)
 {
 	int i = 0;
 
@@ -214,8 +214,8 @@ static	int	get_flags()
 }
 
 
-static	void	set_state(enable)
-	u_int	enable;
+static void
+set_state(u_int enable)
 {
 	if (opendevice(ipfname, 0) != -2) {
 		if (ioctl(fd, SIOCFRENB, &enable) == -1) {
@@ -231,8 +231,8 @@ static	void	set_state(enable)
 }
 
 
-static	void	procfile(file)
-	char	*file;
+static void
+procfile(char *file)
 {
 	(void) opendevice(ipfname, 1);
 
@@ -248,10 +248,8 @@ static	void	procfile(file)
 }
 
 
-static int ipf_interceptadd(fd, ioctlfunc, ptr)
-	int fd;
-	ioctlfunc_t ioctlfunc;
-	void *ptr;
+static int
+ipf_interceptadd(int fd, ioctlfunc_t ioctlfunc, void *ptr)
 {
 	if (outputc)
 		printc(ptr);
@@ -262,8 +260,8 @@ static int ipf_interceptadd(fd, ioctlfunc, ptr)
 }
 
 
-static void packetlogon(opt)
-	char	*opt;
+static void
+packetlogon(char *opt)
 {
 	int	flag, xfd, logopt, change = 0;
 
@@ -346,9 +344,8 @@ static void packetlogon(opt)
 }
 
 
-static void flushfilter(arg, filter)
-	char *arg;
-	int *filter;
+static void
+flushfilter(char *arg, int *filter)
 {
 	int	fl = 0, rem;
 
@@ -441,7 +438,8 @@ static void flushfilter(arg, filter)
 }
 
 
-static void swapactive()
+static void
+swapactive(void)
 {
 	int in = 2;
 
@@ -452,7 +450,8 @@ static void swapactive()
 }
 
 
-void ipf_frsync()
+void
+ipf_frsync(void)
 {
 	int frsyn = 0;
 
@@ -463,7 +462,8 @@ void ipf_frsync()
 }
 
 
-void zerostats()
+void
+zerostats(void)
 {
 	ipfobj_t	obj;
 	friostat_t	fio;
@@ -488,8 +488,8 @@ void zerostats()
 /*
  * read the kernel stats for packets blocked and passed
  */
-static void showstats(fp)
-	friostat_t	*fp;
+static void
+showstats(friostat_t *fp)
 {
 	printf("bad packets:\t\tin %lu\tout %lu\n",
 			fp->f_st[0].fr_bad, fp->f_st[1].fr_bad);
@@ -508,7 +508,8 @@ static void showstats(fp)
 }
 
 
-static int showversion()
+static int
+showversion(void)
 {
 	struct friostat fio;
 	ipfobj_t ipfo;
diff --git a/sbin/ipf/ipf/ipfcomp.c b/sbin/ipf/ipf/ipfcomp.c
index 5bbb35c610fa..105ff2b852e8 100644
--- a/sbin/ipf/ipf/ipfcomp.c
+++ b/sbin/ipf/ipf/ipfcomp.c
@@ -62,8 +62,8 @@ static	FILE	*cfile = NULL;
  * This is called once per filter rule being loaded to emit data structures
  * required.
  */
-void printc(fr)
-	frentry_t *fr;
+void
+printc(frentry_t *fr)
 {
 	u_long *ulp;
 	char *and;
@@ -162,9 +162,8 @@ void printc(fr)
 static frgroup_t *groups = NULL;
 
 
-static void addrule(fp, fr)
-	FILE *fp;
-	frentry_t *fr;
+static void
+addrule(FILE *fp, frentry_t *fr)
 {
 	frentry_t *f, **fpp;
 	frgroup_t *g;
@@ -243,8 +242,8 @@ static u_long ipf%s_rule_data_%s_%u[] = {\n",
 }
 
 
-int intcmp(c1, c2)
-	const void *c1, *c2;
+int
+intcmp(const void *c1, const void *c2)
 {
 	const mc_t *i1 = (const mc_t *)c1, *i2 = (const mc_t *)c2;
 
@@ -255,18 +254,15 @@ int intcmp(c1, c2)
 }
 
 
-static void indent(fp, in)
-	FILE *fp;
-	int in;
+static void
+indent(FILE *fp, int in)
 {
 	for (; in; in--)
 		fputc('\t', fp);
 }
 
-static void printeq(fp, var, m, max, v)
-	FILE *fp;
-	char *var;
-	int m, max, v;
+static void
+printeq(FILE *fp, char *var, int m, int max, int v)
 {
 	if (m == max)
 		fprintf(fp, "%s == %#x) {\n", var, v);
@@ -280,10 +276,8 @@ static void printeq(fp, var, m, max, v)
  *             m - netmask
  *             v - required address
  */
-static void printipeq(fp, var, fl, m, v)
-	FILE *fp;
-	char *var;
-	int fl, m, v;
+static void
+printipeq(FILE *fp, char *var, int fl, int m, int v)
 {
 	if (m == 0xffffffff)
 		fprintf(fp, "%s ", var);
@@ -294,10 +288,8 @@ static void printipeq(fp, var, fl, m, v)
 }
 
 
-void emit(num, dir, v, fr)
-	int num, dir;
-	void *v;
-	frentry_t *fr;
+void
+emit(int num, int dir, void *v, frentry_t *fr)
 {
 	u_int incnt, outcnt;
 	frgroup_t *g;
@@ -346,9 +338,8 @@ void emit(num, dir, v, fr)
 }
 
 
-static void emitheader(grp, incount, outcount)
-	frgroup_t *grp;
-	u_int incount, outcount;
+static void
+emitheader(frgroup_t *grp, u_int incount, u_int outcount)
 {
 	static FILE *fph = NULL;
 	frgroup_t *g;
@@ -401,7 +392,8 @@ extern int ipfrule_remove_out_%s(void));\n",
 	}
 }
 
-static void emittail()
+static void
+emittail(void)
 {
 	frgroup_t *g;
 
@@ -438,12 +430,9 @@ int ipfrule_remove()\n\
 }
 
 
-static void emitGroup(num, dir, v, fr, group, incount, outcount)
-	int num, dir;
-	void *v;
-	frentry_t *fr;
-	char *group;
-	u_int incount, outcount;
+static void
+emitGroup(int num, int dir, void *v, frentry_t *fr, char *group,
+	u_int incount, u_int outcount)
 {
 	static FILE *fp = NULL;
 	static int header[2] = { 0, 0 };
@@ -956,8 +945,8 @@ static void emitGroup(num, dir, v, fr, group, incount, outcount)
 }
 
 
-void printC(dir)
-	int dir;
+void
+printC(int dir)
 {
 	static mc_t *m = NULL;
 	frgroup_t *g;
@@ -979,11 +968,8 @@ void printC(dir)
 /*
  * Now print out code to implement all of the rules.
  */
-static void printCgroup(dir, top, m, group)
-	int dir;
-	frentry_t *top;
-	mc_t *m;
-	char *group;
+static void
+printCgroup(int dir, frentry_t *top, mc_t *m, char *group)
 {
 	frentry_t *fr, *fr1;
 	int i, n, rn;
@@ -1229,11 +1215,8 @@ static void printCgroup(dir, top, m, group)
 	}
 }
 
-static void printhooks(fp, in, out, grp)
-	FILE *fp;
-	int in;
-	int out;
-	frgroup_t *grp;
+static void
+printhooks(FILE *fp, int in, int out, frgroup_t *grp)
 {
 	frentry_t *fr;
 	char *group;
diff --git a/sbin/ipf/ipfs/ipfs.c b/sbin/ipf/ipfs/ipfs.c
index e9a535977bd9..680d2659ca51 100644
--- a/sbin/ipf/ipfs/ipfs.c
+++ b/sbin/ipf/ipfs/ipfs.c
@@ -87,8 +87,7 @@ void usage()
 /*
  * Change interface names in state information saved out to disk.
  */
-int changestateif(ifs, fname)
-	char *ifs, *fname;
+int changestateif(char *ifs, char *fname)
 {
 	int fd, olen, nlen, rw;
 	ipstate_save_t ips;
@@ -150,8 +149,7 @@ int changestateif(ifs, fname)
 /*
  * Change interface names in NAT information saved out to disk.
  */
-int changenatif(ifs, fname)
-	char *ifs, *fname;
+int changenatif(char *ifs, char *fname)
 {
 	int fd, olen, nlen, rw;
 	nat_save_t ipn;
@@ -204,9 +202,7 @@ int changenatif(ifs, fname)
 }
 
 
-int main(argc,argv)
-	int argc;
-	char *argv[];
+int main(int argc, char *argv[])
 {
 	int c, lock = -1, devfd = -1, err = 0, rw = -1, ns = -1, set = 0;
 	char *dirname = NULL, *filename = NULL, *ifs = NULL;
@@ -335,8 +331,7 @@ int main(argc,argv)
*** 6508 LINES SKIPPED ***