1.\" $NetBSD: msgc.1,v 1.18 2003/06/04 19:00:26 dsl 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_win , 51.Nm msg_prompt_noecho , 52.Nm msg_table_add 53.Nd simple message list compiler 54.Sh SYNOPSIS 55msgc 56.Op Fl o Ar name 57.Ar file 58.Pp 59.Fd #include \b'"'msg_defs.h\b'"' 60.Ft void 61.Fn msg_window "WINDOW *window" 62.Ft const char * 63.Fn msg_string "msg msg_no" 64.Ft void 65.Fn msg_clear "void" 66.Ft void 67.Fn msg_standout "void" 68.Ft void 69.Fn msg_standend "void" 70.Ft void 71.Fn msg_display "msg msg_no" ... 72.Ft void 73.Fn msg_display_add "msg msg_no" ... 74.Ft void 75.Fn msg_prompt "msg msg_no" "const char *def" "char *val" "int max_chars" ... 76.Ft void 77.Fn msg_prompt_add "msg msg_no" "const char *def" "char *val" "int max_chars" ... 78.Ft void 79.Fn msg_prompt_win "msg msg_no" "WINDOW *win" "const char *def" "char *val" "int max_chars" ... 80.Ft void 81.Fn msg_prompt_noecho "msg msg_no" "const char *def" "char *val" "int max_chars" ... 82.Ft void 83.Fn msg_table_add "msg msg_no" ... 84.Sh DESCRIPTION 85This implements a curses based message display system. 86A source file that lists messages with associated names is given to 87.Nm 88and produces both a .c and a .h file that implement the menu system. 89The standard root name of the files is 90.Pa msg_defs . 91The 92.Fl o Ar name 93can be used to specify a different root name. 94.Sh ENVIRONMENT 95.Bl -tag -width MSGDEF 96.It Ev MSGDEF 97Can be set to point to a different set of 98definition files for 99.Nm msgc . 100The current location defaults to 101.Pa /usr/share/misc . 102.El 103.Sh FILES 104.Bl -item -width /usr/share/misc/msg_sys.def 105.It 106.Pa /usr/share/misc/msg_sys.def 107.El 108.Sh SOURCE DESCRIPTION 109The format is very simple. 110Each message is started with the word 111.Sq message 112followed by the name of the message. 113The body of the message is next and is started by a { and closed by a }. 114The braces are not part of the message. 115Everything, including newlines between the braces are part of the message. 116.Sh MESSAGE FUNCTIONS 117The defined messages are used through calls routines that manipulate 118the messages. 119You first need to set the 120.Xr curses 3 121environment up and then tell the message system which window to use 122for displaying message by calling the function 123.Fn msg_window . 124.Pp 125All variable argument lists in the functions are used as 126are arguments to 127.Xr sprintf 3 . 128The messages may have 129.Xr sprintf 3 130conversions in them and the corresponding parameters should match. 131Messages are identified by name using the notation 132.Sq MENU_name 133where 134.Dq name 135is the name in the message source file. 136(The definitions are accessed by including the generated .h file into a 137source file wanting to use the message routines.) 138.Pp 139The function 140.Fn msg_string 141just returns a pointer to the actual message string. 142The functions 143.Fn msg_clear , 144.Fn msg_standout 145and 146.Fn msg_standend 147respectively clear the message window, set standout mode and clear standout 148mode. 149.Pp 150The functions 151.Fn msg_display 152and 153.Fn msg_display_add 154cause a defined message to be displayed in the message window and does 155the requested conversions before printing. 156The difference is that 157.Fn msg_display 158clears the window before displaying the message. 159These functions fill paragraphs for readability. 160The 161.Fn msg_table_add 162function behaves like 163.Fn msg_display_add 164but does not fill text. 165.Pp 166The remaining functions deal with a prompt facility. 167A prompt message is either taken from the message directory or from a 168given string. 169The message is processed with 170.Xr sprintf 3 171and then displayed. 172If the parameter 173.Ar def 174is 175.No non- Ns Dv NULL 176and not a string of zero length, a default value is printed 177in brackets. 178The user is allowed to type in a response. 179If the user types just the newline character, the default is returned 180in the value. 181The parameter 182.Ar max_chars 183is the length of the parameter 184.Ar val , 185where the results are stored. 186The parameters 187.Ar def 188and 189.Ar val 190may point to the same character array. 191If the default is chosen, the character array is not changed. 192The functions 193.Fn msg_echo 194and 195.Fn msg_noecho 196control whether the prompt routine echo or don't echo the input that 197is typed by the user. 198.Pp 199.Fn msg_prompt_win 200uses the specified curses window instead of the default one. 201.Sh AUTHORS 202Philip A. Nelson for Piermont Information Systems Inc. 203