From 85c6fd4058593ba7a03fc3a22b8a296fc8189628 Mon Sep 17 00:00:00 2001 From: Ryan Moeller Date: Thu, 12 Aug 2021 16:50:50 +0000 Subject: [PATCH] libzfs_sendrecv: Style pass on send_print_verbose * Add missing dgettext calls. * Avoid unnecessary line wraps. * Factor out duplicated parsable check. Reviewed-by: Brian Behlendorf Signed-off-by: Ryan Moeller Closes #12967 --- lib/libzfs/libzfs_sendrecv.c | 34 ++++++++++++++-------------------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/lib/libzfs/libzfs_sendrecv.c b/lib/libzfs/libzfs_sendrecv.c index 8f496b20b8..0cce749d96 100644 --- a/lib/libzfs/libzfs_sendrecv.c +++ b/lib/libzfs/libzfs_sendrecv.c @@ -981,39 +981,33 @@ send_print_verbose(FILE *fout, const char *tosnap, const char *fromsnap, { if (parsable) { if (fromsnap != NULL) { - (void) fprintf(fout, "incremental\t%s\t%s", - fromsnap, tosnap); + (void) fprintf(fout, dgettext(TEXT_DOMAIN, + "incremental\t%s\t%s"), fromsnap, tosnap); } else { - (void) fprintf(fout, "full\t%s", - tosnap); + (void) fprintf(fout, dgettext(TEXT_DOMAIN, + "full\t%s"), tosnap); } + (void) fprintf(fout, "\t%llu", (longlong_t)size); } else { if (fromsnap != NULL) { if (strchr(fromsnap, '@') == NULL && strchr(fromsnap, '#') == NULL) { (void) fprintf(fout, dgettext(TEXT_DOMAIN, - "send from @%s to %s"), - fromsnap, tosnap); + "send from @%s to %s"), fromsnap, tosnap); } else { (void) fprintf(fout, dgettext(TEXT_DOMAIN, - "send from %s to %s"), - fromsnap, tosnap); + "send from %s to %s"), fromsnap, tosnap); } } else { (void) fprintf(fout, dgettext(TEXT_DOMAIN, - "full send of %s"), - tosnap); + "full send of %s"), tosnap); + } + if (size != 0) { + char buf[16]; + zfs_nicebytes(size, buf, sizeof (buf)); + (void) fprintf(fout, dgettext(TEXT_DOMAIN, + " estimated size is %s"), buf); } - } - - if (parsable) { - (void) fprintf(fout, "\t%llu", - (longlong_t)size); - } else if (size != 0) { - char buf[16]; - zfs_nicebytes(size, buf, sizeof (buf)); - (void) fprintf(fout, dgettext(TEXT_DOMAIN, - " estimated size is %s"), buf); } (void) fprintf(fout, "\n"); }