_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
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.
- 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
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.
* 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
(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.
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.