Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/menuc Provide an accessor for the menu description s...



details:   https://anonhg.NetBSD.org/src/rev/9f76578f6989
branches:  trunk
changeset: 448668:9f76578f6989
user:      martin <martin%NetBSD.org@localhost>
date:      Wed Feb 06 20:08:15 2019 +0000

description:
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).

diffstat:

 usr.bin/menuc/mdb.c        |   5 +++--
 usr.bin/menuc/menu_sys.def |  11 ++++++++++-
 2 files changed, 13 insertions(+), 3 deletions(-)

diffs (51 lines):

diff -r 14cd303f2551 -r 9f76578f6989 usr.bin/menuc/mdb.c
--- a/usr.bin/menuc/mdb.c       Wed Feb 06 17:56:57 2019 +0000
+++ b/usr.bin/menuc/mdb.c       Wed Feb 06 20:08:15 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mdb.c,v 1.49 2019/01/09 19:43:37 martin Exp $  */
+/*     $NetBSD: mdb.c,v 1.50 2019/02/06 20:08:15 martin Exp $  */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -41,7 +41,7 @@
 #include <sys/cdefs.h>
 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: mdb.c,v 1.49 2019/01/09 19:43:37 martin Exp $");
+__RCSID("$NetBSD: mdb.c,v 1.50 2019/02/06 20:08:15 martin Exp $");
 #endif
 
 
@@ -248,6 +248,7 @@
                            "const char *, const char *);\n"
                        "void free_menu(int);\n"
                        "void set_menu_numopts(int, int);\n"
+                       "menudesc *get_menudesc(int);\n"
                        );
 
        (void)fprintf(out_file, "\n/* Menu names */\n");
diff -r 14cd303f2551 -r 9f76578f6989 usr.bin/menuc/menu_sys.def
--- a/usr.bin/menuc/menu_sys.def        Wed Feb 06 17:56:57 2019 +0000
+++ b/usr.bin/menuc/menu_sys.def        Wed Feb 06 20:08:15 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: menu_sys.def,v 1.64 2019/01/09 19:43:37 martin Exp $   */
+/*     $NetBSD: menu_sys.def,v 1.65 2019/02/06 20:08:15 martin Exp $   */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -809,6 +809,15 @@
        MENUS(menu).numopts = numopts;
 }
 
+menudesc *
+get_menudesc(int menu)
+{
+       if (menu < 0 || menu >= num_menus)
+               return NULL;
+
+       return &MENUS(menu);
+}
+
 /* Control L is end of standard routines, remaining only for dynamic. */
 
 /* Beginning of routines for dynamic menus. */



Home | Main Index | Thread Index | Old Index