Home | History | Annotate | Download | only in menuc
History log of /src/usr.bin/menuc/mdb.c
RevisionDateAuthorComments
 1.53  23-Jun-2019  martin Menu 0 does not exist anymore (it is now OPT_NOMENU), so emit an empty
menu defintion for it.
 1.52  22-Jun-2019  christos Conserve space: make ints to shorts and make OPT_NOMENU 0 instead of -1
so we don't require initializing it.
 1.51  25-Feb-2019  martin Add an option to supress the vertical space between menu title and
menu items.
 1.50  06-Feb-2019  martin Provide an accessor for the menu description structure by manu identifier.
Usefull for dynamic menus where you want to change details on the
fly "from the outside" (i.e. while not in one of the callback functions).
 1.49  09-Jan-2019  martin Allow argument expansion in menu titles as well.
 1.48  04-Jan-2019  martin Add an option for single (disabled) menu lines to have no shortcut.
 1.47  21-Nov-2018  martin Add (optional) support for expanded static menu texts - that is: whatever
the application programmer defines as expansion, e.g. to implement
parameter substitution.
While here add rudimentary documentation of the dynamic messages
feature (so at least the parser and the syntax documented here
are in sync).
The man page could use some typesetting help...
 1.46  06-Mar-2012  mbalmer branches: 1.46.30; 1.46.32;
Remove the advertising clause and appease the eye a bit (still not good, but
better). Almost no functional change.
 1.45  06-Sep-2011  joerg branches: 1.45.2;
Mark __menu_initerror as dead in the output.
 1.44  16-Jan-2008  tls Fix PR37377 from Devon O'Dell: num_menus can be referenced without being
emitted if dynamic menus are not enabled.
 1.43  23-Oct-2006  he branches: 1.43.8;
Fully initialize the last element of menu_def[].
 1.42  20-Feb-2006  dsl Allow menu entry option names to be code fragments that (should) call
wprintw(menu->mw, ftm, args) to generate the menu label.
Allows static menu labels to contain the current value (like a lot of the
dynamic menus do).
Correct width calculations, and bound menu table lookup.
 1.41  02-Aug-2004  dsl Support menu windows that preserve the underlying screen contents.
(Needs a libcurses fix as well).
No need to ponce about with __m_endwin (to remember we've done endwin()),
the old recovery was wrong in any case - but I've left something that
will do an explicit redraw.
Allow the 'help' text to be from a variable (and hence translated).
Fix the display of help so that the screen underneath is actually cleared.
Preserve the screen contents while displaying help - redraw is too hard.
Use endwin(); doupdate(); to do the full refresh when ^L is typed.
Move menus up the screen if they would hit the bottom with too few lines
to show an item and the scroll text (happens with big titles).
Make 'y=0' center the window vertically - use of 0 means you can't have
a menu starting on the topline, but this is unlikely to be a problem.
Make all the menu options settable from the control file, not just from
dynamic menus.
Redo menu option list part of man page.
 1.40  20-Jun-2004  jmc Completely rework how tools/compat is done. Purge all uses/references to
_NETBSD_SOURCE as this makes cross building from older/newer versions of
NetBSD harder, not easier (and also makes the resulting tools 'different')

Wrap all required code with the inclusion of nbtool_config.h, attempt to
only use POSIX code in all places (or when reasonable test w. configure and
provide definitions: ala u_int, etc).

Reviewed by lukem. Tested on FreeBSD 4.9, Redhat Linux ES3, NetBSD 1.6.2 x86
NetBSD current (x86 and amd64) and Solaris 9.

Fixes PR's: PR#17762 PR#25944
 1.39  18-Oct-2003  dsl branches: 1.39.2;
Add an MC_ALWAYS_SCROLL to mean "always allow space for 'scrolltext'".
All scrolltext to be #defined so it can be translated.
 1.38  27-Jul-2003  dsl More tweaks for sysinst.
Let 'display action' routine set menu->cursel (ie default menu item).
Remove 'opt' parameter I added to action routine (not that useful).
Make man page slightly closer to reality.
 1.37  25-Jul-2003  dsl Spinkle some consts and remove/change parameter names so that sysinst
will compile with WARNS=3.
 1.36  17-Jul-2003  lukem only use __RCSID() if it is #defined
 1.35  07-Jul-2003  dsl Add OPT_IGNORE flag which makes menu item inactive.
Add menu-dependant function to draw menu lines (when opt_name NULL).
 1.34  23-Jun-2003  agc Add NetBSD RCS Ids.
 1.33  10-Jun-2003  dsl Add extra command 'allow dynamic messages' which will push all texts through
the msgc translation service.
Allow for texts being NULL as well as "", don't use strlen() to test for "".
 1.32  09-Jun-2003  dsl More changes to improve sysinst:
- pass 'menudesc' and 'arg' values to post_act() and exit_act()
- add set_menu_numopt() for variable length menus
- fix (badly broken) allocation/free of dynamic menus
- option to allow default selection to be the exit line
 1.31  04-Jun-2003  dsl Add 'exit' (for exit text) parameter to new_menu() for dynamic menus.
Correct calculation of menu height and whether scrolling needs (was wrong
if a height was specified that was smaller that the number of lines needed).
Move keypad(m->mw, TRUE) to stop core dump when newwin() fails.
Allow for calling code hacking m->h (to reduce number of lines displayed).
Add a MC_NOCLEAR option to leave menu text showing when doing action.
 1.30  03-Jun-2003  dsl Add a 'void *' argument to process_menu() so that some more global variables
can be killed.
 1.29  16-May-2003  dsl Re-instate last change, the sysinst I've just commited doesn't stand
a chance unless those fields are const char *.
 1.28  09-May-2003  lukem Revert part of previous, and remove "const" from "char *opt_name" and
"char *title", since it causes compile problems for the only program
that uses menuc (sysinst).
 1.27  09-May-2003  dsl Finger trouble in previous commit.
 1.26  09-May-2003  dsl Update man page for recent changes, update code to match man page...
 1.25  08-May-2003  dsl Accept variable names for menu titles and options to allow internationalisation.
Allow user code to define a hook to lookup message texts before any get used.
It is now possible to have a langauge independant menu file.
 1.24  10-Jan-2003  christos produce lint free code.
 1.23  07-Mar-2002  tv MAX has special meaning in host tools. #undef it first.
 1.22  15-Oct-2001  bjh21 Move hard-coded /usr/share/misc from mdb.c to pathnames.h, in accordance
with KNF.
 1.21  20-Feb-2001  cgd use getprogname()
 1.20  07-Jan-2001  phil Improve a parameter list, add the actual documentation for menuc.
 1.19  28-Dec-2000  mrg fix oversight in previous.
 1.18  22-Dec-2000  mrg say "<progname>: Could not initialize curses", with the progname
 1.17  15-Aug-2000  phil Tweek the "no shortcut" code.
MC_NOSHORTKEY to NOSHORTCUT
added option "shortcut" to menuc input language.
added example of this kind of menu in testm.
 1.16  15-Aug-2000  hubertf Changes:
* bring closer to KNF
* when selecting a item in a menu, call the opt_action() callback with
a pointer to the struct menudesc, so the callback has a chance to find
out which item was selected. Having a seperate callback for each
item is ok for small menus, but not for ones with many objects.
* Add menu-option MC_NOSHORTCUT to not print letters ("a: ", ...)
in front of list items. Again, this is for menues with lots of entries
as e.g. the upcoming sysinst set_timezone() function composes.
* Fix a long-standing bug WRT pagewise scrolling - the cursor is now
properly placed one page up/down
 1.15  23-Jul-2000  wiz Add format string to fprintf().
 1.14  20-Jun-1999  cgd branches: 1.14.8;
provide a way to set the string used for the 'Exit' menu item.
 1.13  19-Jun-1999  cgd * be more descriptive with the windor/screen too small for menu messages
(say width or height).
* work harder to make menu fit width-wise. (if necessary, move the menu
further left, and if that's not good enough exit with an error.)
* move menu system initialization out of process_menu() so that it can
be called earlier (e.g. by the sysinst main()), since it initializes
curses and other code might want to access the curses data structures
before process_menu() is invoked.
 1.12  23-Jul-1998  phil branches: 1.12.2;
Put back "return value" meaning in option actions accidentally removed
in chanages for dynamic menus. (Return !=0 means to exit menu dynamically.)
 1.11  16-Jul-1998  phil Major restructuring of the runtime code, now supports dynamic menus.
Fixed a bug is scrolling. Added dynamic menu to test meuns in testm.
 1.10  02-Jul-1998  phil Small tweeks, redoing language for dynamic menus.
 1.9  01-Jul-1998  phil Bug fixes, tweeks to scrolling, beginnings of dynamic menus.
 1.8  29-Jun-1998  phil Bug fixes in scrolling menues, better error detection with small screens,
bettern keypad support with suport form multiple key "commands" like
ESC-v for previous page.
 1.7  25-Jun-1998  phil Tweeks to option lettering ... to allow 51 options per menu. Also
to generate an error if there are more. (Checkpoint before furthur
changes to recognize more keypad keys.)
 1.6  25-Jun-1998  phil Add scrollable menus. Tweek testm's Makefile to remake if menu_sys.def
is modified.
 1.5  24-Jun-1998  phil Add a online help facility. Each menu can specify a help screen associated
with that menu. The help screen is scrollable for long help screens.
The char '?' accesses the help screen as a menu command. Help screen text
is specified in the menu definition file with the menu.
 1.4  30-Mar-1998  mrg use static int instead of static
 1.3  15-Jan-1998  cgd fgetc() returns 'int'. (char)EOF != EOF on unsigned-char machines.
 1.2  09-Nov-1997  phil Add code for handling NULL return from initscr(). Added "ERROR ACTION"
for user code for above error.
 1.1  26-Sep-1997  phil branches: 1.1.1;
Initial revision
 1.1.1.1  26-Sep-1997  phil branches: 1.1.1.1.2;
Add a curses based menu compiler system. (Used by the new system install
program sysinst.)
 1.1.1.1.2.2  29-Jan-1998  mellon Pull up 1.3 (cgd)
 1.1.1.1.2.1  09-Nov-1997  mellon Pull rev 1.2 up from trunk (phil)
 1.12.2.1  24-Jun-1999  cgd pull up rev(s) 1.13-1.14 from trunk. (cgd)
 1.14.8.2  15-Mar-2003  he Pull up revision 1.20 (via patch, requested by gmcgarry in ticket #9):
Improve some argument lists, to allow this to compile cleanly
with later toolchains.
 1.14.8.1  15-Aug-2000  hubertf Pull up to netbsd-1-5 branch, OK'd by thorpej:

Revisions:
> cvs rdiff -r1.15 -r1.16 basesrc/usr.bin/menuc/mdb.c
> cvs rdiff -r1.22 -r1.23 basesrc/usr.bin/menuc/menu_sys.def

Log Message:
> * bring closer to KNF
> * when selecting a item in a menu, call the opt_action() callback with
> a pointer to the struct menudesc, so the callback has a chance to find
> out which item was selected. Having a seperate callback for each
> item is ok for small menus, but not for ones with many objects.
> * Add menu-option MC_NOSHORTCUT to not print letters ("a: ", ...)
> in front of list items. Again, this is for menues with lots of entries
> as e.g. the upcoming sysinst set_timezone() function composes.
> * Fix a long-standing bug WRT pagewise scrolling - the cursor is now
> properly placed one page up/down
 1.39.2.1  22-Jun-2004  tron branches: 1.39.2.1.2;
Pull up revision 1.40 (requested by jmc in ticket #527):
Completely rework how tools/compat is done. Purge all uses/references to
_NETBSD_SOURCE as this makes cross building from older/newer versions of
NetBSD harder, not easier (and also makes the resulting tools 'different')
Wrap all required code with the inclusion of nbtool_config.h, attempt to
only use POSIX code in all places (or when reasonable test w. configure and
provide definitions: ala u_int, etc).
Reviewed by lukem. Tested on FreeBSD 4.9, Redhat Linux ES3, NetBSD 1.6.2 x86
NetBSD current (x86 and amd64) and Solaris 9.
Fixes PR's: PR#17762 PR#25944
 1.39.2.1.2.1  23-Jul-2005  snj Pull up revision 1.41 (requested by riz in ticket #5515):
Support menu windows that preserve the underlying screen contents.
(Needs a libcurses fix as well).
No need to ponce about with __m_endwin (to remember we've done endwin()),
the old recovery was wrong in any case - but I've left something that
will do an explicit redraw.
Allow the 'help' text to be from a variable (and hence translated).
Fix the display of help so that the screen underneath is actually cleared.
Preserve the screen contents while displaying help - redraw is too hard.
Use endwin(); doupdate(); to do the full refresh when ^L is typed.
Move menus up the screen if they would hit the bottom with too few lines
to show an item and the scroll text (happens with big titles).
Make 'y=0' center the window vertically - use of 0 means you can't have
a menu starting on the topline, but this is unlikely to be a problem.
Make all the menu options settable from the control file, not just from
dynamic menus.
Redo menu option list part of man page.
 1.43.8.1  23-Mar-2008  matt sync with HEAD
 1.45.2.1  17-Apr-2012  yamt sync with head
 1.46.32.2  13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.46.32.1  10-Jun-2019  christos Sync with HEAD
 1.46.30.2  18-Jan-2019  pgoyette Synch with HEAD
 1.46.30.1  26-Nov-2018  pgoyette Sync with HEAD, resolve a couple of conflicts

RSS XML Feed