ghaerr / elks

Embeddable Linux Kernel Subset - Linux for 8086
Other
1.02k stars 108 forks source link

[libc] Add thousands grouping to printf #2014

Closed ghaerr closed 2 months ago

ghaerr commented 2 months ago

Adds the ability to display large numbers using comma-based thousands separator, e.g. %,lu to display up to 4 billion and more easily read it. Also supports ' and _ instead of , by specifying the same. This code could be used to enhance df or mount displays showing filesystem sizes with more readability.

Eliminated some unused code in vfprintf, # hash flag specifier previously only used for octal display.

Added documentation on supported format types and flag specifiers at top of libc/stdio/vfprintf.c.

Temporarily using test code in cat.c, to be removed shortly.