aboutsummaryrefslogtreecommitdiffstats
path: root/sisinstall
diff options
context:
space:
mode:
authorDaniel Brahneborg <basic@chello.se>2002-04-14 06:57:02 +0000
committerDaniel Brahneborg <basic@chello.se>2002-04-14 06:57:02 +0000
commit77436dedbe1bd5a5320fe9f263adebb3264d3607 (patch)
tree7f609e8438d764e32c533bcd8ad0e42d07244c77 /sisinstall
parente88966158871619335f59e7b382ef4e0df413419 (diff)
downloadplptools-77436dedbe1bd5a5320fe9f263adebb3264d3607.tar.gz
plptools-77436dedbe1bd5a5320fe9f263adebb3264d3607.tar.bz2
plptools-77436dedbe1bd5a5320fe9f263adebb3264d3607.zip
Newt stuff
Diffstat (limited to 'sisinstall')
-rw-r--r--sisinstall/Makefile.am2
-rw-r--r--sisinstall/sismain.cpp94
2 files changed, 76 insertions, 20 deletions
diff --git a/sisinstall/Makefile.am b/sisinstall/Makefile.am
index a02fb20..1d54c6f 100644
--- a/sisinstall/Makefile.am
+++ b/sisinstall/Makefile.am
@@ -3,7 +3,7 @@
INCLUDES=-I$(top_srcdir)/lib
bin_PROGRAMS = sisinstall
-sisinstall_LDADD = $(top_srcdir)/lib/libplp.la
+sisinstall_LDADD = $(top_srcdir)/lib/libplp.la $(LIBNEWT)
sisinstall_SOURCES = psion.cpp sisinstaller.cpp sismain.cpp \
fakepsion.cpp sisfilelink.cpp sisfilelink.h
EXTRA_DIST = psion.h sisinstaller.h fakepsion.h
diff --git a/sisinstall/sismain.cpp b/sisinstall/sismain.cpp
index 0cfb370..404cb20 100644
--- a/sisinstall/sismain.cpp
+++ b/sisinstall/sismain.cpp
@@ -13,6 +13,10 @@
#include <sys/types.h>
#include <sys/stat.h>
+#if HAVE_LIBNEWT
+# include <newt.h>
+#endif
+
#define _GNU_SOURCE
#include <getopt.h>
@@ -25,8 +29,11 @@ static void error(int line)
static struct option opts[] = {
{ "help", no_argument, 0, 'h' },
{ "version", no_argument, 0, 'V' },
- { "loglevel", required_argument, 0, 'l' },
+ { "verbose", required_argument, 0, 'v' },
{ "dry-run", no_argument, 0, 'n' },
+#if HAVE_LIBNEWT
+ { "newt", no_argument, 0, 'w' },
+#endif
{ NULL, 0, 0, 0 },
};
@@ -39,8 +46,11 @@ void printHelp()
"\n"
" -h, --help Display this text.\n"
" -V, --version Print version and exit.\n"
- " -l, --loglevel=LEVEL Set the log level, by default 0.\n"
+ " -v, --verbose=LEVEL Set the verbosity level, by default 0.\n"
" -n, --dry-run Just parse file file.\n"
+#if HAVE_LIBNEWT
+ " -w, --newt Use the Newt interface.\n"
+#endif
));
}
@@ -49,6 +59,7 @@ void main(int argc, char* argv[])
char* filename = 0;
char option;
bool dryrun = false;
+ bool usenewt = false;
#ifdef LC_ALL
setlocale(LC_ALL, "");
@@ -57,7 +68,13 @@ void main(int argc, char* argv[])
while (1)
{
- option = getopt_long(argc, argv, "hnl:V", opts, NULL);
+ option = getopt_long(argc, argv,
+#if HAVE_LIBNEWT
+ "hnv:Vw"
+#else
+ "hnv:V"
+#endif
+ , opts, NULL);
if (option == -1)
break;
switch (option)
@@ -66,22 +83,47 @@ void main(int argc, char* argv[])
case '?':
printHelp();
exit(0);
- case 'l':
+ case 'v':
logLevel = atoi(optarg);
break;
case 'n':
dryrun = true;
break;
+#if HAVE_LIBNEWT
+ case 'w':
+ usenewt = true;
+ break;
+#endif
case 'V':
printf(_("sisinstall version 0.1\n"));
exit(0);
}
}
+#if HAVE_LIBNEWT
+ if (usenewt)
+ {
+ newtInit();
+ newtCls();
+ }
+#endif
if (optind < argc)
{
filename = argv[optind];
- printf(_("Installing sis file %s%s\n"), filename,
- dryrun ? _(", not really") : "");
+#if HAVE_LIBNEWT
+ if (usenewt)
+ {
+ char helpline[256];
+ sprintf(helpline,
+ _("Installing sis file %s%s.\n"),
+ filename,
+ dryrun ? _(", not really") : "");
+ newtPushHelpLine(helpline);
+// newtWaitForKey();
+ }
+ else
+#endif
+ printf(_("Installing sis file %s%s.\n"), filename,
+ dryrun ? _(", not really") : "");
}
struct stat st;
if (-1 == stat(filename, &st))
@@ -104,26 +146,40 @@ void main(int argc, char* argv[])
if (!psion->connect())
{
printf(_("Couldn't connect with the Psion\n"));
- exit(1);
}
- createCRCTable();
- SISFile sisFile;
- SisRC rc = sisFile.fillFrom(buf, len);
- if (rc == SIS_OK)
+ else
{
- if (!dryrun)
+ createCRCTable();
+ SISFile sisFile;
+ SisRC rc = sisFile.fillFrom(buf, len);
+ if (rc == SIS_OK)
+ {
+// if (!dryrun)
+ {
+ SISInstaller installer;
+ installer.setPsion(psion);
+#if HAVE_LIBNEWT
+ installer.useNewt(usenewt);
+#endif
+ installer.run(&sisFile, buf, len);
+ }
+ }
+ else
{
- SISInstaller installer;
- installer.setPsion(psion);
- installer.run(&sisFile, buf, len);
+ printf(_("Could not parse the sis file.\n"));
}
+ psion->disconnect();
}
- else
+
+#if HAVE_LIBNEWT
+ if (usenewt)
{
- printf(_("Could not parse the sis file.\n"));
+ newtPopHelpLine();
+ newtPushHelpLine(_("Installation complete. Press any key to exit."));
+ newtWaitForKey();
+ newtFinished();
}
- psion->disconnect();
-
+#endif
exit(0);
}