Module Name:    src
Committed By:   martin
Date:           Wed Jan  2 16:32:59 UTC 2019

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

Log Message:
If a menu starts with disabled options, skip those and start at the
first enabled one instead.


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.61 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/menu_sys.def
diff -u src/usr.bin/menuc/menu_sys.def:1.60 src/usr.bin/menuc/menu_sys.def:1.61
--- src/usr.bin/menuc/menu_sys.def:1.60	Wed Nov 21 20:04:48 2018
+++ src/usr.bin/menuc/menu_sys.def	Wed Jan  2 16:32:59 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: menu_sys.def,v 1.60 2018/11/21 20:04:48 martin Exp $	*/
+/*	$NetBSD: menu_sys.def,v 1.61 2019/01/02 16:32:59 martin Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -684,12 +684,16 @@ process_menu(int num, void *arg)
 	if (m == NULL)
 		return;
 
-	/* Default to select option 0 and display from 0 */
+	/* Default to select option 0 and display from 0, skip any
+	 * disabled options at the top of the menu. */
 	m->topline = 0;
-	if ((m->mopt & (MC_DFLTEXIT | MC_NOEXITOPT)) == MC_DFLTEXIT)
+	if ((m->mopt & (MC_DFLTEXIT | MC_NOEXITOPT)) == MC_DFLTEXIT) {
 		m->cursel = -1;
-	else
-		m->cursel = 0;
+	} else {
+		for (m->cursel = 0; m->cursel < m->numopts; m->cursel++)
+			if ((m->opts[m->cursel].opt_flags & OPT_IGNORE) == 0)
+				break;
+	}
 
 	for (;;) {
 		if (isendwin())

Reply via email to