Module Name:    src
Committed By:   martin
Date:           Wed Feb  6 20:08:15 UTC 2019

Modified Files:
        src/usr.bin/menuc: mdb.c menu_sys.def

Log Message:
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).


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/usr.bin/menuc/mdb.c
cvs rdiff -u -r1.64 -r1.65 src/usr.bin/menuc/menu_sys.def

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/menuc/mdb.c
diff -u src/usr.bin/menuc/mdb.c:1.49 src/usr.bin/menuc/mdb.c:1.50
--- src/usr.bin/menuc/mdb.c:1.49	Wed Jan  9 19:43:37 2019
+++ src/usr.bin/menuc/mdb.c	Wed Feb  6 20:08:15 2019
@@ -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 @@ write_menu_file(char *initcode)
 			    "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");

Index: src/usr.bin/menuc/menu_sys.def
diff -u src/usr.bin/menuc/menu_sys.def:1.64 src/usr.bin/menuc/menu_sys.def:1.65
--- src/usr.bin/menuc/menu_sys.def:1.64	Wed Jan  9 19:43:37 2019
+++ src/usr.bin/menuc/menu_sys.def	Wed Feb  6 20:08:15 2019
@@ -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 @@ set_menu_numopts(int menu, int numopts)
 	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. */

Reply via email to