aboutsummaryrefslogtreecommitdiffstats
path: root/sisinstall
diff options
context:
space:
mode:
authorFritz Elfert <felfert@to.com>2002-07-10 23:15:43 +0000
committerFritz Elfert <felfert@to.com>2002-07-10 23:15:43 +0000
commitbb20db8e8760000402af72583770a4683ef79693 (patch)
treed01aa7fbdb573b4157ef98e9d61ec662c6d6e4dc /sisinstall
parent55769bf5193338be8850198659ff066b09c7c695 (diff)
downloadplptools-bb20db8e8760000402af72583770a4683ef79693.tar.gz
plptools-bb20db8e8760000402af72583770a4683ef79693.tar.bz2
plptools-bb20db8e8760000402af72583770a4683ef79693.zip
- SuSE 8 - related changes
- RPM - related changes - sisinstall: Correct shutdown of newt if an error occurs.
Diffstat (limited to 'sisinstall')
-rw-r--r--sisinstall/sismain.cpp28
1 files changed, 24 insertions, 4 deletions
diff --git a/sisinstall/sismain.cpp b/sisinstall/sismain.cpp
index 404cb20..b673c13 100644
--- a/sisinstall/sismain.cpp
+++ b/sisinstall/sismain.cpp
@@ -20,9 +20,21 @@
#define _GNU_SOURCE
#include <getopt.h>
+bool usenewt = false;
+
static void error(int line)
{
- fprintf(stderr, "Got errno = %d on line %d\n", errno, line);
+#if HAVE_LIBNEWT
+ if (usenewt)
+ {
+ newtPopHelpLine();
+ newtPushHelpLine(_("Got an error, Press any key to exit."));
+ newtWaitForKey();
+ newtFinished();
+ }
+#endif
+ fprintf(stderr, _("Error %d on line %d: %s\n"), errno, line,
+ strerror(errno));
exit(1);
}
@@ -59,7 +71,6 @@ void main(int argc, char* argv[])
char* filename = 0;
char option;
bool dryrun = false;
- bool usenewt = false;
#ifdef LC_ALL
setlocale(LC_ALL, "");
@@ -107,7 +118,7 @@ void main(int argc, char* argv[])
}
#endif
if (optind < argc)
- {
+ {
filename = argv[optind];
#if HAVE_LIBNEWT
if (usenewt)
@@ -124,7 +135,16 @@ void main(int argc, char* argv[])
#endif
printf(_("Installing sis file %s%s.\n"), filename,
dryrun ? _(", not really") : "");
- }
+ }
+ else
+ {
+#if HAVE_LIBNEWT
+ if (usenewt)
+ newtFinished();
+#endif
+ fprintf(stderr, _("Missing SIS filename\n"));
+ exit(1);
+ }
struct stat st;
if (-1 == stat(filename, &st))
error(__LINE__);