From c5f282daad8b9d7350ede24c4dd63a7291f7e37d Mon Sep 17 00:00:00 2001 From: Alexey Dokuchaev Date: Fri, 23 Jan 2015 07:30:57 +0000 Subject: [PATCH] Fix usage example in kvprintf(9) and its copy in libstand(3): trailing '\n' in bitfield argument is wrong, as it will be treated as bit 10, causing any code printing >=10 bits with bit 10 on as having a trailing comma. Newline (intended one) should be part of the format string (already present in the examples). Also fix grammar and kill EOL whitespace in comment while here. PR: 195005 Approved by: bdrewery --- lib/libstand/libstand.3 | 2 +- lib/libstand/printf.c | 4 ++-- share/man/man9/printf.9 | 2 +- sys/kern/subr_prf.c | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/libstand/libstand.3 b/lib/libstand/libstand.3 index b42c8b5bdd7..42289c1bce4 100644 --- a/lib/libstand/libstand.3 +++ b/lib/libstand/libstand.3 @@ -288,7 +288,7 @@ Thus printf( .Qq reg=%b\en , 3, -.Qq \e10\e2BITTWO\e1BITONE\en +.Qq \e10\e2BITTWO\e1BITONE ); .Ed .Pp diff --git a/lib/libstand/printf.c b/lib/libstand/printf.c index 157b327ead8..fef53416561 100644 --- a/lib/libstand/printf.c +++ b/lib/libstand/printf.c @@ -187,7 +187,7 @@ ksprintn(char *nbuf, uintmax_t num, int base, int *lenp, int upper) * the next characters (up to a control character, i.e. a character <= 32), * give the name of the register. Thus: * - * kvprintf("reg=%b\n", 3, "\10\2BITTWO\1BITONE\n"); + * kvprintf("reg=%b\n", 3, "\10\2BITTWO\1BITONE"); * * would produce output: * @@ -500,7 +500,7 @@ number: while (percent < fmt) PCHAR(*percent++); /* - * Since we ignore an formatting argument it is no + * Since we ignore a formatting argument it is no * longer safe to obey the remaining formatting * arguments as the arguments will no longer match * the format specs. diff --git a/share/man/man9/printf.9 b/share/man/man9/printf.9 index 571e7e638c3..84ac822da02 100644 --- a/share/man/man9/printf.9 +++ b/share/man/man9/printf.9 @@ -151,7 +151,7 @@ void printf_test(void) { - printf("reg=%b\en", 3, "\e10\e2BITTWO\e1BITONE\en"); + printf("reg=%b\en", 3, "\e10\e2BITTWO\e1BITONE"); printf("out: %4D\en", "AAAA", ":"); } .Ed diff --git a/sys/kern/subr_prf.c b/sys/kern/subr_prf.c index 814e57f4794..cc30de1f645 100644 --- a/sys/kern/subr_prf.c +++ b/sys/kern/subr_prf.c @@ -598,7 +598,7 @@ ksprintn(char *nbuf, uintmax_t num, int base, int *lenp, int upper) * the next characters (up to a control character, i.e. a character <= 32), * give the name of the register. Thus: * - * kvprintf("reg=%b\n", 3, "\10\2BITTWO\1BITONE\n"); + * kvprintf("reg=%b\n", 3, "\10\2BITTWO\1BITONE"); * * would produce output: * @@ -911,7 +911,7 @@ number: while (percent < fmt) PCHAR(*percent++); /* - * Since we ignore a formatting argument it is no + * Since we ignore a formatting argument it is no * longer safe to obey the remaining formatting * arguments as the arguments will no longer match * the format specs.