.ig Copyright (C) 1993,1994 by the author(s). This software is published in the hope that it will be useful, but WITHOUT ANY WARRANTY for any part of this software to work correctly or as described in the manuals. See the ShapeTools Public License for details. Permission is granted to use, copy, modify, or distribute any part of this software but only under the conditions described in the ShapeTools Public License. A copy of this license is supposed to have been given to you along with ShapeTools in a file named LICENSE. Among other things, this copyright notice and the Public License must be preserved on all copies. Author: Andreas Lampen (Andreas.Lampen@cs.tu-berlin.de) $Header: stuserio.3[4.0] Thu Jun 24 17:43:39 1993 andy@cs.tu-berlin.de frozen $ .. .TH stuserio 3 "Thu Jun 24 17:43:39 1993" "sttk-1.7" "ShapeTools Toolkit Library" .SH NAME stLog, stQuietFlag, stShutupFlag, stProgramName, stMessage, stGetFromStdin, stAskConfirm, stGetTermWidth \- user interaction .SH SYNOPSIS #include .br #include .sp .ta 1c void stLog (char *logMsg, int logType); .sp int stQuietFlag; .sp int stShutupFlag; .sp char* stProgramName; .sp char stMessage[]; .sp char* stGetFromStdin (int termChar); .sp int stAskConfirm (char *message, char *defaultAnswer); .sp int stGetTermWidth (int fdes); .sp .SH DESCRIPTION These functions do the dialogue with the user. \fIstLog\fP outputs a message to the user's terminal. The message text is given in the \fIlogMsg\fP buffer. \fIlogType\fP is one of .TP 3.5c ST_LOG_MSG Message to be sent to standard output. .TP ST_LOG_MSGERR Message to be sent to standard error. .TP ST_LOG_WARNING Warning message, preceded by the string `programName - warning:', going to standard error. .TP ST_LOG_ERROR Error message, preceded by the string `programName - error:', going to standard error. .LP Additionally, when the flag .TP 3.5c ST_LOG_NONL is \fIor\fPed to the message type (e.g. `ST_LOG_MSG | ST_LOG_NONL'), the message is printed without adding a newline character. Otherwise, a newline is always added. .LP Whether a message really makes it's way to the user, depends on the variables \fIstQuietFlag\fP and \fIstShutupFlag\fP. When \fIstQuietFlag\fP 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, \fIall\fP messages will be suppressed. Initially, both flags are set to NULL. .LP The \fIstProgramName\fP 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). .LP \fIstMessage\fP 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. .LP \fIstGetFromStdin\fP reads from stdin a text terminated by ^D or by the specified single character \fItermChar\fP at the beginning of a new line. If termChar is -1 text is terminated by ^D. .LP \fIstAskConfirm\fP returns true if the answer is equivalent to \fIdefaultAnswer\fP (assumption). .LP \fIstGetTermWidth\fP returns the actual with of the user's termainal in columns. .SH BUGS stGetTermWidth will not work on all machines properly. In it's current implementation, it is quite SUN specific.