Module Name:    src
Committed By:   martin
Date:           Mon May 11 13:07:57 UTC 2015

Modified Files:
        src/usr.sbin/sysinst: configmenu.c defs.h menus.mi net.c util.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/sysinst/configmenu.c
cvs rdiff -u -r1.8 -r1.9 src/usr.sbin/sysinst/defs.h
cvs rdiff -u -r1.9 -r1.10 src/usr.sbin/sysinst/menus.mi
cvs rdiff -u -r1.19 -r1.20 src/usr.sbin/sysinst/net.c
cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/sysinst/util.c

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

Modified files:

Index: src/usr.sbin/sysinst/configmenu.c
diff -u src/usr.sbin/sysinst/configmenu.c:1.4 src/usr.sbin/sysinst/configmenu.c:1.5
--- src/usr.sbin/sysinst/configmenu.c:1.4	Sun May 10 10:14:02 2015
+++ src/usr.sbin/sysinst/configmenu.c	Mon May 11 13:07:57 2015
@@ -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 @@ add_new_user(struct menudesc *menu, void
 	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 @@ set_pkgsrc(struct menudesc *menu, void *
 			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;
 		}

Index: src/usr.sbin/sysinst/defs.h
diff -u src/usr.sbin/sysinst/defs.h:1.8 src/usr.sbin/sysinst/defs.h:1.9
--- src/usr.sbin/sysinst/defs.h:1.8	Sun May 10 10:14:02 2015
+++ src/usr.sbin/sysinst/defs.h	Mon May 11 13:07:57 2015
@@ -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	do_reinstall_sets(void);
 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);

Index: src/usr.sbin/sysinst/menus.mi
diff -u src/usr.sbin/sysinst/menus.mi:1.9 src/usr.sbin/sysinst/menus.mi:1.10
--- src/usr.sbin/sysinst/menus.mi:1.9	Sun May 10 10:14:02 2015
+++ src/usr.sbin/sysinst/menus.mi	Mon May 11 13:07:57 2015
@@ -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 @@ menu ftpsource, y=-4, x=0, w=70, no box,
 		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 @@ menu floppysource, y=-4, x=0, w=70, no b
 		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 @@ menu pkgsrc, y=-4, x=0, w=70, no box, no
 		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;

Index: src/usr.sbin/sysinst/net.c
diff -u src/usr.sbin/sysinst/net.c:1.19 src/usr.sbin/sysinst/net.c:1.20
--- src/usr.sbin/sysinst/net.c:1.19	Mon May 11 06:58:13 2015
+++ src/usr.sbin/sysinst/net.c	Mon May 11 13:07:57 2015
@@ -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 @@ again:
 		     !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 @@ mnt_net_config(void)
 
 	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 @@ config_dhcp(char *inter)
 
 	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);

Index: src/usr.sbin/sysinst/util.c
diff -u src/usr.sbin/sysinst/util.c:1.6 src/usr.sbin/sysinst/util.c:1.7
--- src/usr.sbin/sysinst/util.c:1.6	Sun May 10 10:14:02 2015
+++ src/usr.sbin/sysinst/util.c	Mon May 11 13:07:57 2015
@@ -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 @@ safectime(time_t *t)
 }
 
 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 @@ ask_yesno(void* arg)
 }
 
 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);

Reply via email to