git: 00f003da7d07 - main - iscsictl(8): Complete libxo transition

From: Li-Wen Hsu <lwhsu_at_FreeBSD.org>
Date: Sat, 12 Oct 2024 18:30:25 UTC
The branch main has been updated by lwhsu:

URL: https://cgit.FreeBSD.org/src/commit/?id=00f003da7d0702caf10d3306b0290efe6b812d32

commit 00f003da7d0702caf10d3306b0290efe6b812d32
Author:     Yan-Hao Wang <yanhaowang@FreeBSD.org>
AuthorDate: 2024-10-12 15:26:55 +0000
Commit:     Li-Wen Hsu <lwhsu@FreeBSD.org>
CommitDate: 2024-10-12 18:21:48 +0000

    iscsictl(8): Complete libxo transition
    
    Reviewed by:    des
    MFC after:      3 days
    Differential Revision:  https://reviews.freebsd.org/D41423
---
 usr.bin/iscsictl/iscsictl.c | 31 ++++++++++++++++---------------
 1 file changed, 16 insertions(+), 15 deletions(-)

diff --git a/usr.bin/iscsictl/iscsictl.c b/usr.bin/iscsictl/iscsictl.c
index b75ff889a9a6..922e9ed9ebea 100644
--- a/usr.bin/iscsictl/iscsictl.c
+++ b/usr.bin/iscsictl/iscsictl.c
@@ -709,20 +709,20 @@ static void
 usage(void)
 {
 
-	fprintf(stderr, "usage: iscsictl -A -p portal -t target "
+	xo_error("usage: iscsictl -A -p portal -t target "
 	    "[-u user -s secret] [-w timeout] [-e on | off]\n");
-	fprintf(stderr, "       iscsictl -A -d discovery-host "
+	xo_error("       iscsictl -A -d discovery-host "
 	    "[-u user -s secret] [-e on | off]\n");
-	fprintf(stderr, "       iscsictl -A -a [-c path]\n");
-	fprintf(stderr, "       iscsictl -A -n nickname [-c path]\n");
-	fprintf(stderr, "       iscsictl -M -i session-id [-p portal] "
+	xo_error("       iscsictl -A -a [-c path]\n");
+	xo_error("       iscsictl -A -n nickname [-c path]\n");
+	xo_error("       iscsictl -M -i session-id [-p portal] "
 	    "[-t target] [-u user] [-s secret] [-e on | off]\n");
-	fprintf(stderr, "       iscsictl -M -i session-id -n nickname "
+	xo_error("       iscsictl -M -i session-id -n nickname "
 	    "[-c path]\n");
-	fprintf(stderr, "       iscsictl -R [-p portal] [-t target]\n");
-	fprintf(stderr, "       iscsictl -R -a\n");
-	fprintf(stderr, "       iscsictl -R -n nickname [-c path]\n");
-	fprintf(stderr, "       iscsictl -L [-v] [-w timeout]\n");
+	xo_error("       iscsictl -R [-p portal] [-t target]\n");
+	xo_error("       iscsictl -R -a\n");
+	xo_error("       iscsictl -R -n nickname [-c path]\n");
+	xo_error("       iscsictl -L [-v] [-w timeout]\n");
 	exit(1);
 }
 
@@ -743,8 +743,8 @@ main(int argc, char **argv)
 	struct target *targ;
 
 	argc = xo_parse_args(argc, argv);
-        if (argc < 0)
-                exit(1);
+	if (argc < 0)
+		exit(1);
 
 	xo_set_version(ISCSICTL_XO_VERSION);
 	xo_open_container("iscsictl");
@@ -1052,10 +1052,11 @@ main(int argc, char **argv)
 		xo_err(1, "close");
 
 	xo_close_container("iscsictl");
-	xo_finish();
+	if (xo_finish() < 0)
+		xo_err(1, "stdout");
 
 	if (failed != 0)
-		return (1);
+		exit(1);
 
-	return (0);
+	exit(0);
 }