Welcome to little lamb

Code » ssp » commit 45cd0ad

show: Minor cosmetic tweak

author Olivier Brunel
2023-04-18 10:51:07 UTC
committer Olivier Brunel
2023-04-19 07:16:36 UTC
parent cc02b778a8f989da33a8e03c1a6e17504982557b

show: Minor cosmetic tweak

Put multi-line comments on a new line, might help readability a bit.

src/ssp/show.c +6 -2

diff --git a/src/ssp/show.c b/src/ssp/show.c
index 9fa36cc..80fbdcf 100644
--- a/src/ssp/show.c
+++ b/src/ssp/show.c
@@ -3,6 +3,7 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 #include <errno.h>
 #include <limb/base32.h>
+#include <limb/bytestr.h>
 #include <limb/command.h>
 #include <limb/exitcode.h>
 #include <limb/output.h>
@@ -70,8 +71,11 @@ show_site(unsigned options, struct ssp *ctx)
         buf[l] = 0;
         out("   Secret: ", buf);
     }
-    if (otp->data[otp->slen])
-        out("   Comments:\n", otp->data + otp->slen);
+    if (otp->data[otp->slen]) {
+        const char *s = otp->data + otp->slen;
+        size_t l = strlen(s);
+        out("   Comments:", (byte_chr(s, l, '\n') < l) ? "\n" : " ", s);
+    }
 }
 
 void