aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhenlei Huang <zlei@FreeBSD.org>2024-10-31 16:32:13 +0000
committerZhenlei Huang <zlei@FreeBSD.org>2024-11-07 23:26:09 +0000
commit0be04cb5cb9854d71cd98b10a35111b289cd21a5 (patch)
tree4fdcce43e76585c6eab9d5de70a8b37ce6971866
parent35874d28c8391fa3583e7a2b008c5f84d0a3e3f7 (diff)
downloadsrc-0be04cb5cb9854d71cd98b10a35111b289cd21a5.tar.gz
src-0be04cb5cb9854d71cd98b10a35111b289cd21a5.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 Approved by: re (cperciva) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D47233 (cherry picked from commit 12c04071cf18d1b00ffcc7058fb01f4393163ede) (cherry picked from commit 54514cfa5a84a5d4406bbd5ba34f8950cf1a2b89)
-rw-r--r--usr.sbin/ndp/ndp.c9
-rw-r--r--usr.sbin/ndp/ndp.h1
2 files changed, 5 insertions, 5 deletions
diff --git a/usr.sbin/ndp/ndp.c b/usr.sbin/ndp/ndp.c
index e98e506ee482..89666f7eb633 100644
--- a/usr.sbin/ndp/ndp.c
+++ b/usr.sbin/ndp/ndp.c
@@ -125,7 +125,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() */
@@ -252,8 +251,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*/
}
@@ -823,10 +822,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 5b2558982e86..6e7aef2e416e 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;