| #
1.40 |
|
09-Oct-2025 |
rillig |
libutil/snprintb: allow 'f' to be combined with ':'
But only if the numeric value can be clearly distinguished from the description. This style is used by sh3/dmacreg.h.
|
|
Revision tags: perseant-exfatfs-base-20250801 netbsd-11-base perseant-exfatfs-base-20240630 perseant-exfatfs-base
|
| #
1.39 |
|
08-Apr-2024 |
rillig |
snprintb.3: provide examples for hexadecimal character escapes
Suggested by uwe@, in reaction to the previous commit, which preferred octal in the examples. Hexadecimal escapes are more familiar to most programmers, and the chance of mistaking \x14 for decimal 14 is less than the chance of mistaking octal \014 for decimal 14.
|
| #
1.38 |
|
07-Apr-2024 |
rillig |
snprintb.3: clean up formatting and wording, prefer octal in examples
Using hexadecimal character escapes requires separate string literals if the description starts with one of the letters A-F; octal character escapes have at most 3 digits, reducing ambiguity.
|
| #
1.37 |
|
07-Apr-2024 |
rillig |
snprintb: reject combinations of 'f' with ':' as well as 'F' with '='
These combinations would lead to garbled output.
|
| #
1.36 |
|
29-Feb-2024 |
rillig |
snprintb.3: fix typo
|
| #
1.35 |
|
22-Feb-2024 |
rillig |
snprintb: always null-terminate output
Always null-terminate the output in the buffer, even in error cases. The wording in the manual page has been promising this since 2008. For snprintb_m, ensure that the output is terminated with two null characters, to gracefully handle situations in which the caller does not check whether snprintb returned an error.
If the buffer size is zero, allow the buffer to be a null pointer, analogous to snprintf.
Fix an out-of-bounds memory read if the bitfmt ends with a '*' directive (since today).
In the tests, merge the helper functions for snprintb, snprintb_m, as they were similar enough.
Fix a few 'line_max exceeded' tests, ensuring that they output a '#' marker, and that the 'complete' tests don't.
|
| #
1.34 |
|
22-Feb-2024 |
rillig |
snprintb: error out on out-of-bounds bit shifts
Previously, these invoked undefined behavior, now they lead to an early return. An example of out-of-bounds bit number is in SCZ_PCICTRL_BITS. Bit fields that extend beyond the msb are still allowed.
Allow 'f' and 'F' to have fields that are 64 bits wide. This only makes sense when the field starts at bit 0.
Remove the unused 'val_len', it was only needed before snprintb.c 1.20.
|
| #
1.33 |
|
20-Feb-2024 |
rillig |
snprintb.3: sync examples with reality
|
| #
1.32 |
|
18-Feb-2024 |
rillig |
mman.h: fix snprintb description for alignment 2^60
|
| #
1.31 |
|
15-Feb-2024 |
rillig |
snprintb: rename buflen to bufsize, following the wording in snprintf
|
| #
1.30 |
|
01-Feb-2024 |
rillig |
snprintb.3: fix examples, clean up wording
In the examples using hex escape sequences, there must be a delimiter between the escape sequence and the following description if the description starts with [A-Fa-f], as hex escape sequences are not limited in length.
Distinguish between a 'directive' (bit + length + description) and a 'description' (only the text).
The fmt parameter is not a string, as strings only reach to the first '\0' byte, but the new-style format may include additional '\0' as bit numbers.
|
| #
1.29 |
|
22-Jan-2024 |
uwe |
snprintb(3): restore empty string in snprintb_m example
Restore the empty string at the end of snprintb_m output that was accidentally removed along with empty string placeholders in the format strings. While here, move that example to be next to its snprintb counterpart.
|
| #
1.28 |
|
21-Jan-2024 |
uwe |
snprintb(3): update mmap example
Bring over the prettier version of the mmap format string that we have in the header file for some time now. Clarify that the final NUL of the new format string is supplied by the compiler, g/c explicit final \0 from the example that had it.
|
| #
1.27 |
|
21-Jan-2024 |
uwe |
snprintb(3): try to improve narration
Try to make the narration more coherent. Make the old and new syntaxes easy to distinguish and go out of our way to highlight that the old syntax uses 1-based bit positions.
|
| #
1.26 |
|
21-Jan-2024 |
rillig |
snprintb.3: remove empty string literals from examples
Suggested by uwe@, as gaps in bitmasks are quite common and thus shouldn't clutter the code.
|
| #
1.25 |
|
21-Jan-2024 |
rillig |
snprintb.3: fix examples
The first example broke the format string at boundaries that didn't highlight the structure of the format string and also didn't make it clear that a few bits were omitted from having descriptions.
The second example contained an off-by-one error for SIXTEEN, which was actually FIFTEEN.
The snprintb_m example repeated the above off-by-one error, and its output was shown wrong, due to concatenated escape sequences.
|
|
Revision tags: netbsd-10-1-RELEASE netbsd-10-0-RELEASE netbsd-10-0-RC6 netbsd-10-0-RC5 netbsd-10-0-RC4 netbsd-10-0-RC3 netbsd-10-0-RC2 netbsd-10-0-RC1 netbsd-10-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base
|
| #
1.24 |
|
30-Jul-2020 |
uwe |
Fix grammar.
|
|
Revision tags: phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406
|
| #
1.23 |
|
07-Dec-2019 |
wiz |
Remove trailing whitespace.
|
| #
1.22 |
|
06-Dec-2019 |
christos |
Correct the man page, and say that the printf(3) format characters need to be uintmax_t.
|
|
Revision tags: netbsd-9-4-RELEASE netbsd-9-3-RELEASE netbsd-9-2-RELEASE netbsd-9-1-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609
|
| #
1.21 |
|
29-Apr-2019 |
kre |
snprintb(3) says that, in the new(?) Torek format, all fields specs end with \0 The F spec is one of those, it should be terminated with \0 just like all the others (irrelevant that it has no extra data to delimit).
Fix <sys/mman.h> to define the snprintb() format string correctly (include the missing \0's). Fix the copy of that definition included into snprintb(3) to match the updated mman.h version (ride the date bump from the day before yesterday .. this is the same change, just corrected).
Undo the previous snprintb.c change ("off by one" fix) which was an attempt to make the broken mman.h usage work (and did, but not the way it should be done). Also, after using the new * format (instead of only when something has already matched) skip the associated data so we don't attempt to interpret it as more field specifiers. This func needs lots of TLC!
Fix the ATF tests for snprintb() to not assume that F format is really exactly like f format, and has data after the field specifier. It doesn't. Add several more tests (including testing the '*' field operator recently added).
|
| #
1.20 |
|
27-Apr-2019 |
wiz |
Remove trailing whitespace.
|
| #
1.19 |
|
27-Apr-2019 |
christos |
remove dup line
|
| #
1.18 |
|
27-Apr-2019 |
christos |
Document the '*' field and give a more complex example with F and *.
|
|
Revision tags: pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
|
| #
1.17 |
|
22-Oct-2017 |
abhinav |
branches: 1.17.4; Add snprintb_m to the NAME section.
|
|
Revision tags: netbsd-8-3-RELEASE netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-7-2-RELEASE netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 bouyer-socketcan-base pgoyette-localcount-20170107 netbsd-7-1-RC1 pgoyette-localcount-20161104 netbsd-7-0-2-RELEASE localcount-20160914 netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 tls-maxphys-base
|
| #
1.16 |
|
07-Aug-2013 |
pgoyette |
Update example using hex-escape-sequences to conform to gcc parsing rules. (See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33167 for details.)
|
| #
1.15 |
|
07-Aug-2013 |
pgoyette |
Add an example using snprintb_m()
Replace \*[Gt] and \*[Lt] with the simple characters > and < (OK wiz)
XXX Note that the examples currently do not compile with GCC! The hex XXX character sequences such as \x10CACHE are being parsed as longer XXX than 2-hex-digit strings!
|
|
Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231 matt-premerge-20091211 jym-xensuspend-nbase jym-xensuspend-base
|
| #
1.14 |
|
13-May-2009 |
pgoyette |
branches: 1.14.6; 1.14.12; Implement snprintb_m(3) to provide multi-line bit/bit-field decode. Discussed on tech-kern.
|
| #
1.13 |
|
05-May-2009 |
pgoyette |
Update type of argument 4 from u_quad_t to uint64_t to match the actual implementation.
|
| #
1.12 |
|
26-Mar-2009 |
uebayasi |
Correct the order of arguments in EXAMPLE. Bump date.
|
|
Revision tags: christos-time_t-base
|
| #
1.11 |
|
23-Dec-2008 |
wiz |
branches: 1.11.2; 1.11.4; Fix deleto in previous.
|
| #
1.10 |
|
23-Dec-2008 |
christos |
fix argument order in example.
|
| #
1.9 |
|
17-Dec-2008 |
wiz |
Re-add LIBRARY section.
|
| #
1.8 |
|
17-Dec-2008 |
wiz |
Fix some minor mdoclint complaints.
|
| #
1.7 |
|
16-Dec-2008 |
christos |
use the bitmask_snprintf info which is more complete, and adjust it for reality.
|
|
Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 wrstuden-revivesa-base
|
| #
1.6 |
|
30-Apr-2008 |
martin |
Convert TNF licenses to new 2 clause variant
|
|
Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase yamt-pf42-baseX yamt-pf42-base keiichi-mipv6-base matt-armv6-nbase matt-armv6-prevmlocking wrstuden-fixsa-base-1 netbsd-4-0-RELEASE cube-autoconf-base netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 matt-armv6-base matt-mips64-base hpcarm-cleanup-base netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE wrstuden-fixsa-base abandoned-netbsd-4-base netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-4-base netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-3-base
|
| #
1.5 |
|
01-Dec-2004 |
peter |
branches: 1.5.24; Add missing LIBRARY section.
ok wiz@
|
| #
1.4 |
|
21-Nov-2004 |
christos |
fix the header.
|
|
Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
|
| #
1.3 |
|
16-Apr-2003 |
wiz |
Use .In header.h instead of .Fd #include \*[Lt]header.h\*[Gt] Much easier to read and write, and supported by groff for ages. Okayed by ross.
|
|
Revision tags: fvdl_fs64_base
|
| #
1.2 |
|
01-Oct-2002 |
wiz |
New sentence, new line. From Robert Elz.
|
| #
1.1 |
|
20-Sep-2002 |
christos |
Add snprintb(3) inspired from bitmask_snprintf(9), but made to look like more like snprintf(3). Discussed with thorpej.
|