diff options
author | Zhenlei Huang <zlei@FreeBSD.org> | 2024-10-31 16:32:13 +0000 |
---|---|---|
committer | Zhenlei Huang <zlei@FreeBSD.org> | 2024-10-31 16:32:13 +0000 |
commit | 12c04071cf18d1b00ffcc7058fb01f4393163ede (patch) | |
tree | a2bbe5d2d91433e0c0e549427039f2d7ea9f1b45 | |
parent | 2dccd21949f26b1bdf5e7cf258b760fffd3bf259 (diff) | |
download | src-12c04071cf18.tar.gz src-12c04071cf18.zip |
ndp: Move the global variable repeat into struct ndp_opts
An upcoming fix for the netlink based implementation requires this
refactoring.
No functional change intended.
Reviewed by: kp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D47233
-rw-r--r-- | usr.sbin/ndp/ndp.c | 9 | ||||
-rw-r--r-- | usr.sbin/ndp/ndp.h | 1 |
2 files changed, 5 insertions, 5 deletions
diff --git a/usr.sbin/ndp/ndp.c b/usr.sbin/ndp/ndp.c index 9a249a4987a7..6e6f40c3ff64 100644 --- a/usr.sbin/ndp/ndp.c +++ b/usr.sbin/ndp/ndp.c @@ -121,7 +121,6 @@ static pid_t pid; static int32_t thiszone; /* time difference with gmt */ static int s = -1; -static int repeat = 0; static char host_buf[NI_MAXHOST]; /* getnameinfo() */ static char ifix_buf[IFNAMSIZ]; /* if_indextoname() */ @@ -249,8 +248,8 @@ main(int argc, char **argv) /*NOTREACHED*/ } mode = 'a'; - repeat = atoi(optarg); - if (repeat < 0) { + opts.repeat = atoi(optarg); + if (opts.repeat < 0) { usage(); /*NOTREACHED*/ } @@ -828,10 +827,10 @@ again: if (buf != NULL) free(buf); - if (repeat) { + if (opts.repeat) { xo_emit("\n"); xo_flush(); - sleep(repeat); + sleep(opts.repeat); goto again; } diff --git a/usr.sbin/ndp/ndp.h b/usr.sbin/ndp/ndp.h index f89ab19a9d3f..7bd4ddcbfdd8 100644 --- a/usr.sbin/ndp/ndp.h +++ b/usr.sbin/ndp/ndp.h @@ -10,6 +10,7 @@ struct ndp_opts { bool tflag; int flags; time_t expire_time; + int repeat; }; extern struct ndp_opts opts; |