From 9a204ed536286636ad0b0c13e4c062271560bc35 Mon Sep 17 00:00:00 2001 From: James Bursa Date: Sat, 27 Mar 2004 00:49:29 +0000 Subject: [project @ 2004-03-27 00:49:29 by bursa] Update die() to use an error box. svn path=/import/netsurf/; revision=673 --- riscos/gui.c | 20 ++++++++++++++++---- utils/utils.c | 5 ----- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/riscos/gui.c b/riscos/gui.c index b95ec47a8..89866c531 100644 --- a/riscos/gui.c +++ b/riscos/gui.c @@ -182,8 +182,7 @@ void gui_init(int argc, char** argv) if (error) { LOG(("xwimp_open_template failed: 0x%x: %s", error->errnum, error->errmess)); - warn_user(error->errmess); - exit(EXIT_FAILURE); + die(error->errmess); } ro_gui_dialog_init(); ro_gui_download_init(); @@ -1138,11 +1137,24 @@ static os_error warn_error = { 1, "" }; void warn_user(const char *warning) { strncpy(warn_error.errmess, messages_get(warning), 252); - /** \todo get rid of cancel button, appears for unknown reason */ xwimp_report_error_by_category(&warn_error, wimp_ERROR_BOX_OK_ICON | wimp_ERROR_BOX_GIVEN_CATEGORY | - wimp_ERROR_BOX_CATEGORY_PROGRAM, + wimp_ERROR_BOX_CATEGORY_ERROR << + wimp_ERROR_BOX_CATEGORY_SHIFT, "NetSurf", "!netsurf", (osspriteop_area *) 1, 0, 0); } + + +/** + * Display an error and exit. + * + * Should only be used during initialisation. + */ + +void die(const char *error) +{ + warn_user(error); + exit(EXIT_FAILURE); +} diff --git a/utils/utils.c b/utils/utils.c index 3f96125ee..ed6871c18 100644 --- a/utils/utils.c +++ b/utils/utils.c @@ -22,11 +22,6 @@ #include "netsurf/utils/messages.h" #include "netsurf/utils/utils.h" -void die(const char * const error) -{ - fprintf(stderr, "Fatal: %s\n", error); - exit(EXIT_FAILURE); -} char * strip(char * const s) { -- cgit v1.2.3