45 fprintf(stderr,
_(
"Error %d on line %d: %s\n"), errno, line, strerror(errno));
49static struct option
opts[] = {
50 {
"help", no_argument,
nullptr,
'h' },
51 {
"version", no_argument,
nullptr,
'V' },
52 {
"verbose", required_argument,
nullptr,
'v' },
53 {
"dry-run", no_argument,
nullptr,
'n' },
54 { NULL, 0,
nullptr, 0 },
59 _(
"Usage: sisinstall [OPTIONS]... SISFILE\n"
61 "Supported options:\n"
63 " -h, --help Display this text.\n"
64 " -V, --version Print version and exit.\n"
65 " -v, --verbose=LEVEL Set the verbosity level, by default 0.\n"
66 " -n, --dry-run Just parse the file.\n"));
69int main(
int argc,
char* argv[]) {
70 char* filename =
nullptr;
75 setlocale(LC_ALL,
"");
80 option = getopt_long(argc, argv,
"hnv:V",
opts, NULL);
96 printf(
"%s %s\n",
_(
"sisinstall Version"), VERSION);
101 filename = argv[optind];
102 printf(
_(
"Installing sis file %s%s.\n"), filename, dryrun ?
_(
", not really") :
"");
104 fprintf(stderr,
"%s",
_(
"Missing SIS filename\n"));
108 if (-1 == stat(filename, &st)) {
111 off_t len = st.st_size;
113 printf(
_(
"File is %jd bytes long\n"),
static_cast<intmax_t
>(len));
115 uint8_t* buf =
new uint8_t[len];
116 int fd = open(filename, O_RDONLY);
120 if (-1 == read(fd, buf, len)) {
131 printf(
"%s",
_(
"Couldn't connect with the Psion\n"));
139 installer.
run(&sisFile, buf, len);
141 printf(
"%s",
_(
"Could not parse the sis file.\n"));
A dummy version of the Psion proxy, mainly for testing the installer.
Semi smart proxy for communicating with a Psion.
virtual void disconnect()
The top level container of a SIS file.
SisRC fillFrom(uint8_t *buf, off_t len)
Populate the fields.
void setPsion(Psion *psion)
Set the Psion manager.
SisRC run(SISFile *file, uint8_t *buf, off_t len)
#define textdomain(Domain)
int main(int argc, char *argv[])
static void error(int line)
static struct option opts[]