stuserio(3) | ShapeTools Toolkit Library | stuserio(3) |
stLog, stQuietFlag, stShutupFlag, stProgramName, stMessage, stGetFromStdin, stAskConfirm, stGetTermWidth - user interaction
#include <config.h>
#include <sttk.h.h>
void stLog (char *logMsg, int logType);
int stQuietFlag;
int stShutupFlag;
char* stProgramName;
char stMessage[];
char* stGetFromStdin (int termChar);
int stAskConfirm (char *message, char *defaultAnswer);
int stGetTermWidth (int fdes);
These functions do the dialogue with the user. stLog outputs a message to the user's terminal. The message text is given in the logMsg buffer. logType is one of
Additionally, when the flag
Whether a message really makes it's way to the user, depends on the variables stQuietFlag and stShutupFlag. When stQuietFlag is set to a non null value, all messages except error messages (ST_LOG_ERROR) will be suppressed. With the stShutupFlag set to a null value, all messages will be suppressed. Initially, both flags are set to NULL.
The stProgramName pointer should be set pointing to a buffer containing the name how the program was called. It is used for composing proper error messages and warnings (see above).
stMessage is a buffer for constructing messages using sprintf(3). It is designed to be large enough to hold a file's pathname and an additional short message. It's size is MAXPATHLEN+128.
stGetFromStdin reads from stdin a text terminated by ^D or by the specified single character termChar at the beginning of a new line. If termChar is -1 text is terminated by ^D.
stAskConfirm returns true if the answer is equivalent to defaultAnswer (assumption).
stGetTermWidth returns the actual with of the user's termainal in columns.
stGetTermWidth will not work on all machines properly. In it's current implementation, it is quite SUN specific.
Thu Jun 24 17:43:39 1993 | sttk-1.7 |