Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/sysinst Make "ask_yesno" and "ask_noyes" take a con...



details:   https://anonhg.NetBSD.org/src/rev/7282c3b48a83
branches:  trunk
changeset: 338126:7282c3b48a83
user:      martin <martin%NetBSD.org@localhost>
date:      Mon May 11 13:07:57 2015 +0000

description:
Make "ask_yesno" and "ask_noyes" take a const char * as argument, moving
the deconst() dance into the utility functions and simplifying all callers.

diffstat:

 usr.sbin/sysinst/configmenu.c |   6 +++---
 usr.sbin/sysinst/defs.h       |   6 +++---
 usr.sbin/sysinst/menus.mi     |   8 ++++----
 usr.sbin/sysinst/net.c        |   8 ++++----
 usr.sbin/sysinst/util.c       |  10 +++++-----
 5 files changed, 19 insertions(+), 19 deletions(-)

diffs (156 lines):

diff -r eb77a4203dd2 -r 7282c3b48a83 usr.sbin/sysinst/configmenu.c
--- a/usr.sbin/sysinst/configmenu.c     Mon May 11 13:01:08 2015 +0000
+++ b/usr.sbin/sysinst/configmenu.c     Mon May 11 13:07:57 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: configmenu.c,v 1.4 2015/05/10 10:14:02 martin Exp $ */
+/* $NetBSD: configmenu.c,v 1.5 2015/05/11 13:07:57 martin Exp $ */
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -258,7 +258,7 @@
        msg_prompt(MSG_addusername, NULL, username, sizeof username -1);
        if (strlen(username) == 0)
                return 0;
-       inwheel = ask_yesno(deconst(MSG_addusertowheel));
+       inwheel = ask_yesno(MSG_addusertowheel);
        ushell = "/bin/csh";
        process_menu(MENU_usersh, NULL);
        if (inwheel)
@@ -354,7 +354,7 @@
                        confp[menu->cursel]->setting = MSG_abandoned;
                        return 0;
                }
-               if (!ask_yesno(deconst(MSG_retry_pkgsrc_network))) {
+               if (!ask_yesno(MSG_retry_pkgsrc_network)) {
                        confp[menu->cursel]->setting = MSG_abandoned;
                        return 1;
                }
diff -r eb77a4203dd2 -r 7282c3b48a83 usr.sbin/sysinst/defs.h
--- a/usr.sbin/sysinst/defs.h   Mon May 11 13:01:08 2015 +0000
+++ b/usr.sbin/sysinst/defs.h   Mon May 11 13:07:57 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: defs.h,v 1.8 2015/05/10 10:14:02 martin Exp $  */
+/*     $NetBSD: defs.h,v 1.9 2015/05/11 13:07:57 martin Exp $  */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -516,8 +516,8 @@
 void   restore_etc(void);
 
 /* from util.c */
-int    ask_yesno(void*);
-int    ask_noyes(void*);
+int    ask_yesno(const char *);
+int    ask_noyes(const char *);
 int    dir_exists_p(const char *);
 int    file_exists_p(const char *);
 int    file_mode_match(const char *, unsigned int);
diff -r eb77a4203dd2 -r 7282c3b48a83 usr.sbin/sysinst/menus.mi
--- a/usr.sbin/sysinst/menus.mi Mon May 11 13:01:08 2015 +0000
+++ b/usr.sbin/sysinst/menus.mi Mon May 11 13:07:57 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: menus.mi,v 1.9 2015/05/10 10:14:02 martin Exp $        */
+/*     $NetBSD: menus.mi,v 1.10 2015/05/11 13:07:57 martin Exp $       */
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -384,7 +384,7 @@
                action { src_prompt(MSG_Xfer_dir, xfer_dir, sizeof xfer_dir); };
        option {src_legend(menu, MSG_delete_xfer_file,
                        clean_xfer_dir ? MSG_Yes : MSG_No);},
-               action {clean_xfer_dir = ask_yesno(deconst(MSG_delete_xfer_file)); };
+               action {clean_xfer_dir = ask_yesno(MSG_delete_xfer_file); };
        option MSG_Configure_network,
                action {
                        extern int network_up;
@@ -439,7 +439,7 @@
                action { src_prompt(MSG_Xfer_dir, xfer_dir, sizeof xfer_dir); };
        option {src_legend(menu, MSG_delete_xfer_file,
                        clean_xfer_dir ? MSG_Yes : MSG_No);},
-               action {clean_xfer_dir = ask_yesno(deconst(MSG_delete_xfer_file)); };
+               action {clean_xfer_dir = ask_yesno(MSG_delete_xfer_file); };
        option MSG_exit_menu_generic, exit, action { *((int*)arg) = SET_RETRY; };
 
 menu cdromsource, y=-4, x=0, w=70, no box, no clear, exitstring MSG_Continue;
@@ -611,7 +611,7 @@
                action { src_prompt(MSG_Xfer_dir, xfer_dir, sizeof xfer_dir); };
        option {src_legend(menu, MSG_delete_xfer_file,
                        clean_xfer_dir ? MSG_Yes : MSG_No);},
-               action {clean_xfer_dir = ask_yesno(deconst(MSG_delete_xfer_file)); };
+               action {clean_xfer_dir = ask_yesno(MSG_delete_xfer_file); };
        option MSG_quit_pkgsrc, exit, action { *((int*)arg) = SET_SKIP;};
 
 menu usersh, title MSG_User_shell, no clear;
diff -r eb77a4203dd2 -r 7282c3b48a83 usr.sbin/sysinst/net.c
--- a/usr.sbin/sysinst/net.c    Mon May 11 13:01:08 2015 +0000
+++ b/usr.sbin/sysinst/net.c    Mon May 11 13:07:57 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: net.c,v 1.19 2015/05/11 06:58:13 martin Exp $  */
+/*     $NetBSD: net.c,v 1.20 2015/05/11 13:07:57 martin Exp $  */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -747,7 +747,7 @@
                     !is_v6kernel() ? "<not supported>" : net_ip6);
 #endif
 done:
-       if (!ask_yesno(deconst(MSG_netok_ok)))
+       if (!ask_yesno(MSG_netok_ok))
                goto again;
 
        run_program(0, "/sbin/ifconfig lo0 127.0.0.1");
@@ -1064,7 +1064,7 @@
 
        if (!network_up)
                return;
-       if (!ask_yesno(deconst(MSG_mntnetconfig)))
+       if (!ask_yesno(MSG_mntnetconfig))
                return;
 
        /* Write hostname to /etc/rc.conf */
@@ -1153,7 +1153,7 @@
 
        if (!file_mode_match(DHCPCD, S_IFREG))
                return 0;
-       if (ask_yesno(deconst(MSG_Perform_autoconfiguration))) {
+       if (ask_yesno(MSG_Perform_autoconfiguration)) {
                /* spawn off dhcpcd and wait for parent to exit */
                dhcpautoconf = run_program(RUN_DISPLAY | RUN_PROGRESS,
                    "%s -d -n %s", DHCPCD, inter);
diff -r eb77a4203dd2 -r 7282c3b48a83 usr.sbin/sysinst/util.c
--- a/usr.sbin/sysinst/util.c   Mon May 11 13:01:08 2015 +0000
+++ b/usr.sbin/sysinst/util.c   Mon May 11 13:07:57 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: util.c,v 1.6 2015/05/10 10:14:02 martin Exp $  */
+/*     $NetBSD: util.c,v 1.7 2015/05/11 13:07:57 martin Exp $  */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -1720,11 +1720,11 @@
 }
 
 int
-ask_yesno(void* arg)
+ask_yesno(const char* msgtxt)
 {
        arg_rv p;
 
-       p.arg = arg;
+       p.arg = deconst(msgtxt);
        p.rv = -1;
 
        process_menu(MENU_yesno, &p);
@@ -1732,11 +1732,11 @@
 }
 
 int
-ask_noyes(void* arg)
+ask_noyes(const char *msgtxt)
 {
        arg_rv p;
 
-       p.arg = arg;
+       p.arg = deconst(msgtxt);
        p.rv = -1;
 
        process_menu(MENU_noyes, &p);



Home | Main Index | Thread Index | Old Index