Print this page
11545 Want configurable output field separator for libofmt
Portions contributed by: Cody Peter Mello <cody.mello@joyent.com>
Reviewed by: Jason King <jason.king@joyent.com>
Reviewed by: Robert Mustacchi <rm@joyent.com>
*** 1,10 ****
OFMT(3OFMT) Formatted Output Functions OFMT(3OFMT)
NAME
! ofmt_open, ofmt_print, ofmt_update_winsize, ofmt_strerror, ofmt_close -
! data structures and routines for printing output
LIBRARY
Formatted output library (libofmt, -lofmt)
SYNOPSIS
--- 1,11 ----
OFMT(3OFMT) Formatted Output Functions OFMT(3OFMT)
NAME
! ofmt_open, ofmt_print, ofmt_print_header, ofmt_update_winsize,
! ofmt_set_fs, ofmt_strerror, ofmt_close - data structures and routines for
! printing output
LIBRARY
Formatted output library (libofmt, -lofmt)
SYNOPSIS
*** 16,27 ****
--- 17,34 ----
void
ofmt_print(ofmt_handle_t ofmt, void *cbarg);
void
+ ofmt_print_header(ofmt_handle_t ofmt);
+
+ void
ofmt_update_winsize(ofmt_handle_t ofmt);
+ void
+ ofmt_set_fs(ofmt_handle_t ofmt, char fs);
+
char *
ofmt_strerror(ofmt_handle_t ofmt, ofmt_status_t error, char *buf,
uint_t bufsize);
void
*** 111,120 ****
--- 118,128 ----
OFMT_WRAP Wrap output if field width is exceeded. Currently output
is wrapped at whitespace or comma characters.
OFMT_MULTILINE Multiline mode. Specifying both OFMT_MULTILINE and
OFMT_PARSABLE will result in OFMT_EPARSEMULTI.
OFMT_RIGHTJUST Right justified output.
+ OFMT_NOHEADER Skip printing the header when calling ofmt_print().
The non-zero maxcols limits the number of output columns.
ofmt_print()
The ofmt_print() function prints a row of output.
*** 125,139 ****
--- 133,157 ----
cbarg embedded in ofmt_arg, described in Data Structures.
The callback function should fill buf with the string to be printed for
the field using the data in cbarg.
+ ofmt_print_header()
+ The ofmt_print_header() function prints the output header. This is
+ usually done as part of calling ofmt_print(), but is skipped when using
+ OFMT_NOHEADER. This function allows you to insert it when and where
+ desired.
+
ofmt_update_winsize()
The ofmt_update_winsize() function updates the window size information
(which is initially computed when the handle is created) in the ofmt. If
the TIOCGWINSZ ioctl fails, the window size is set to 80x24.
+ ofmt_set_fs()
+ The ofmt_set_fs() function sets the output field separator for parsable
+ output.
+
ofmt_strerror()
The ofmt_strerror() function returns error diagnostics in buf using the
information in the ofmt and error.
Using a buf size of OFMT_BUFSIZE is recommended.
*** 165,170 ****
Private.
SEE ALSO
ioctl(2), strerror(3C), attributes(5)
! illumos December 20, 2018 illumos
--- 183,188 ----
Private.
SEE ALSO
ioctl(2), strerror(3C), attributes(5)
! illumos February 13, 2019 illumos