MSGC(1)

NAME
msgc - simple message list compiler

SYNOPSIS
msgc [-o name] file

#include "msg_defs.h"
void
msg_window(WINDOW *window);
void
msg_beep(void);
char *
msg_string(int msg_no);
void
msg_clear(void);
void
msg_standout(void);
void
msg_standend(void);
void
msg_display(int msg_no, ...);
void
msg_display_add(int msg_no, ...);
int
msg_vprintf(char *fmt, va_list ap);
int
msg_printf(char *fmt, ...);
int
msg_printf_add(char *fmt, ...);
void
msg_prompt_add(int msg_no, char *def, char *val, int max_chars, ...);
void
msg_prompt(int msg_no, char *def, char *val, int max_chars, ...);
void
msg_prompt_str(char *msg, char *def, char *val, int max_chars, ...);
void
msg_prompt_addstr(char *msg, char *def, char *val, int max_chars, ...);
void
msg_echo(void);
void
msg_noecho(void);

DESCRIPTION
This implements a curses based message display system. A source file that lists messages with associated names is given to msgc and produces both a .c and a .h file that implement the menu system. The standard root name of the files is msg_defs. The -o name can be used to specify a different root name.

SOURCE DESCRIPTION
The format is very simple. Each message is started with the word ‘message’ followed by the name of the message. The body of the message is next and is started by a { and closed by a }. The braces are not part of the message. Everything, including newlines between the braces are part of the message.

MESSAGE FUNCTIONS
The defined messages are used through calls routines that manipulate the messages. You first need to set the curses(3) environment up and then tell the message system which window to use for displaying message by calling the function msg_window().

All variable argument lists in the functions are used as are arguments to sprintf. The messages may have sprintf conversions in them and the corresponding parameters should match. Messages are identified by name using the notation ‘MENU_name’ where “name” is the name in the message source file. (The definitions are accessed by including the genereated .h file into a source file wanting to use the message routines.)

The function msg_string() just returns a pointer to the actual message string. The functions msg_clear(), msg_standout() and msg_standend() respectively clear the message window, set standout mode and clear standout mode. The functions msg_display() and msg_display_add() cause a defined message to be displayed in the message window and does the requested conversions before printing. The difference is that msg_display() clears the window before displaying the message. The functions msg_printf(and) msg_printf_add() print to the message window but take the format string from the function call instead of the message directory. Again, the first version, msg_printf(), clears the window before printing.

The remaining functions deal with a prompt facility. A prompt message is either taken from the message directory or from a given string. The message is processed with sprintf and then displayed. If the parameter def non-NULL or not a string of zero length, a default value is printed in brackets. The user is allowed to type in a response. If the user types just the newline character, the default is returned in the value. the parameter max_chars is the length if the parameter val, where the results are stored. The parameters def and val may point to the same character array. If the default is chosen, the character array is not changed. The functions msg_echo() and msg_noecho() control whether the prompt routine echo or don't echo the input that is typed by the user.

AUTHOR
Philip A. Nelson for Piermont Information Systems Inc.