askstr, askyn, inpstr - Non parameter user input routines

SYNOPSIS

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

int askstr(prompt, help, deflag, def, maxlen, value, len)
char *prompt, *help;
int deflag;
char *def;
int maxlen;
char *value;
int *len;

int askyn(prompt, help, deflag, def, value)
char *prompt, *help;
int deflag, def, *value;

int inpstr(maxlen, actlen, buf)
int maxlen, *actlen;
char *buf;


DESCRIPTION

The functions described here are used by applications (and higher level TeraScan subsystems) to ask non-parameter questions, e.g.:

         Delete n9.89061.23 ? [n]

The TeraScan signal handler should be initialized by calling sigsetup prior to using these functions. Note that that normal parameter setup automatically invokes sigsetup.

askstr displays prompt and asks the user a question. help is obsolete and should be passed as NULL. If deflag is NO_DEFAULT, the user is forced to give a response. If deflag is HAS_DEFAULT, the user can accept the default reponse def by entering nothing.

The user's response is truncated if longer than maxlen characters. Leading and trailing blanks are ignored. The response is always terminated with a trailing \ and returned in value. value must have room for at least maxlen +1 characters. The number of characters in the user's response, not counting the trailing \ , is returned in len.

askyn asks the user a yes/no question. The prompt, help and deflag are used the same as with askstr. def is true if the default response is yes, false if the default response is no. value is set to true or false, depending on whether the user responds with yes or no.

inpstr is the lowest level TeraScan input function. It reads user input into buf and echoes it to the session log. Leading blanks are ignored. Input is truncated if longer than maxlen characters. A trailing \ is always added to buf. buf must be long enough to hold maxlen +1 characters. The actual number of characters input, not including the trailing \ , is returned in actlen. actlen may be greater than maxlen!

inpstr is called by askstr, which in turn is called by askyn and all parameter get routines. inpstr always checks for interrupts before and after reading input.

RETURN VALUES

All these functions return 0 if successful. Otherwise they return -1 and set terrno to the appropriate error code.

ERRORS

Signal occured during input

Unexpected end of input

These error codes are defined in include/uif.h.

FILES

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

SEE ALSO

sigsetup, outpstr, terrno

NOTES

Non-parameter input is discouraged in TeraScan stand alone applications, because it make them more difficult to include in scripts or windows-based applications.


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