diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2022-05-09 20:50:23 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@gmail.com> | 2022-08-08 11:04:45 -0400 |
commit | 38852d8775fa27ec4e45bb0789a80af35c42657f (patch) | |
tree | 37ed05c510d65fef14aeec8ff49b3e52bce52ef5 /lib/netdev-notifier-error-inject.c | |
parent | 8efdce56518e5f97de51b8f1867c0a4ba91e023c (diff) |
lib/printbuf: Tabstops, indenting
This patch adds two new features to printbuf for structured formatting:
- Indent level: the indent level, as a number of spaces, may be
increased with pr_indent_add() and decreased with pr_indent_sub().
Subsequent lines, when started with pr_newline() (not "\n", although
that may change) will then be intended according to the current
indent level. This helps with pretty-printers that structure a large
amonut of data across multiple lines and multiple functions.
- Tabstops: Tabstops may be set by assigning to the printbuf->tabstops
array.
Then, pr_tab() may be used to advance to the next tabstop, printing
as many spaces as required - leaving previous output left justified
to the previous tabstop. pr_tab_rjust() advances to the next tabstop
but inserts the spaces just after the previous tabstop - right
justifying the previously-outputted text to the next tabstop.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Diffstat (limited to 'lib/netdev-notifier-error-inject.c')
0 files changed, 0 insertions, 0 deletions