1.\" $NetBSD: msgc.1,v 1.16 2001/12/01 20:43:39 wiz Exp $ 2.\" 3.\" Copyright 1997 Piermont Information Systems Inc. 4.\" All rights reserved. 5.\" 6.\" Written by Philip A. Nelson for Piermont Information Systems Inc. 7.\" 8.\" Redistribution and use in source and binary forms, with or without 9.\" modification, are permitted provided that the following conditions 10.\" are met: 11.\" 1. Redistributions of source code must retain the above copyright 12.\" notice, this list of conditions and the following disclaimer. 13.\" 2. Redistributions in binary form must reproduce the above copyright 14.\" notice, this list of conditions and the following disclaimer in the 15.\" documentation and/or other materials provided with the distribution. 16.\" 3. All advertising materials mentioning features or use of this software 17.\" must display the following acknowledgement: 18.\" This product includes software developed for the NetBSD Project by 19.\" Piermont Information Systems Inc. 20.\" 4. The name of Piermont Information Systems Inc. may not be used to endorse 21.\" or promote products derived from this software without specific prior 22.\" written permission. 23.\" 24.\" THIS SOFTWARE IS PROVIDED BY PIERMONT INFORMATION SYSTEMS INC. ``AS IS'' 25.\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 27.\" ARE DISCLAIMED. IN NO EVENT SHALL PIERMONT INFORMATION SYSTEMS INC. BE 28.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 29.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 30.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 31.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 32.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 33.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 34.\" THE POSSIBILITY OF SUCH DAMAGE. 35.\" 36.Dd September 26, 1997 37.Os 38.Dt MSGC 1 39.Sh NAME 40.Nm msgc , 41.Nm msg_window , 42.Nm msg_string , 43.Nm msg_clear , 44.Nm msg_standout , 45.Nm msg_standend , 46.Nm msg_display , 47.Nm msg_display_add , 48.Nm msg_prompt , 49.Nm msg_prompt_add , 50.Nm msg_prompt_noecho , 51.Nm msg_table_add 52.Nd simple message list compiler 53.Sh SYNOPSIS 54msgc 55.Op Fl o Ar name 56.Ar file 57.Pp 58.Fd #include \b'"'msg_defs.h\b'"' 59.Ft void 60.Fn msg_window "WINDOW *window" 61.Ft const char * 62.Fn msg_string "msg msg_no" 63.Ft void 64.Fn msg_clear "void" 65.Ft void 66.Fn msg_standout "void" 67.Ft void 68.Fn msg_standend "void" 69.Ft void 70.Fn msg_display "msg msg_no" ... 71.Ft void 72.Fn msg_display_add "msg msg_no" ... 73.Ft void 74.Fn msg_prompt "msg msg_no" "const char *def" "char *val" "int max_chars" ... 75.Ft void 76.Fn msg_prompt_add "msg msg_no" "const char *def" "char *val" "int max_chars" ... 77.Ft void 78.Fn msg_prompt_noecho "msg msg_no" "const char *def" "char *val" "int max_chars" ... 79.Ft void 80.Fn msg_table_add "msg msg_no" ... 81.Sh DESCRIPTION 82This implements a curses based message display system. A source file that 83lists messages with associated names is given to 84.Nm 85and produces both a .c and a .h file that implement the menu system. 86The standard root name of the files is 87.Pa msg_defs . 88The 89.Fl o Ar name 90can be used to specify a different root name. 91.Sh ENVIRONMENT 92.Bl -tag -width MSGDEF 93.It Ev MSGDEF 94Can be set to point to a different set of 95definition files for 96.Nm msgc . 97The current location defaults to 98.Pa /usr/share/misc . 99.El 100.Sh FILES 101.Bl -item -width /usr/share/misc/msg_sys.def 102.It 103.Pa /usr/share/misc/msg_sys.def 104.El 105.Sh SOURCE DESCRIPTION 106The format is very simple. Each message is started with the word 107.Sq message 108followed by the name of the message. The body of the message is 109next and is started by a { and closed by a }. The braces are not 110part of the message. Everything, including newlines between the 111braces are part of the message. 112.Sh MESSAGE FUNCTIONS 113The defined messages are used through calls routines that manipulate 114the messages. You first need to set the 115.Xr curses 3 116environment up and then tell the message system which window to use 117for displaying message by calling the function 118.Fn msg_window . 119.Pp 120All variable argument lists in the functions are used as 121are arguments to sprintf. The messages 122may have sprintf conversions in them and the corresponding parameters 123should match. Messages are identified by name using the notation 124.Sq MENU_name 125where 126.Dq name 127is the name in the message source file. (The definitions are accessed 128by including the generated .h file into a source file wanting to use 129the message routines.) 130.Pp 131The function 132.Fn msg_string 133just returns a pointer to the actual message string. 134The functions 135.Fn msg_clear , 136.Fn msg_standout 137and 138.Fn msg_standend 139respectively clear the message window, set standout mode and clear standout 140mode. 141.Pp 142The functions 143.Fn msg_display 144and 145.Fn msg_display_add 146cause a defined message to be displayed in the message window and does 147the requested conversions before printing. The difference is that 148.Fn msg_display 149clears the window before displaying the message. These functions 150fill paragraphs for readability. The 151.Fn msg_table_add 152function behaves like 153.Fn msg_display_add 154but does not fill text. 155.Pp 156The remaining functions deal with a prompt facility. A prompt message 157is either taken from the message directory or from a given string. The 158message is processed with sprintf and then displayed. If the parameter 159.Ar def 160is non-NULL and not a string of zero length, a default value is printed 161in brackets. The user is allowed to type in a response. If the user 162types just the newline character, the default is returned in the value. 163The parameter 164.Ar max_chars 165is the length of the parameter 166.Ar val , 167where the results are stored. 168The parameters 169.Ar def 170and 171.Ar val 172may point to the same character array. If the default is chosen, the 173character array is not changed. 174The functions 175.Fn msg_echo 176and 177.Fn msg_noecho 178control whether the prompt routine echo or don't echo the input that 179is typed by the user. 180.Sh AUTHORS 181Philip A. Nelson for Piermont Information Systems Inc. 182