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