Subject: Re: menuc vs libmenu
To: Patrick Welche <>
From: Brett Lymn <>
List: current-users
Date: 07/22/2000 23:30:26
According to Patrick Welche:
>I just got confused and wrote the following:
>  It appears that menuc generates a file (menu_defs.c by default) which defines
>  a function int menu_init(void), declared in menu_defs.h. If one includes
>  <menu.h>, there is a conflict as a function Menu_Hook menu_init(MENU *)
>  is already declared there, as defined in libmenu/menu.c:242.

Hmmm this is Most Unfortunate.  The Menu_Hook typedef in menu.h is so
named to be compatiable with ncurses - that was a deliberate decision
on my part, I could see no point in diverging.

>Then wondered why sysinst works. Answer: it doesn't use libmenu => never
>includes menu.h.

True - I was told most emphatically that it would be though.

> So, what is the difference between menuc+input file vs
>functions in libmenu - pros/cons/preferences?

Just from a quick look at the menu stuff for sysinst the problems I
can see with menuc are:

1) Lacking man pages (sorry Phil...)
2) It appears that the programmer has no control over the binding of
   keys to actions.
3) The input key handling ....ummmm.... sucks - to be fair menuc was
   probably written before Julian and I started hacking on curses but
   there are better ways to handle input in curses now.
4) Layout policy is fixed (ie you can only do vertical menus)
5) No option for putting justified descriptions next to items apart
   from manually
6) Menu display attributes appear to be fixed
7) No support for item searching (ie you type characters that start
   the item you are looking for and that item is automatically selected)
8) No control over wrapping of menu - menuc will not allow you to wrap
   around to the bottom item if you go up when at the top item
   (something that always bugs me in sysinst)
9) No way to perform actions before changing to a new item.

libmenu can do all the above.

some advantages menuc are:

1) it is small - the amount of code that menuc adds is quite small,
   libmenu.a weighs in at about 18k on i386.  Mind you, libmenu is
   more capable :-)

If you want to see a sample of libmenu based code then checkout
othersrc/usr.bin/edit from cvs.  Have a read through file.c (most of
the files have libmenu calls in them) which does not only a fixed
menu to handle the file menu popup but also a dynamic menu that is
used to select the file to edit.

If anyone has any questions about libmenu, feel free to email me - I
believe I know it inside out ;-)

Brett Lymn, Computer Systems Administrator, BAE SYSTEMS