2010-05-14 21:24:38 +04:00
|
|
|
.\" $NetBSD: msgc.1,v 1.22 2010/05/14 17:24:38 joerg Exp $
|
1997-09-27 01:16:38 +04:00
|
|
|
.\"
|
|
|
|
.\" Copyright 1997 Piermont Information Systems Inc.
|
|
|
|
.\" All rights reserved.
|
|
|
|
.\"
|
|
|
|
.\" Written by Philip A. Nelson for Piermont Information Systems Inc.
|
|
|
|
.\"
|
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
|
|
.\" 3. All advertising materials mentioning features or use of this software
|
|
|
|
.\" must display the following acknowledgement:
|
2000-12-05 01:33:52 +03:00
|
|
|
.\" This product includes software developed for the NetBSD Project by
|
1997-09-27 01:16:38 +04:00
|
|
|
.\" Piermont Information Systems Inc.
|
|
|
|
.\" 4. The name of Piermont Information Systems Inc. may not be used to endorse
|
|
|
|
.\" or promote products derived from this software without specific prior
|
|
|
|
.\" written permission.
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY PIERMONT INFORMATION SYSTEMS INC. ``AS IS''
|
|
|
|
.\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
2001-12-01 19:43:07 +03:00
|
|
|
.\" ARE DISCLAIMED. IN NO EVENT SHALL PIERMONT INFORMATION SYSTEMS INC. BE
|
|
|
|
.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
1997-09-27 01:16:38 +04:00
|
|
|
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
2001-12-01 19:43:07 +03:00
|
|
|
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
1997-09-27 01:16:38 +04:00
|
|
|
.\" THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
.\"
|
2003-10-16 00:02:10 +04:00
|
|
|
.Dd September 25, 2003
|
1997-09-27 01:16:38 +04:00
|
|
|
.Dt MSGC 1
|
2009-03-09 22:24:26 +03:00
|
|
|
.Os
|
1997-09-27 01:16:38 +04:00
|
|
|
.Sh NAME
|
2000-07-06 23:30:11 +04:00
|
|
|
.Nm msgc ,
|
|
|
|
.Nm msg_window ,
|
|
|
|
.Nm msg_string ,
|
|
|
|
.Nm msg_clear ,
|
|
|
|
.Nm msg_standout ,
|
|
|
|
.Nm msg_standend ,
|
|
|
|
.Nm msg_display ,
|
|
|
|
.Nm msg_display_add ,
|
|
|
|
.Nm msg_prompt ,
|
|
|
|
.Nm msg_prompt_add ,
|
2003-06-04 23:00:26 +04:00
|
|
|
.Nm msg_prompt_win ,
|
2000-07-06 23:30:11 +04:00
|
|
|
.Nm msg_prompt_noecho ,
|
2003-09-25 22:32:10 +04:00
|
|
|
.Nm msg_row ,
|
2000-07-06 23:30:11 +04:00
|
|
|
.Nm msg_table_add
|
1997-09-27 01:16:38 +04:00
|
|
|
.Nd simple message list compiler
|
|
|
|
.Sh SYNOPSIS
|
|
|
|
msgc
|
|
|
|
.Op Fl o Ar name
|
|
|
|
.Ar file
|
|
|
|
.Pp
|
2010-05-14 21:24:38 +04:00
|
|
|
.Fd #include \&"msg_defs.h"
|
1997-09-27 01:16:38 +04:00
|
|
|
.Ft void
|
2001-12-01 19:43:07 +03:00
|
|
|
.Fn msg_window "WINDOW *window"
|
1999-07-05 01:30:14 +04:00
|
|
|
.Ft const char *
|
|
|
|
.Fn msg_string "msg msg_no"
|
2001-12-01 19:43:07 +03:00
|
|
|
.Ft void
|
1997-09-27 01:16:38 +04:00
|
|
|
.Fn msg_clear "void"
|
2001-12-01 19:43:07 +03:00
|
|
|
.Ft void
|
1997-09-27 01:16:38 +04:00
|
|
|
.Fn msg_standout "void"
|
2001-12-01 19:43:07 +03:00
|
|
|
.Ft void
|
1997-09-27 01:16:38 +04:00
|
|
|
.Fn msg_standend "void"
|
2001-12-01 19:43:07 +03:00
|
|
|
.Ft void
|
1999-07-05 01:30:14 +04:00
|
|
|
.Fn msg_display "msg msg_no" ...
|
2001-12-01 19:43:07 +03:00
|
|
|
.Ft void
|
1999-07-05 01:30:14 +04:00
|
|
|
.Fn msg_display_add "msg msg_no" ...
|
2001-12-01 19:43:07 +03:00
|
|
|
.Ft void
|
1999-07-05 01:30:14 +04:00
|
|
|
.Fn msg_prompt "msg msg_no" "const char *def" "char *val" "int max_chars" ...
|
2001-12-01 19:43:07 +03:00
|
|
|
.Ft void
|
1999-07-05 01:30:14 +04:00
|
|
|
.Fn msg_prompt_add "msg msg_no" "const char *def" "char *val" "int max_chars" ...
|
2001-12-01 19:43:07 +03:00
|
|
|
.Ft void
|
2003-06-04 23:00:26 +04:00
|
|
|
.Fn msg_prompt_win "msg msg_no" "WINDOW *win" "const char *def" "char *val" "int max_chars" ...
|
|
|
|
.Ft void
|
1999-07-05 01:30:14 +04:00
|
|
|
.Fn msg_prompt_noecho "msg msg_no" "const char *def" "char *val" "int max_chars" ...
|
2003-09-25 22:32:10 +04:00
|
|
|
.Ft int
|
|
|
|
.Fn msg_row "void"
|
2001-12-01 19:43:07 +03:00
|
|
|
.Ft void
|
1999-07-05 01:30:14 +04:00
|
|
|
.Fn msg_table_add "msg msg_no" ...
|
1997-09-27 01:16:38 +04:00
|
|
|
.Sh DESCRIPTION
|
2002-09-26 05:26:53 +04:00
|
|
|
This implements a curses based message display system.
|
|
|
|
A source file that lists messages with associated names is given to
|
1997-09-27 01:16:38 +04:00
|
|
|
.Nm
|
|
|
|
and produces both a .c and a .h file that implement the menu system.
|
2001-12-01 19:43:07 +03:00
|
|
|
The standard root name of the files is
|
1997-10-19 09:19:15 +04:00
|
|
|
.Pa msg_defs .
|
2001-12-01 19:43:07 +03:00
|
|
|
The
|
1997-09-27 01:16:38 +04:00
|
|
|
.Fl o Ar name
|
|
|
|
can be used to specify a different root name.
|
1999-12-31 07:03:18 +03:00
|
|
|
.Sh ENVIRONMENT
|
|
|
|
.Bl -tag -width MSGDEF
|
|
|
|
.It Ev MSGDEF
|
|
|
|
Can be set to point to a different set of
|
|
|
|
definition files for
|
|
|
|
.Nm msgc .
|
|
|
|
The current location defaults to
|
|
|
|
.Pa /usr/share/misc .
|
|
|
|
.El
|
|
|
|
.Sh FILES
|
2010-05-14 21:24:38 +04:00
|
|
|
.Bl -item
|
1999-12-31 07:03:18 +03:00
|
|
|
.It
|
|
|
|
.Pa /usr/share/misc/msg_sys.def
|
|
|
|
.El
|
1997-09-27 01:16:38 +04:00
|
|
|
.Sh SOURCE DESCRIPTION
|
2002-09-26 05:26:53 +04:00
|
|
|
The format is very simple.
|
|
|
|
Each message is started with the word
|
1997-10-19 09:19:15 +04:00
|
|
|
.Sq message
|
2002-09-26 05:26:53 +04:00
|
|
|
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.
|
2001-12-01 19:43:07 +03:00
|
|
|
.Sh MESSAGE FUNCTIONS
|
1997-09-27 01:16:38 +04:00
|
|
|
The defined messages are used through calls routines that manipulate
|
2002-09-26 05:26:53 +04:00
|
|
|
the messages.
|
|
|
|
You first need to set the
|
1997-10-19 09:19:15 +04:00
|
|
|
.Xr curses 3
|
1997-09-27 01:16:38 +04:00
|
|
|
environment up and then tell the message system which window to use
|
|
|
|
for displaying message by calling the function
|
1997-10-19 09:19:15 +04:00
|
|
|
.Fn msg_window .
|
1997-09-27 01:16:38 +04:00
|
|
|
.Pp
|
2001-12-01 19:43:07 +03:00
|
|
|
All variable argument lists in the functions are used as
|
2002-09-26 05:26:53 +04:00
|
|
|
are arguments to
|
|
|
|
.Xr sprintf 3 .
|
|
|
|
The messages may have
|
|
|
|
.Xr sprintf 3
|
|
|
|
conversions in them and the corresponding parameters should match.
|
|
|
|
Messages are identified by name using the notation
|
1997-10-19 09:19:15 +04:00
|
|
|
.Sq MENU_name
|
2001-12-01 19:43:07 +03:00
|
|
|
where
|
1997-10-19 09:19:15 +04:00
|
|
|
.Dq name
|
2002-09-26 05:26:53 +04:00
|
|
|
is the name in the message source file.
|
|
|
|
(The definitions are accessed by including the generated .h file into a
|
|
|
|
source file wanting to use the message routines.)
|
1997-09-27 01:16:38 +04:00
|
|
|
.Pp
|
|
|
|
The function
|
|
|
|
.Fn msg_string
|
|
|
|
just returns a pointer to the actual message string.
|
|
|
|
The functions
|
|
|
|
.Fn msg_clear ,
|
2001-12-01 19:43:07 +03:00
|
|
|
.Fn msg_standout
|
1997-09-27 01:16:38 +04:00
|
|
|
and
|
|
|
|
.Fn msg_standend
|
|
|
|
respectively clear the message window, set standout mode and clear standout
|
2000-07-07 00:10:42 +04:00
|
|
|
mode.
|
|
|
|
.Pp
|
|
|
|
The functions
|
2001-12-01 19:43:07 +03:00
|
|
|
.Fn msg_display
|
1997-09-27 01:16:38 +04:00
|
|
|
and
|
2001-12-01 19:43:07 +03:00
|
|
|
.Fn msg_display_add
|
1997-09-27 01:16:38 +04:00
|
|
|
cause a defined message to be displayed in the message window and does
|
2002-09-26 05:26:53 +04:00
|
|
|
the requested conversions before printing.
|
|
|
|
The difference is that
|
1997-09-27 01:16:38 +04:00
|
|
|
.Fn msg_display
|
2002-09-26 05:26:53 +04:00
|
|
|
clears the window before displaying the message.
|
|
|
|
These functions fill paragraphs for readability.
|
|
|
|
The
|
2000-07-07 00:10:42 +04:00
|
|
|
.Fn msg_table_add
|
|
|
|
function behaves like
|
|
|
|
.Fn msg_display_add
|
|
|
|
but does not fill text.
|
1997-09-27 01:16:38 +04:00
|
|
|
.Pp
|
2002-09-26 05:26:53 +04:00
|
|
|
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
|
|
|
|
.Xr sprintf 3
|
|
|
|
and then displayed.
|
|
|
|
If the parameter
|
1997-09-27 01:16:38 +04:00
|
|
|
.Ar def
|
2002-09-26 05:26:53 +04:00
|
|
|
is
|
|
|
|
.No non- Ns Dv NULL
|
|
|
|
and 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.
|
2000-12-05 01:33:52 +03:00
|
|
|
The parameter
|
1997-09-27 01:16:38 +04:00
|
|
|
.Ar max_chars
|
2000-12-05 01:33:52 +03:00
|
|
|
is the length of the parameter
|
1997-09-27 01:16:38 +04:00
|
|
|
.Ar val ,
|
|
|
|
where the results are stored.
|
|
|
|
The parameters
|
2001-12-01 19:43:07 +03:00
|
|
|
.Ar def
|
|
|
|
and
|
1997-09-27 01:16:38 +04:00
|
|
|
.Ar val
|
2002-09-26 05:26:53 +04:00
|
|
|
may point to the same character array.
|
|
|
|
If the default is chosen, the character array is not changed.
|
1997-09-27 01:16:38 +04:00
|
|
|
The functions
|
|
|
|
.Fn msg_echo
|
2001-12-01 19:43:07 +03:00
|
|
|
and
|
1997-09-27 01:16:38 +04:00
|
|
|
.Fn msg_noecho
|
|
|
|
control whether the prompt routine echo or don't echo the input that
|
|
|
|
is typed by the user.
|
2003-06-04 23:00:26 +04:00
|
|
|
.Pp
|
|
|
|
.Fn msg_prompt_win
|
|
|
|
uses the specified curses window instead of the default one.
|
2003-09-25 22:32:10 +04:00
|
|
|
.Pp
|
|
|
|
.Fn msg_row
|
|
|
|
return the current row - i.e.: getcury(msg_win) + getbegy(msg_win).
|
2001-12-01 23:43:39 +03:00
|
|
|
.Sh AUTHORS
|
1997-09-27 01:16:38 +04:00
|
|
|
Philip A. Nelson for Piermont Information Systems Inc.
|