#include <uif.h> #include <terrno.h> int repbegin(type) int repheader() int rependhead() int reptext(text, eof) char *text; int *eof; int reppage() int repzero() int repblock(lines) int repend() int repnowrap(nowrap) int nowrap; int getrowcol(type, rows, cols) int type; int *rows, *cols;
All report output is directed to UNIX stdout. All other user output is sent to UNIX stderr. This includes prompts and user responses. See inpstr and outpstr.
The following functions provide the bare essentials for generating interactive or printed reports with headers and page control:
repbegin - intialize report of a given type
repheader -mark start of report header
rependhead - end report header definition
reptext - put report (or report header) text; set eof flag if user has terminated report
reppage - skip to a new page
repzero - restart page numbering
repblock - see if a text block containing a given number of lines fits on page
repend - terminate report
getrowcol - get page size for given report type
repnowrap- disable or enable line wrapping based on whether nowrap is true or false respectively
The following report destination options (or types) are defined in uif.h:
TERM_REPORT - To tty but not session log
SESSION_REPORT - To tty and session log
PRINT_REPORT - To 80-column line printer
FINE_REPORT - To fine print (132-column) line printer
If the UNIX environment variable REPORTLP is defined, PRINT reports are piped into $REPORTLP. Otherwise, such reports are piped into the UNIX lp command.
If the UNIX environment variable REPORTFINE is defined, FINE reports are piped into $REPORTFINE. Otherwise, such reports are piped into the UNIX lp command.
Unless the user has redirected UNIX stdout to a file or pipe, TERM and SESSION reports are piped into $MORE, if the environment variable MORE is defined, or into the UNIX more command.
Report page lengths are determined as follows.
For TERM and SESSION reports, an infinite page length is used. Page width is obtained from UNIX, and if not available, the constant TERM_WIDTH from include/uif.h is used.
For PRINT reports, page length and width are obtained from environment variables PRINTLENGTH and PRINTWIDTH, respectively, If these environment variables are not available, constants PRINT_LENGTH and PRINT_WIDTH from include/uif.h are used.
Page length and width for FINE reports are obtained in a similar way.
Report headers appear at the top of every page. Headers can be made to include page numbers by embedding a \\%d conversion code in the header text. Headers can contain several lines, and up to 400 characters including newline characters and a trailing \ .
Header text and all other report text must contain newline characters to go from one line to the next. This is consistent with standard C formatted output conventions.
Only one report to one destination can be in progress. The following function sequence demonstrates one correct use of the report-generation functions.
repbegin(... /* Initialize report */ repheader(... /* Initialize header */ reptext(... /* Put header text */ : reptext(... rependhead(... /* Terminate header */ reptext(... /* Write report text */ : reptext(... repend(... /* Terminate report */
All functions return 0 if successful. Otherwise, they return -1 and set terrno to the appropriate error code.
Non-UNIX error codes are listed in include/uif.h.
EREP_TYPE - Invalid report type.
EREP_OPEN - Report already/not in progress.
EREP_HEADER - Header contains too many characters or lines.
EREP_NOHEAD - Header not being defined.
EREP_BLOCK - Text block will not fit on page.
EUIF_LOG - Session log is not writable.
EUIF_SIGNAL - User interrupted report.
include/uif.h, lib/libuif.a, lib/msgcat
None.
Last Update: $Date: 1999/05/10 20:57:04 $