Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/menuc Update man page for recent changes, update cod...



details:   https://anonhg.NetBSD.org/src/rev/105489180bee
branches:  trunk
changeset: 546934:105489180bee
user:      dsl <dsl%NetBSD.org@localhost>
date:      Fri May 09 07:30:50 2003 +0000

description:
Update man page for recent changes, update code to match man page...

diffstat:

 usr.bin/menuc/mdb.c   |  54 +++++++++++++++++++++---------------------
 usr.bin/menuc/menuc.1 |  65 ++++++++++++++++++++++++++++++--------------------
 2 files changed, 66 insertions(+), 53 deletions(-)

diffs (236 lines):

diff -r f40bb5a18348 -r 105489180bee usr.bin/menuc/mdb.c
--- a/usr.bin/menuc/mdb.c       Fri May 09 05:33:52 2003 +0000
+++ b/usr.bin/menuc/mdb.c       Fri May 09 07:30:50 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mdb.c,v 1.25 2003/05/08 16:20:56 dsl Exp $     */
+/*     $NetBSD: mdb.c,v 1.26 2003/05/09 07:30:50 dsl Exp $     */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -52,9 +52,9 @@
 static id_rec *menus[MAX];
 
 /* Other defines */
-#define OPT_SUB    1
-#define OPT_ENDWIN 2
-#define OPT_EXIT   4
+#define OPT_SUB                1
+#define OPT_ENDWIN     2
+#define OPT_EXIT       4
 
 
 /* get_menu returns a pointer to a newly created id_rec or an old one. */
@@ -166,30 +166,30 @@
                "struct menudesc;\n"    
                "typedef\n"
                "struct menu_ent {\n"
-               "       const char   *opt_name;\n"
-               "       int     opt_menu;\n"
-               "       int     opt_flags;\n"
-               "       int     (*opt_action)(struct menudesc *);\n"
+               "       const char      *opt_name;\n"
+               "       int             opt_menu;\n"
+               "       int             opt_flags;\n"
+               "       int             (*opt_action)(struct menudesc *);\n"
                "} menu_ent ;\n\n"
-               "#define OPT_SUB    1\n"
-               "#define OPT_ENDWIN 2\n"
-               "#define OPT_EXIT   4\n"
-               "#define OPT_NOMENU -1\n\n"
+               "#define OPT_SUB        1\n"
+               "#define OPT_ENDWIN     2\n"
+               "#define OPT_EXIT       4\n"
+               "#define OPT_NOMENU     -1\n\n"
                "typedef\n"
                "struct menudesc {\n"
-               "       const char     *title;\n"
-               "       int      y, x;\n"
-               "       int      h, w;\n"
-               "       int      mopt;\n"
-               "       int      numopts;\n"
-               "       int      cursel;\n"
-               "       int      topline;\n"
-               "       menu_ent *opts;\n"
-               "       WINDOW   *mw;\n"
-               "       char     *helpstr;\n"
-               "       char     *exitstr;\n"
-               "       void    (*post_act)(void);\n"
-               "       void    (*exit_act)(void);\n"
+               "       const char      *title;\n"
+               "       int             y, x;\n"
+               "       int             h, w;\n"
+               "       int             mopt;\n"
+               "       int             mopts;\n"
+               "       int             cursel;\n"
+               "       int             topline;\n"
+               "       menu_ent        *opts;\n"
+               "       WINDOW          *mw;\n"
+               "       const char      *helpstr;\n"
+               "       const char      *exitstr;\n"
+               "       void            (*post_act)(void);\n"
+               "       void            (*exit_act)(void);\n"
                "} menudesc ;\n"
                "\n"
                "/* defines for mopt field. */\n"
@@ -345,7 +345,7 @@
                        (void) fprintf (out_file, "\n\"");
                        while (*tmpstr)
                                if (*tmpstr != '\n')
-                                 fputc (*tmpstr++, out_file);
+                                       fputc (*tmpstr++, out_file);
                                else {
                                        (void) fprintf (out_file, "\\n\\\n");
                                        tmpstr++;
@@ -393,7 +393,7 @@
 
        /* Copy menu_sys.def file. */
        while ((ch = fgetc(sys_file)) != '\014')  /* Control-L */
-               fputc(ch, out_file);            
+               fputc(ch, out_file);
 
        if (do_dynamic) {
                while ((ch = fgetc(sys_file)) != '\n')
diff -r f40bb5a18348 -r 105489180bee usr.bin/menuc/menuc.1
--- a/usr.bin/menuc/menuc.1     Fri May 09 05:33:52 2003 +0000
+++ b/usr.bin/menuc/menuc.1     Fri May 09 07:30:50 2003 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: menuc.1,v 1.14 2003/05/09 05:28:30 phil Exp $
+.\"    $NetBSD: menuc.1,v 1.15 2003/05/09 07:30:50 dsl Exp $
 .\"
 .\" Copyright 1997 Piermont Information Systems Inc.
 .\" All rights reserved.
@@ -33,7 +33,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
 .\" THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd September 26, 1997
+.Dd May 9, 2003
 .Os
 .Dt MENUC 1
 .Sh NAME
@@ -105,6 +105,9 @@
 The initial code block usually contains includes of header files used by
 code in the menu code blocks later in the
 .Ar file .
+If USER_MENU_INIT is #defined, then it will be evaluated before the
+rest of the menu is initialised, if it evaluates to a non-zero value
+then the initialisation will fail.
 The file is free format, so the actual formatting of the input
 .Ar file
 is to the taste of the programmer.
@@ -171,7 +174,7 @@
 The options appear in three forms:
 .Dl variable = value
 .Dl [no] switch
-.Dl variable "string"
+.Dl variable Ar string
 .Pp
 The variables for the first form are
 .Va x ,
@@ -182,6 +185,9 @@
 These specify the upper left (x,y) and the
 height (h) and width (w) of the menu window.
 The upper left is in the curses coordinate system.
+If
+.Va x
+is \&-1 the menu window will be centered.
 If not specified, the upper left is the upper left of the screen
 and the height and width of the menu window is computed
 from the menu definition.
@@ -189,27 +195,33 @@
 Options of the second form turn on or off (with the
 optional no) features of the menu system.
 The
-.Li box
+.Va box
 option turns on a box around the menu window.
 The
-.Li exit
+.Va exit
 option enables the standard exit option in the menus.
 The
-.Li scrollable
+.Va scrollable
 option allows the menu to be scrollable if the
 menu window is smaller than the number of menu options.
 The
-.Li shortcut
+.Va shortcut
 option prints a single character shortcut with each menu
 option.
 .Pp
 The third sets text variables.
+The
+.Ar string
+can be either a quoted text string or a name #defined to something
+suitable for initialising a const char * field.
 The variable
 .Va title
 sets the text title for the menus.
 The variable
 .Va exitstring
-sets the text for the exit menu option.
+sets the text for the exit menu option and sets the
+.Va exit
+option.
 .Pp
 The default declaration may appear multiple times.
 Each time, it sets the default values for menu definitions that follow
@@ -257,7 +269,8 @@
 .Dl option \*[Lt]string\*[Gt], \*[Lt]element_list\*[Gt] ;
 The
 .Em \*[Lt]string\*[Gt]
-is the text displayed for the menu item.
+is the text displayed for the menu item, this must be a quoted string
+or a name #defined to something that will initialise a const char * field.
 There may be an arbitrary number of these items.
 (If there are shortcuts in the menu, a practical limit
 of 51 should be recognized.
@@ -327,10 +340,10 @@
 
 typedef
 struct menu_ent {
-        char   *opt_name;
-        int     opt_menu;
-        int     opt_flags;
-        int     (*opt_action)(struct menudesc *);
+        const char  *opt_name;
+        int         opt_menu;
+        int         opt_flags;
+        int         (*opt_action)(struct menudesc *);
 } menu_ent ;
 
 /* For opt_menu */
@@ -343,19 +356,19 @@
 
 typedef
 struct menudesc {
-        char     *title;
-        int      y, x;
-        int      h, w;
-        int      mopt;
-        int      numopts;
-        int      cursel;
-        int      topline;
-        menu_ent *opts;
-        WINDOW   *mw;
-        char     *helpstr;
-        char     *exitstr;
-        void    (*post_act)(void);
-        void    (*exit_act)(void);
+        const char  *title;
+        int         y, x;
+        int         h, w;
+        int         mopt;
+        int         numopts;
+        int         cursel;
+        int         topline;
+        menu_ent    *opts;
+        WINDOW      *mw;
+        const char  *helpstr;
+        const char  *exitstr;
+        void       (*post_act)(void);
+        void       (*exit_act)(void);
 } menudesc ;
 
 /* defines for mopt field. */



Home | Main Index | Thread Index | Old Index