aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYan-Hao Wang <yanhaowang@FreeBSD.org>2024-10-12 14:47:51 +0000
committerLi-Wen Hsu <lwhsu@FreeBSD.org>2024-10-12 18:21:46 +0000
commit54ff53d89015cd4338bcca6060fe2877309f6db3 (patch)
tree604de143a4b14b2dee5c3a112b66e7ce467484cb
parent417842f908619336dd4c739a92c326ade2c35770 (diff)
downloadsrc-54ff53d89015.tar.gz
src-54ff53d89015.zip
ndp(8): Complete libxo transition
Reviewed by: des MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D41417
-rw-r--r--usr.sbin/ndp/ndp.c20
-rw-r--r--usr.sbin/ndp/ndp_netlink.c6
2 files changed, 12 insertions, 14 deletions
diff --git a/usr.sbin/ndp/ndp.c b/usr.sbin/ndp/ndp.c
index 7c7bc60451c8..a023a7d0ad77 100644
--- a/usr.sbin/ndp/ndp.c
+++ b/usr.sbin/ndp/ndp.c
@@ -103,7 +103,6 @@
#include <stdio.h>
#include <string.h>
#include <paths.h>
-#include <err.h>
#include <stdint.h>
#include <stdlib.h>
#include <fcntl.h>
@@ -350,7 +349,8 @@ main(int argc, char **argv)
break;
}
xo_close_container("ndp");
- xo_finish();
+ if (xo_finish() < 0)
+ xo_err(1, "stdout");
return (ret);
}
@@ -921,16 +921,16 @@ ndp_ether_aton(char *a, u_char *n)
static void
usage(void)
{
- printf("usage: ndp [-nt] hostname\n");
- printf(" ndp [-nt] -a | -c | -p | -r | -H | -P | -R\n");
- printf(" ndp [-nt] -A wait\n");
- printf(" ndp [-nt] -d hostname\n");
- printf(" ndp [-nt] -f filename\n");
- printf(" ndp [-nt] -i interface [flags...]\n");
+ xo_error("usage: ndp [-nt] hostname\n");
+ xo_error(" ndp [-nt] -a | -c | -p | -r | -H | -P | -R\n");
+ xo_error(" ndp [-nt] -A wait\n");
+ xo_error(" ndp [-nt] -d hostname\n");
+ xo_error(" ndp [-nt] -f filename\n");
+ xo_error(" ndp [-nt] -i interface [flags...]\n");
#ifdef SIOCSDEFIFACE_IN6
- printf(" ndp [-nt] -I [interface|delete]\n");
+ xo_error(" ndp [-nt] -I [interface|delete]\n");
#endif
- printf(" ndp [-nt] -s nodename etheraddr [temp] [proxy]\n");
+ xo_error(" ndp [-nt] -s nodename etheraddr [temp] [proxy]\n");
exit(1);
}
diff --git a/usr.sbin/ndp/ndp_netlink.c b/usr.sbin/ndp/ndp_netlink.c
index bafa9f2a143d..546057e5e552 100644
--- a/usr.sbin/ndp/ndp_netlink.c
+++ b/usr.sbin/ndp/ndp_netlink.c
@@ -28,7 +28,6 @@
#include <stdio.h>
#include <string.h>
#include <paths.h>
-#include <err.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
@@ -42,7 +41,6 @@
#include <netlink/netlink_snl_route_compat.h>
#include <netlink/netlink_snl_route_parsers.h>
-#include <libxo/xo.h>
#include "ndp.h"
#define RTF_ANNOUNCE RTF_PROTO2
@@ -56,12 +54,12 @@ nl_init_socket(struct snl_state *ss)
if (modfind("netlink") == -1 && errno == ENOENT) {
/* Try to load */
if (kldload("netlink") == -1)
- err(1, "netlink is not loaded and load attempt failed");
+ xo_err(1, "netlink is not loaded and load attempt failed");
if (snl_init(ss, NETLINK_ROUTE))
return;
}
- err(1, "unable to open netlink socket");
+ xo_err(1, "unable to open netlink socket");
}
static bool