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
This commit is contained in:
Alexey Dokuchaev 2015-01-23 07:30:57 +00:00
parent 5087ad0212
commit c5f282daad
4 changed files with 6 additions and 6 deletions

View File

@ -288,7 +288,7 @@ Thus
printf(
.Qq reg=%b\en ,
3,
.Qq \e10\e2BITTWO\e1BITONE\en
.Qq \e10\e2BITTWO\e1BITONE
);
.Ed
.Pp

View File

@ -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 @@ reswitch: switch (ch = (u_char)*fmt++) {
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.

View File

@ -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

View File

@ -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 @@ reswitch: switch (ch = (u_char)*fmt++) {
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.