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 a way to set the string used for the '...



details:   https://anonhg.NetBSD.org/src/rev/78cca111abc2
branches:  trunk
changeset: 473811:78cca111abc2
user:      cgd <cgd%NetBSD.org@localhost>
date:      Sun Jun 20 02:07:18 1999 +0000

description:
provide a way to set the string used for the 'Exit' menu item.

diffstat:

 usr.bin/menuc/main.c       |   4 +++-
 usr.bin/menuc/mdb.c        |  10 +++++++++-
 usr.bin/menuc/mdb.h        |   3 ++-
 usr.bin/menuc/menu_sys.def |   5 +++--
 usr.bin/menuc/parse.y      |   3 ++-
 usr.bin/menuc/scan.l       |   4 +++-
 6 files changed, 22 insertions(+), 7 deletions(-)

diffs (120 lines):

diff -r b06652efccf8 -r 78cca111abc2 usr.bin/menuc/main.c
--- a/usr.bin/menuc/main.c      Sun Jun 20 01:23:32 1999 +0000
+++ b/usr.bin/menuc/main.c      Sun Jun 20 02:07:18 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.4 1998/02/03 03:51:49 perry Exp $   */
+/*     $NetBSD: main.c,v 1.5 1999/06/20 02:07:18 cgd Exp $     */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -80,6 +80,8 @@
        /* The default menu */
        default_menu.info = &default_info;
        default_info.title = "\"\"";
+       default_info.helpstr = NULL;
+       default_info.exitstr = NULL;
        default_info.mopt = 0;
        default_info.x = 0;
        default_info.y = 0;
diff -r b06652efccf8 -r 78cca111abc2 usr.bin/menuc/mdb.c
--- a/usr.bin/menuc/mdb.c       Sun Jun 20 01:23:32 1999 +0000
+++ b/usr.bin/menuc/mdb.c       Sun Jun 20 02:07:18 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mdb.c,v 1.13 1999/06/19 06:38:49 cgd Exp $     */
+/*     $NetBSD: mdb.c,v 1.14 1999/06/20 02:07:18 cgd Exp $     */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -184,6 +184,7 @@
                "       menu_ent *opts;\n"
                "       WINDOW   *mw;\n"
                "       char     *helpstr;\n"
+               "       char     *exitstr;\n"
                "       void    (*post_act)(void);\n"
                "       void    (*exit_act)(void);\n"
                "} menudesc ;\n"
@@ -347,6 +348,13 @@
                                }
                        (void) fprintf (out_file, "\"");
                }
+               (void) fprintf (out_file, ",");
+               if (menus[i]->info->mopt & NOEXITOPT)
+                       (void) fprintf (out_file, "NULL");
+               else if (menus[i]->info->exitstr != NULL)
+                       (void) fprintf (out_file, menus[i]->info->exitstr);
+               else
+                       (void) fprintf (out_file, "\"Exit\"");
                if (strlen(menus[i]->info->postact.code))
                        (void) fprintf (out_file, ",menu_%d_postact", i);
                else
diff -r b06652efccf8 -r 78cca111abc2 usr.bin/menuc/mdb.h
--- a/usr.bin/menuc/mdb.h       Sun Jun 20 01:23:32 1999 +0000
+++ b/usr.bin/menuc/mdb.h       Sun Jun 20 02:07:18 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mdb.h,v 1.3 1998/06/25 09:58:57 phil Exp $     */
+/*     $NetBSD: mdb.h,v 1.4 1999/06/20 02:07:18 cgd Exp $      */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -77,6 +77,7 @@
 struct menu_info {
        char *title;
        char *helpstr;
+       char *exitstr;
        int mopt;
        int y, x;
        int h, w;
diff -r b06652efccf8 -r 78cca111abc2 usr.bin/menuc/menu_sys.def
--- a/usr.bin/menuc/menu_sys.def        Sun Jun 20 01:23:32 1999 +0000
+++ b/usr.bin/menuc/menu_sys.def        Sun Jun 20 02:07:18 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: menu_sys.def,v 1.18 1999/06/20 01:20:14 cgd Exp $      */
+/*     $NetBSD: menu_sys.def,v 1.19 1999/06/20 02:07:18 cgd Exp $      */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -369,7 +369,8 @@
                        selrow = cury;
                } else
                        mvwaddstr (m->mw, cury, hasbox, " ");
-               waddstr (m->mw, "x: Exit");
+               waddstr (m->mw, "x: ");
+               waddstr (m->mw, m->exitstr);
                if (m->cursel >= m->numopts)
                        wstandend(m->mw);
                cury++;
diff -r b06652efccf8 -r 78cca111abc2 usr.bin/menuc/parse.y
--- a/usr.bin/menuc/parse.y     Sun Jun 20 01:23:32 1999 +0000
+++ b/usr.bin/menuc/parse.y     Sun Jun 20 02:07:18 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: parse.y,v 1.6 1998/07/02 21:46:18 phil Exp $   */
+/*     $NetBSD: parse.y,v 1.7 1999/06/20 02:07:18 cgd Exp $    */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -138,6 +138,7 @@
          | W "=" INT_CONST     { cur_menu->info->w = atoi($3); }
          | H "=" INT_CONST     { cur_menu->info->h = atoi($3); }
          | TITLE STRING        { cur_menu->info->title = $2; }
+         | EXITSTRING STRING   { cur_menu->info->exitstr = $2; }
          ;
 
 option_list : option
diff -r b06652efccf8 -r 78cca111abc2 usr.bin/menuc/scan.l
--- a/usr.bin/menuc/scan.l      Sun Jun 20 01:23:32 1999 +0000
+++ b/usr.bin/menuc/scan.l      Sun Jun 20 02:07:18 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: scan.l,v 1.7 1998/07/02 21:46:19 phil Exp $    */
+/*     $NetBSD: scan.l,v 1.8 1999/06/20 02:07:18 cgd Exp $     */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -84,6 +84,8 @@
 
 exit   { return  EXIT; }
 
+exitstring { return  EXITSTRING; }
+
 title  { return TITLE; }
 
 action { return ACTION; }



Home | Main Index | Thread Index | Old Index