summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Bolte <sbolte@lavabit.com>2013-05-15 14:52:29 +0200
committerStefan Bolte <sbolte@lavabit.com>2013-05-15 14:52:29 +0200
commit06236a6e4a2b959334db1c0b1b6e8a18edad092c (patch)
tree6fa20f63915eb8b6fba3ca822a15c464f6b21347
parent7c6a339746a6dfaddf88c3fb7d29fbf14eb114a6 (diff)
downloaddwb-06236a6e4a2b959334db1c0b1b6e8a18edad092c.zip
Updating help message of exar
-rw-r--r--tools/exar/exar.c19
-rw-r--r--tools/exar/lexar.c5
2 files changed, 17 insertions, 7 deletions
diff --git a/tools/exar/exar.c b/tools/exar/exar.c
index 3a2dabef..b1ae4fd5 100644
--- a/tools/exar/exar.c
+++ b/tools/exar/exar.c
@@ -35,10 +35,20 @@ void
help(int ret)
{
printf("USAGE: \n"
- " exar option [argument]\n\n"
+ " exar option [arguments]\n\n"
"OPTIONS:\n"
- " p path : pack file or directory 'path'\n"
- " u file [dir] : unpack 'file' to directory 'dir' or to current directory\n");
+ " h : Print this help and exit.\n"
+ " p[v] path : Pack file or directory 'path'.\n"
+ " u[v] file [dir] : Pack 'file' to directory 'dir' or to \n"
+ " current directory.\n"
+ " v : Verbose, pass multiple times (up to 3) to \n"
+ " get more verbose messages.\n\n"
+ "EXAMPLES:\n"
+ " exar p /tmp/foo -- pack /tmp/foo to foo.exar\n"
+ " exar uvvv foo.exar -- unpack foo.exar to current directory, \n"
+ " verbosity level 3\n"
+ " exar vu foo.exar /tmp -- unpack foo.exar to current directory, \n"
+ " verbosity level 1\n");
exit(ret);
}
int
@@ -49,7 +59,7 @@ main (int argc, char **argv)
{
help(EXIT_FAILURE);
}
- char *options = argv[1];
+ const char *options = argv[1];
while (*options)
{
switch (*options)
@@ -74,6 +84,7 @@ main (int argc, char **argv)
help(EXIT_FAILURE);
if (flag & EXAR_VERBOSE_MASK)
exar_verbose(flag);
+
if (flag & FLAG_U)
exar_unpack(argv[2], argv[3]);
else if (flag & FLAG_P)
diff --git a/tools/exar/lexar.c b/tools/exar/lexar.c
index c2563de8..9ef6b060 100644
--- a/tools/exar/lexar.c
+++ b/tools/exar/lexar.c
@@ -56,7 +56,6 @@ pack(const char *fpath, const struct stat *st, int tf)
FILE *f = NULL;
const char *stripped = &fpath[s_offset];
-
memset(buffer, 0, sizeof(buffer));
strncpy(buffer + HDR_NAME, stripped, SZ_NAME);
@@ -106,7 +105,6 @@ exar_pack(const char *path)
const char *tmp = path, *slash;
size_t len = strlen(path);
-
// strip trailing '/'
while (tmp[len-1] == '/')
len--;
@@ -125,7 +123,7 @@ exar_pack(const char *path)
LOG(3, "Opening %s for writing\n", buffer);
if ((s_out = fopen(buffer, "w")) == NULL)
{
- fprintf(stderr, "Cannot open %s\n", buffer);
+ perror("fopen");
return -1;
}
@@ -162,6 +160,7 @@ exar_unpack(const char *path, const char *dest)
return -1;
}
LOG(1, "Found version %s\n", version);
+
memcpy(orig_version, VERSION, sizeof(orig_version));
if (memcmp(version, orig_version, SZ_VERSION))
{