diff options
author | Fritz Elfert <felfert@to.com> | 2002-02-28 20:56:59 +0000 |
---|---|---|
committer | Fritz Elfert <felfert@to.com> | 2002-02-28 20:56:59 +0000 |
commit | eecba3b5fcb47a01e6e13ee1940def989f6dd22d (patch) | |
tree | 970f3113de0d2b9b0544c1420117e0cf9633abcd /sisinstall/sismain.cpp | |
parent | 12241e0ff5ea242891fc3a8c177e8f55e897f2a3 (diff) | |
download | plptools-eecba3b5fcb47a01e6e13ee1940def989f6dd22d.tar.gz plptools-eecba3b5fcb47a01e6e13ee1940def989f6dd22d.tar.bz2 plptools-eecba3b5fcb47a01e6e13ee1940def989f6dd22d.zip |
- Added SIS stuff by Daniel Brahneborg
Diffstat (limited to 'sisinstall/sismain.cpp')
-rw-r--r-- | sisinstall/sismain.cpp | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/sisinstall/sismain.cpp b/sisinstall/sismain.cpp new file mode 100644 index 0000000..1b9f714 --- /dev/null +++ b/sisinstall/sismain.cpp @@ -0,0 +1,62 @@ + +#include "sisfile.h" +#include "sisinstaller.h" +#include "psion.h" + +#include <errno.h> +#include <fcntl.h> +#include <unistd.h> +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <sys/types.h> +#include <sys/stat.h> + +static void error(int line) +{ + fprintf(stderr, "Got errno = %d (%s) on line %d\n", + errno, strerror(errno), line); + exit(1); +} + +void main(int argc, char* argv[]) +{ + char* filename = 0; + if (argc > 1) + filename = argv[1]; + else + return 0; + struct stat st; + if (-1 == stat(filename, &st)) + error(__LINE__); + off_t len = st.st_size; + if (logLevel >= 2) + printf("File is %d bytes long\n", len); + uchar* buf = new uchar[len]; + int fd = open(filename, O_RDONLY); + if (-1 == fd) + error(__LINE__); + if (-1 == read(fd, buf, len)) + error(__LINE__); + close(fd); + Psion psion; +#if 0 + if (!psion.connect()) + { + printf("Couldn't connect with the Psion\n"); + exit(1); + } +#endif + createCRCTable(); + SISFile sisFile; + sisFile.fillFrom(buf); + SISInstaller installer; + installer.setPsion(&psion); + installer.run(&sisFile, buf); +#if 0 + psion.disconnect(); +#endif + + exit(0); +} + |