aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2023-04-03 02:00:25 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2023-04-03 19:48:49 +0000
commitbef81bc0aef9dd4cd772b292d81bcc0ff7151d9f (patch)
tree3a6237c39554edf66b6af582b0e9eab9348e3fa1
parent462c3d3cf45eca034683d9793b9ce09381346744 (diff)
downloadsrc-bef81bc0aef9dd4cd772b292d81bcc0ff7151d9f.tar.gz
src-bef81bc0aef9dd4cd772b292d81bcc0ff7151d9f.zip
setkey(8): ansify parser
Sponsored by: NVidia networking MFC after: 1 week
-rw-r--r--sbin/setkey/parse.y51
-rw-r--r--sbin/setkey/token.l9
2 files changed, 16 insertions, 44 deletions
diff --git a/sbin/setkey/parse.y b/sbin/setkey/parse.y
index 0d8605c3409a..3d3ed123d4f0 100644
--- a/sbin/setkey/parse.y
+++ b/sbin/setkey/parse.y
@@ -773,11 +773,7 @@ policy_requests
%%
int
-setkeymsg0(msg, type, satype, l)
- struct sadb_msg *msg;
- unsigned int type;
- unsigned int satype;
- size_t l;
+setkeymsg0(struct sadb_msg *msg, unsigned type, unsigned satype, size_t l)
{
msg->sadb_msg_version = PF_KEY_V2;
@@ -793,14 +789,8 @@ setkeymsg0(msg, type, satype, l)
/* XXX NO BUFFER OVERRUN CHECK! BAD BAD! */
static int
-setkeymsg_spdaddr(type, upper, policy, srcs, splen, dsts, dplen)
- unsigned int type;
- unsigned int upper;
- vchar_t *policy;
- struct addrinfo *srcs;
- int splen;
- struct addrinfo *dsts;
- int dplen;
+setkeymsg_spdaddr(unsigned type, unsigned upper, vchar_t *policy,
+ struct addrinfo *srcs, int splen, struct addrinfo *dsts, int dplen)
{
struct sadb_msg *msg;
char buf[BUFSIZ];
@@ -892,12 +882,8 @@ setkeymsg_spdaddr(type, upper, policy, srcs, splen, dsts, dplen)
/* XXX NO BUFFER OVERRUN CHECK! BAD BAD! */
static int
-setkeymsg_addr(type, satype, srcs, dsts, no_spi)
- unsigned int type;
- unsigned int satype;
- struct addrinfo *srcs;
- struct addrinfo *dsts;
- int no_spi;
+setkeymsg_addr(unsigned type, unsigned satype, struct addrinfo *srcs,
+ struct addrinfo *dsts, int no_spi)
{
struct sadb_msg *msg;
char buf[BUFSIZ];
@@ -1023,11 +1009,8 @@ setkeymsg_addr(type, satype, srcs, dsts, no_spi)
/* XXX NO BUFFER OVERRUN CHECK! BAD BAD! */
static int
-setkeymsg_add(type, satype, srcs, dsts)
- unsigned int type;
- unsigned int satype;
- struct addrinfo *srcs;
- struct addrinfo *dsts;
+setkeymsg_add(unsigned type, unsigned satype, struct addrinfo *srcs,
+ struct addrinfo *dsts)
{
struct sadb_msg *msg;
char buf[BUFSIZ];
@@ -1211,9 +1194,7 @@ setkeymsg_add(type, satype, srcs, dsts)
}
static struct addrinfo *
-parse_addr(host, port)
- char *host;
- char *port;
+parse_addr(char *host, char *port)
{
struct addrinfo hints, *res = NULL;
int error;
@@ -1232,8 +1213,7 @@ parse_addr(host, port)
}
static int
-fix_portstr(spec, sport, dport)
- vchar_t *spec, *sport, *dport;
+fix_portstr(vchar_t *spec, vchar_t *sport, vchar_t *dport)
{
char *p, *p2;
u_int l;
@@ -1273,13 +1253,8 @@ fix_portstr(spec, sport, dport)
}
static int
-setvarbuf(buf, off, ebuf, elen, vbuf, vlen)
- char *buf;
- int *off;
- struct sadb_ext *ebuf;
- int elen;
- caddr_t vbuf;
- int vlen;
+setvarbuf(char *buf, int *off, struct sadb_ext *ebuf, int elen, caddr_t vbuf,
+ int vlen)
{
memset(buf + *off, 0, PFKEY_UNUNIT64(ebuf->sadb_ext_len));
memcpy(buf + *off, (caddr_t)ebuf, elen);
@@ -1290,7 +1265,7 @@ setvarbuf(buf, off, ebuf, elen, vbuf, vlen)
}
void
-parse_init()
+parse_init(void)
{
p_spi = 0;
@@ -1309,7 +1284,7 @@ parse_init()
}
void
-free_buffer()
+free_buffer(void)
{
/* we got tons of memory leaks in the parser anyways, leave them */
}
diff --git a/sbin/setkey/token.l b/sbin/setkey/token.l
index 1cf2a43fe323..44b1ffbfaa32 100644
--- a/sbin/setkey/token.l
+++ b/sbin/setkey/token.l
@@ -253,23 +253,20 @@ any { return(ANY); }
%%
void
-yyfatal(s)
- const char *s;
+yyfatal(const char *s)
{
yyerror(s);
exit(1);
}
void
-yyerror(s)
- const char *s;
+yyerror(const char *s)
{
printf("line %d: %s at [%s]\n", lineno, s, yytext);
}
int
-parse(fp)
- FILE **fp;
+parse(FILE **fp)
{
yyin = *fp;