Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/sushi Add better handling of a failure to find any ...



details:   https://anonhg.NetBSD.org/src/rev/9711219ecd5c
branches:  trunk
changeset: 501885:9711219ecd5c
user:      garbled <garbled%NetBSD.org@localhost>
date:      Mon Jan 08 21:19:31 2001 +0000

description:
Add better handling of a failure to find any menus at all for sushi to
process.  Document the ability to use "quicknames" in the sushi manpage.

diffstat:

 usr.sbin/sushi/C.msg   |   1 +
 usr.sbin/sushi/sushi.8 |  16 +++++++++++++---
 usr.sbin/sushi/sushi.c |  17 +++++++++++++++--
 3 files changed, 29 insertions(+), 5 deletions(-)

diffs (112 lines):

diff -r 6e71528d61dc -r 9711219ecd5c usr.sbin/sushi/C.msg
--- a/usr.sbin/sushi/C.msg      Mon Jan 08 21:16:26 2001 +0000
+++ b/usr.sbin/sushi/C.msg      Mon Jan 08 21:19:31 2001 +0000
@@ -17,6 +17,7 @@
 16 cannot allocate scroll widget
 17 select failure
 18 can't stat
+19 No menu hierchy found.
 $set 2 labels
 1 F1=Help
 2 F2=Refresh
diff -r 6e71528d61dc -r 9711219ecd5c usr.sbin/sushi/sushi.8
--- a/usr.sbin/sushi/sushi.8    Mon Jan 08 21:16:26 2001 +0000
+++ b/usr.sbin/sushi/sushi.8    Mon Jan 08 21:19:31 2001 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: sushi.8,v 1.2 2001/01/08 08:33:24 garbled Exp $
+.\" $NetBSD: sushi.8,v 1.3 2001/01/08 21:19:31 garbled Exp $
 .\" Copyright (c) 2001 The NetBSD Foundation, Inc.
 .\" All rights reserved.
 .\"
@@ -41,6 +41,7 @@
 .Nd a menu based system administration tool
 .Sh SYNOPSIS
 .Nm
+.Op Ar quickname
 .Sh DESCRIPTION
 The
 .Nm
@@ -58,6 +59,16 @@
 have multiple heirarchies, and even ones private to a particular user on 
 the machine.  These hierarchies are all merged for the user at run-time 
 into a single menu system.
+.Pp
+The following option is available:
+.Bl -tag -width "quickname"
+.It Ar quickname
+This option allows the user to jump directly to a known submenu or function
+within
+.Nm .
+It can be used to avoid the need to navigate deeply nested menus, when the
+end destination is known.
+.El
 .Sh ENVIRONMENT
 The following environment variables are utilized by
 .Nm :
@@ -118,8 +129,7 @@
 which are currently being worked on.  In addition there are some failure 
 modes that
 .Nm
-does not handle well, such as not finding any menus at all, or not 
-recieving output from an escript field.
+does not handle well, such as not recieving output from an escript field.
 .Pp
 At the time of this writing, the F6 option, to display the current command
 before running it, does not work.
diff -r 6e71528d61dc -r 9711219ecd5c usr.sbin/sushi/sushi.c
--- a/usr.sbin/sushi/sushi.c    Mon Jan 08 21:16:26 2001 +0000
+++ b/usr.sbin/sushi/sushi.c    Mon Jan 08 21:19:31 2001 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: sushi.c,v 1.1 2001/01/05 01:28:39 garbled Exp $       */
+/*      $NetBSD: sushi.c,v 1.2 2001/01/08 21:19:31 garbled Exp $       */
 
 /*
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -99,6 +99,7 @@
                if (!mte) {
                        printf("QuickName %s not found in any menus.\n",
                                argv[1]);
+                       catclose(catalog);
                        exit(EXIT_FAILURE);
                }
        }
@@ -110,6 +111,7 @@
 
        initCDKColor();
        raw();
+       timeout(150);
 
        if (mte == NULL)
                navigate_menu(cqMenuHeadp, "sushi", 
@@ -117,12 +119,13 @@
        else
                navigate_submenu(mte);
 
-       destroyCDKScreen (cdkscreen);
+       destroyCDKScreen(cdkscreen);
        endCDK();
        endwin();
 #ifdef DEBUG
        tree_printtree(cqMenuHeadp);
 #endif
+
        catclose(catalog);
        exit(EXIT_SUCCESS);
 }
@@ -266,6 +269,16 @@
                ++items;
        }
 
+       if (items == 0) {
+               destroyCDKScreen(cdkscreen);
+               endCDK();
+               endwin();
+               (void)fprintf(stderr, "%s\n", catgets(catalog, 1, 19,
+                   "No menu hierarchy found"));
+               catclose(catalog);
+               exit(EXIT_FAILURE);
+       }
+
        bottom_help(1);
 
        scroll = newCDKScroll(cdkscreen, CENTER, TOP, RIGHT,



Home | Main Index | Thread Index | Old Index