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>

Split Close
Expand all
Collapse all
          --- old/usr/src/man/man3ofmt/ofmt.3ofmt.man.txt
          +++ new/usr/src/man/man3ofmt/ofmt.3ofmt.man.txt
   1    1  OFMT(3OFMT)               Formatted Output Functions               OFMT(3OFMT)
   2    2  
   3    3  NAME
   4      -     ofmt_open, ofmt_print, ofmt_update_winsize, ofmt_strerror, ofmt_close -
   5      -     data structures and routines for printing output
        4 +     ofmt_open, ofmt_print, ofmt_print_header, ofmt_update_winsize,
        5 +     ofmt_set_fs, ofmt_strerror, ofmt_close - data structures and routines for
        6 +     printing output
   6    7  
   7    8  LIBRARY
   8    9       Formatted output library (libofmt, -lofmt)
   9   10  
  10   11  SYNOPSIS
  11   12       #include <ofmt.h>
  12   13  
  13   14       ofmt_status_t
  14   15       ofmt_open(const char *fields, const ofmt_field_t *template, uint_t flags,
  15   16           uint_t maxcols, ofmt_handle_t *ofmt);
  16   17  
  17   18       void
  18   19       ofmt_print(ofmt_handle_t ofmt, void *cbarg);
  19   20  
  20   21       void
       22 +     ofmt_print_header(ofmt_handle_t ofmt);
       23 +
       24 +     void
  21   25       ofmt_update_winsize(ofmt_handle_t ofmt);
  22   26  
       27 +     void
       28 +     ofmt_set_fs(ofmt_handle_t ofmt, char fs);
       29 +
  23   30       char *
  24   31       ofmt_strerror(ofmt_handle_t ofmt, ofmt_status_t error, char *buf,
  25   32           uint_t bufsize);
  26   33  
  27   34       void
  28   35       ofmt_close(ofmt_handle_t ofmt);
  29   36  
  30   37  DESCRIPTION
  31   38       The libofmt library provides data structures and routines for printing
  32   39       output.
↓ open down ↓ 73 lines elided ↑ open up ↑
 106  113                       in the machine-parsable mode will result in a returned
 107  114                       error value of OFMT_EPARSENONE.  An attempt to create a
 108  115                       handle in machine-parsable mode with the fields set to
 109  116                       "all" will result in a returned error value of
 110  117                       OFMT_EPARSEALL.
 111  118       OFMT_WRAP       Wrap output if field width is exceeded.  Currently output
 112  119                       is wrapped at whitespace or comma characters.
 113  120       OFMT_MULTILINE  Multiline mode.  Specifying both OFMT_MULTILINE and
 114  121                       OFMT_PARSABLE will result in OFMT_EPARSEMULTI.
 115  122       OFMT_RIGHTJUST  Right justified output.
      123 +     OFMT_NOHEADER   Skip printing the header when calling ofmt_print().
 116  124  
 117  125       The non-zero maxcols limits the number of output columns.
 118  126  
 119  127     ofmt_print()
 120  128       The ofmt_print() function prints a row of output.
 121  129  
 122  130       cbarg points at the arguments to be passed to the callback function for
 123  131       each column in the row.  The call to ofmt_print() will result in the
 124  132       callback function of each selected field invoked with of_id, of_width and
 125  133       cbarg embedded in ofmt_arg, described in Data Structures.
 126  134  
 127  135       The callback function should fill buf with the string to be printed for
 128  136       the field using the data in cbarg.
 129  137  
      138 +   ofmt_print_header()
      139 +     The ofmt_print_header() function prints the output header.  This is
      140 +     usually done as part of calling ofmt_print(), but is skipped when using
      141 +     OFMT_NOHEADER.  This function allows you to insert it when and where
      142 +     desired.
      143 +
 130  144     ofmt_update_winsize()
 131  145       The ofmt_update_winsize() function updates the window size information
 132  146       (which is initially computed when the handle is created) in the ofmt.  If
 133  147       the TIOCGWINSZ ioctl fails, the window size is set to 80x24.
 134  148  
      149 +   ofmt_set_fs()
      150 +     The ofmt_set_fs() function sets the output field separator for parsable
      151 +     output.
      152 +
 135  153     ofmt_strerror()
 136  154       The ofmt_strerror() function returns error diagnostics in buf using the
 137  155       information in the ofmt and error.
 138  156  
 139  157       Using a buf size of OFMT_BUFSIZE is recommended.
 140  158  
 141  159     ofmt_close()
 142  160       The ofmt_close() function frees any resources allocated for the handle
 143  161       after printing is completed.
 144  162  
↓ open down ↓ 15 lines elided ↑ open up ↑
 160  178       ofmt_strerror().
 161  179  
 162  180       The ofmt_strerror() function returns the buf.
 163  181  
 164  182  INTERFACE STABILITY
 165  183       Private.
 166  184  
 167  185  SEE ALSO
 168  186       ioctl(2), strerror(3C), attributes(5)
 169  187  
 170      -illumos                        December 20, 2018                       illumos
      188 +illumos                        February 13, 2019                       illumos
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX