Subject: kern/19559: bitmask_snprintf(9) does not document extended format
To: None <email@example.com>
From: None <firstname.lastname@example.org>
Date: 12/25/2002 00:27:34
>Synopsis: bitmask_snprintf(9) does not document extended format
>Arrival-Date: Wed Dec 25 00:28:00 PST 2002
>Originator: Ron Roskens
The man page for bitmask_snprintf(9) says its a bug that the new extended format is not described in the man page.
Also, the man page makes refernce to bit 32 being the most significant bit which is not true since val is a u_quad_t of 64 bits.
Change references to MSB from 32 to 64.
Add an example of the new format:
If the first character in fmt is '\177', then the extended format is used and the second character is the output numeral base. Sequences of NULL (\0) terminated strings are used until the decoding directive string is finished. The sequences begin with either a 'b', 'f' or 'F'.
When a 'b' character is used, a bit-position-description pair follows terminated by a '\0'. This format is the same as the old-style.
When a 'f' character is used, a bit-position-fieldlength-description tuple follows terminated by a '\0'. The bit-position and bit-field-length are single byte values, followed by a character string describing the bit-field. The output buffer will display the character string '=' bit-field-value. [ie: FIELD2=b ]
When an 'F' is used, '\0' terminated tuple is lengthened for a comparision case. Following the bit-position-fieldlength of the 'f' format is either an '=' or ':' character, a bit-field-value and a character string describing the bit-field. The string will only be displayed if bit-field-value is equal to the value corresponding to bit-field in val. When this format uses an '=' instead of a ':', the character string is preceded by an '=' in the output buffer.
bitmask_snprintf(ad, "\177\20" "b\0BITZERO\0b\1BITONE\0"