msgout, msgstr, msgfmt, fmtout, msgfile, outpstr, logstr, logdisable, logenable - user output functions

SYNOPSIS

#include <uif.h>
#include <terrno.h>

void msgout(msgno, [ , arg ... ] )
int msgno;

char *msgstr(str, msgno, [ , arg ... ] )
char *str;
int msgno;

char *msgfmt(msgno, fmt)
int msgno;
char *fmt;

void fmtout(fmt, [ , arg ... ] )
char *fmt;

int msgfile(path, thousand)
char *path;
int thousand;

int outpstr(str)
char *str;

int logstr(str)
char *str;

void logdisable()

void logenable()

DESCRIPTION

All non-report user output is directed to UNIX stderr and to a session log. This includes all prompts and user responses.

Formatted Output

fmtout is the TeraScan version of printf. The difference between fmtout and printf is that fmtout directs output both to UNIX stderr and a session log.

msgout is analogous to fmtout, except that the fmt string is replaced by a numeric msgno. msgout looks up the message format in the appropriate message catalog prior to doing the actual output. The primary message catalog for TeraScan is lib/msgcat. See msgcat. msgout makes up a message if it doesn't find one.

msgstr is similar to msgfmt, except that the output is returned in str, instead of being written to UNIX stderr and the session log. msgstr does not make up a message if it does not find one.

msgfmt looks up a message fmt based on the number msgno, and returns that format to the application.

msgfile opens an application specific message catalog with pathname path. Message numbers for this catalog are assumed to be in the range thousand * 1000 + 1 to thousand * 1000 + 999. thousand must between 1 and 9.

Raw Text Output

The raw text output function outpstr simultaneously directs the text str to UNIX stderr and to a session log. This function is called by the formatted output functions described above. Output text must include its own carriage control, consistent with UNIX/C conventions.

Session Logging

All TeraScan user interaction is recorded in a session log. The path of the session log is defined by the UNIX environment variable SESSIONLOG. If this variable is not defined, session logging is disabled. A session log is a standard text file, with records terminated by \\n characters.

UNIX-time is in seconds since 0 GMT, January 1, 1970. Session log records are never longer than 256 characters, including the trailing \\n character. Output text is wrapped as needed to meet this restriction.

logstr writes the text str to a session log. This function is called by outpstr function described above. logstr opens the session log if it is defined and not already open.

logenable and logdisable turn session logging on and off respectively. These functions are rarely, if ever, invoked by applications.

RETURN VALUES

fmtout and msgout do not return values. msgout does set terrno to the appropriate error code if unable to find the message format.

msgstr returns a pointer to the message string if successful. Otherwise it returns NULL and sets terrno to the appropriate error code.

msgfmt returns a pointer to the message format if successful. Otherwise it returns NULL and sets terrno to the appropriate error code.

outpstr and logstr return 0 if successful. Otherwise they return -1 and set terrno to UNIX errno.

logenable and logdisable do not return anything.

ERRORS

All non-UNIX error codes are listed in include/uif.h.

Message format not found, or msgno < 1 or msgno > 9999

Message catalog not open for this range of msgno

Message catalog is open but is invalid

thousand passed to msgfile not between 1 and 9

Session log is not writable.

FILES

include/uif.h, include/terrno.h, lib/libuif.a, lib/msgcat

SEE ALSO

inpstr, report, msgcat

NOTES

An alternate implementation of logging might redirect UNIX stderr to a process that tees output to the user's terminal and to the session log, if enabled.


Last Update: $Date: 1999/05/10 20:56:56 $