Displaying Messages and Getting Input

/*
**	(c) COPYRIGHT MIT 1995.
**	Please first read the full copyright statement in the file COPYRIGH.
*/
This module may be overridden for GUI clients. It allows progress indications and warning messages to be communicated to the user in a portable way using stdio. Yes, I know that not all platforms have stdio :-(. It contain two parts: This module is implemented by HTAlert.c, and it is a part of the Library of Common Code.
#ifndef HTALERT_H
#define HTALERT_H

#include "HTAccess.h"

User Interactive Functions

These functions require the user to interact in some way

Flags for This Module

If you really don't want the library to prompt for anything at all then enable this constant. The default value is OFF. All functions returning a string return a dynamic string which must be freed by the caller.
extern BOOL HTInteractive;      	    /* Any prompts from the Library? */

Display a message, then wait for 'YES' or 'NO'

This function prompts the user for a confirmation on the message passed as a parameter. If the user reacts in the affirmative, returns TRUE, returns FALSE otherwise.
extern BOOL HTConfirm	PARAMS((CONST char * Msg));

Prompt the User a Question

Prompt for answer and get text back. Reply text is either NULL on error or a dynamic string which the caller must free.
		
extern char * HTPrompt PARAMS((CONST char * Msg, CONST char * deflt));

Prompt for a Password

Prompt for password without echoing the reply. Reply text is weither NULL on error or a dynamic string which the caller must free.

NOTE: The current version uses getpass which on many systems returns a string of 8 or 16 bytes.

extern char * HTPromptPassword PARAMS((CONST char * Msg));

Prompt for a UserID and a Password

This is just a composite function using HTPrompt and HTPromptPassword. The strings returned must be freed by caller.
extern void HTPromptUsernameAndPassword PARAMS((CONST char *	Msg,
						char **		username,
						char **		password));

Messages, Warnings, and Errors

These functions are used to inform the user of an event which requires no response form the user.

Display a Message

This function simply puts out the message passed.
extern void HTAlert PARAMS((CONST char * Msg));

Display a Status Message on what's going on

This function can be used to indicate the current status of a certain action.
extern void HTProgress PARAMS((CONST char * Msg));

Generating an Error Message of a request

This function outputs the content of the error_stack to standard output (used in Line Mode Browser), but smart clients and servers might overwrite this function so that the error messages can be handled to the user in a nice(r) way. That is the reason for putting the actual implementation in HTAlert.c.

Note: If a stream has been put up (and maybe taken down again) inside the Library, then request->error_block has been set to YES. This indicates that it is NOT possible any more to use the stream as output for the message.

extern void HTErrorMsg    PARAMS((HTRequest * request));

#endif