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