From 7050843886487f190e228c55af1091e5a0999d25 Mon Sep 17 00:00:00 2001 From: "Jordan K. Hubbard" Date: Fri, 2 Jul 1999 22:36:14 +0000 Subject: [PATCH] Eliminate some varargs abuse. --- release/sysinstall/index.c | 18 +++++++++++++----- release/sysinstall/msg.c | 16 +--------------- release/sysinstall/package.c | 18 +++++++++++++----- release/sysinstall/sysinstall.h | 3 +-- usr.sbin/sade/msg.c | 16 +--------------- usr.sbin/sade/sade.h | 3 +-- usr.sbin/sysinstall/index.c | 18 +++++++++++++----- usr.sbin/sysinstall/msg.c | 16 +--------------- usr.sbin/sysinstall/package.c | 18 +++++++++++++----- usr.sbin/sysinstall/sysinstall.h | 3 +-- 10 files changed, 58 insertions(+), 71 deletions(-) diff --git a/release/sysinstall/index.c b/release/sysinstall/index.c index 6f1fc90fa30b..7a98511eaaa4 100644 --- a/release/sysinstall/index.c +++ b/release/sysinstall/index.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: index.c,v 1.68 1999/05/27 10:32:45 jkh Exp $ + * $Id: index.c,v 1.69 1999/06/28 02:37:34 billf Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -637,11 +637,19 @@ index_extract(Device *dev, PkgNodePtr top, PkgNodePtr who, Boolean depended) *cp2 = '\0'; if ((tmp2 = index_search(top, cp, NULL)) != NULL) { status = index_extract(dev, top, tmp2, TRUE); - if (DITEM_STATUS(status) != DITEM_SUCCESS) - msgCNotify("Loading of dependant package %s failed", cp); + if (DITEM_STATUS(status) != DITEM_SUCCESS) { + if (variable_get(VAR_NO_CONFIRM)) + msgNotify("Loading of dependant package %s failed", cp); + else + msgConfirm("Loading of dependant package %s failed", cp); + } + } + else if (!package_exists(cp)) { + if (variable_get(VAR_NO_CONFIRM)) + msgNotify("Warning: %s is a required package but was not found.", cp); + else + msgConfirm("Warning: %s is a required package but was not found.", cp); } - else if (!package_exists(cp)) - msgCNotify("Warning: %s is a required package but was not found.", cp); if (cp2) cp = cp2 + 1; else diff --git a/release/sysinstall/msg.c b/release/sysinstall/msg.c index a7116e9318a3..7ee6d82cbd56 100644 --- a/release/sysinstall/msg.c +++ b/release/sysinstall/msg.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: msg.c,v 1.47 1997/09/20 02:48:48 jkh Exp $ + * $Id: msg.c,v 1.48 1999/05/27 10:32:48 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -217,20 +217,6 @@ msgNotify(char *fmt, ...) dialog_msgbox(NULL, errstr, -1, -1, 0); } -/* Put up a message in a popup or notifier box, depending on NO_CONFIRM */ -void -msgCNotify(char *fmt, ...) -{ - va_list args; - - va_start(args, fmt); - if (variable_get(VAR_NO_CONFIRM)) - msgNotify(fmt, args); - else - msgConfirm(fmt, args); - va_end(args); -} - /* Put up a message in a popup yes/no box and return 1 for YES, 0 for NO */ int msgYesNo(char *fmt, ...) diff --git a/release/sysinstall/package.c b/release/sysinstall/package.c index 7cc980e5aca3..4c311ae93745 100644 --- a/release/sysinstall/package.c +++ b/release/sysinstall/package.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: package.c,v 1.76 1999/05/18 00:44:28 jkh Exp $ + * $Id: package.c,v 1.77 1999/05/27 10:32:49 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -218,8 +218,12 @@ package_extract(Device *dev, char *name, Boolean depended) i = waitpid(pid, &tot, 0); if (sigpipe_caught || i < 0 || WEXITSTATUS(tot)) { ret = DITEM_FAILURE | DITEM_RESTORE; - msgCNotify("Add of package %s aborted, error code %d -\n" - "Please check the debug screen for more info.", name, WEXITSTATUS(tot)); + if (variable_get(VAR_NO_CONFIRM)) + msgNotify("Add of package %s aborted, error code %d -\n" + "Please check the debug screen for more info.", name, WEXITSTATUS(tot)); + else + msgConfirm("Add of package %s aborted, error code %d -\n" + "Please check the debug screen for more info.", name, WEXITSTATUS(tot)); } else msgNotify("Package %s was added successfully", name); @@ -233,8 +237,12 @@ package_extract(Device *dev, char *name, Boolean depended) } else { dialog_clear_norefresh(); - msgCNotify("Unable to fetch package %s from selected media.\n" - "No package add will be done.", name); + if (variable_get(VAR_NO_CONFIRM)) + msgNotify("Unable to fetch package %s from selected media.\n" + "No package add will be done.", name); + else + msgConfirm("Unable to fetch package %s from selected media.\n" + "No package add will be done.", name); ret = DITEM_FAILURE | DITEM_RESTORE; } signal(SIGPIPE, SIG_IGN); diff --git a/release/sysinstall/sysinstall.h b/release/sysinstall/sysinstall.h index c2ad351811a7..4816712530aa 100644 --- a/release/sysinstall/sysinstall.h +++ b/release/sysinstall/sysinstall.h @@ -4,7 +4,7 @@ * This is probably the last attempt in the `sysinstall' line, the next * generation being slated to essentially a complete rewrite. * - * $Id: sysinstall.h,v 1.165 1999/05/15 14:34:22 jkh Exp $ + * $Id: sysinstall.h,v 1.166 1999/05/27 10:32:50 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -645,7 +645,6 @@ extern void msgError(char *fmt, ...); extern void msgFatal(char *fmt, ...); extern void msgConfirm(char *fmt, ...); extern void msgNotify(char *fmt, ...); -extern void msgCNotify(char *fmt, ...); extern void msgWeHaveOutput(char *fmt, ...); extern int msgYesNo(char *fmt, ...); extern char *msgGetInput(char *buf, char *fmt, ...); diff --git a/usr.sbin/sade/msg.c b/usr.sbin/sade/msg.c index a7116e9318a3..7ee6d82cbd56 100644 --- a/usr.sbin/sade/msg.c +++ b/usr.sbin/sade/msg.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: msg.c,v 1.47 1997/09/20 02:48:48 jkh Exp $ + * $Id: msg.c,v 1.48 1999/05/27 10:32:48 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -217,20 +217,6 @@ msgNotify(char *fmt, ...) dialog_msgbox(NULL, errstr, -1, -1, 0); } -/* Put up a message in a popup or notifier box, depending on NO_CONFIRM */ -void -msgCNotify(char *fmt, ...) -{ - va_list args; - - va_start(args, fmt); - if (variable_get(VAR_NO_CONFIRM)) - msgNotify(fmt, args); - else - msgConfirm(fmt, args); - va_end(args); -} - /* Put up a message in a popup yes/no box and return 1 for YES, 0 for NO */ int msgYesNo(char *fmt, ...) diff --git a/usr.sbin/sade/sade.h b/usr.sbin/sade/sade.h index c2ad351811a7..4816712530aa 100644 --- a/usr.sbin/sade/sade.h +++ b/usr.sbin/sade/sade.h @@ -4,7 +4,7 @@ * This is probably the last attempt in the `sysinstall' line, the next * generation being slated to essentially a complete rewrite. * - * $Id: sysinstall.h,v 1.165 1999/05/15 14:34:22 jkh Exp $ + * $Id: sysinstall.h,v 1.166 1999/05/27 10:32:50 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -645,7 +645,6 @@ extern void msgError(char *fmt, ...); extern void msgFatal(char *fmt, ...); extern void msgConfirm(char *fmt, ...); extern void msgNotify(char *fmt, ...); -extern void msgCNotify(char *fmt, ...); extern void msgWeHaveOutput(char *fmt, ...); extern int msgYesNo(char *fmt, ...); extern char *msgGetInput(char *buf, char *fmt, ...); diff --git a/usr.sbin/sysinstall/index.c b/usr.sbin/sysinstall/index.c index 6f1fc90fa30b..7a98511eaaa4 100644 --- a/usr.sbin/sysinstall/index.c +++ b/usr.sbin/sysinstall/index.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: index.c,v 1.68 1999/05/27 10:32:45 jkh Exp $ + * $Id: index.c,v 1.69 1999/06/28 02:37:34 billf Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -637,11 +637,19 @@ index_extract(Device *dev, PkgNodePtr top, PkgNodePtr who, Boolean depended) *cp2 = '\0'; if ((tmp2 = index_search(top, cp, NULL)) != NULL) { status = index_extract(dev, top, tmp2, TRUE); - if (DITEM_STATUS(status) != DITEM_SUCCESS) - msgCNotify("Loading of dependant package %s failed", cp); + if (DITEM_STATUS(status) != DITEM_SUCCESS) { + if (variable_get(VAR_NO_CONFIRM)) + msgNotify("Loading of dependant package %s failed", cp); + else + msgConfirm("Loading of dependant package %s failed", cp); + } + } + else if (!package_exists(cp)) { + if (variable_get(VAR_NO_CONFIRM)) + msgNotify("Warning: %s is a required package but was not found.", cp); + else + msgConfirm("Warning: %s is a required package but was not found.", cp); } - else if (!package_exists(cp)) - msgCNotify("Warning: %s is a required package but was not found.", cp); if (cp2) cp = cp2 + 1; else diff --git a/usr.sbin/sysinstall/msg.c b/usr.sbin/sysinstall/msg.c index a7116e9318a3..7ee6d82cbd56 100644 --- a/usr.sbin/sysinstall/msg.c +++ b/usr.sbin/sysinstall/msg.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: msg.c,v 1.47 1997/09/20 02:48:48 jkh Exp $ + * $Id: msg.c,v 1.48 1999/05/27 10:32:48 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -217,20 +217,6 @@ msgNotify(char *fmt, ...) dialog_msgbox(NULL, errstr, -1, -1, 0); } -/* Put up a message in a popup or notifier box, depending on NO_CONFIRM */ -void -msgCNotify(char *fmt, ...) -{ - va_list args; - - va_start(args, fmt); - if (variable_get(VAR_NO_CONFIRM)) - msgNotify(fmt, args); - else - msgConfirm(fmt, args); - va_end(args); -} - /* Put up a message in a popup yes/no box and return 1 for YES, 0 for NO */ int msgYesNo(char *fmt, ...) diff --git a/usr.sbin/sysinstall/package.c b/usr.sbin/sysinstall/package.c index 7cc980e5aca3..4c311ae93745 100644 --- a/usr.sbin/sysinstall/package.c +++ b/usr.sbin/sysinstall/package.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: package.c,v 1.76 1999/05/18 00:44:28 jkh Exp $ + * $Id: package.c,v 1.77 1999/05/27 10:32:49 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -218,8 +218,12 @@ package_extract(Device *dev, char *name, Boolean depended) i = waitpid(pid, &tot, 0); if (sigpipe_caught || i < 0 || WEXITSTATUS(tot)) { ret = DITEM_FAILURE | DITEM_RESTORE; - msgCNotify("Add of package %s aborted, error code %d -\n" - "Please check the debug screen for more info.", name, WEXITSTATUS(tot)); + if (variable_get(VAR_NO_CONFIRM)) + msgNotify("Add of package %s aborted, error code %d -\n" + "Please check the debug screen for more info.", name, WEXITSTATUS(tot)); + else + msgConfirm("Add of package %s aborted, error code %d -\n" + "Please check the debug screen for more info.", name, WEXITSTATUS(tot)); } else msgNotify("Package %s was added successfully", name); @@ -233,8 +237,12 @@ package_extract(Device *dev, char *name, Boolean depended) } else { dialog_clear_norefresh(); - msgCNotify("Unable to fetch package %s from selected media.\n" - "No package add will be done.", name); + if (variable_get(VAR_NO_CONFIRM)) + msgNotify("Unable to fetch package %s from selected media.\n" + "No package add will be done.", name); + else + msgConfirm("Unable to fetch package %s from selected media.\n" + "No package add will be done.", name); ret = DITEM_FAILURE | DITEM_RESTORE; } signal(SIGPIPE, SIG_IGN); diff --git a/usr.sbin/sysinstall/sysinstall.h b/usr.sbin/sysinstall/sysinstall.h index c2ad351811a7..4816712530aa 100644 --- a/usr.sbin/sysinstall/sysinstall.h +++ b/usr.sbin/sysinstall/sysinstall.h @@ -4,7 +4,7 @@ * This is probably the last attempt in the `sysinstall' line, the next * generation being slated to essentially a complete rewrite. * - * $Id: sysinstall.h,v 1.165 1999/05/15 14:34:22 jkh Exp $ + * $Id: sysinstall.h,v 1.166 1999/05/27 10:32:50 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -645,7 +645,6 @@ extern void msgError(char *fmt, ...); extern void msgFatal(char *fmt, ...); extern void msgConfirm(char *fmt, ...); extern void msgNotify(char *fmt, ...); -extern void msgCNotify(char *fmt, ...); extern void msgWeHaveOutput(char *fmt, ...); extern int msgYesNo(char *fmt, ...); extern char *msgGetInput(char *buf, char *fmt, ...);