]> git.draconx.ca Git - liblbx.git/blobdiff - src/lbxtool.c
liblbx: Implement improved error reporting mechanism.
[liblbx.git] / src / lbxtool.c
index 754592ff251c428ae24a57fdde9ea3e52c8644db..9c4b57bbf623d6dafaa45f76084b964db07703d8 100644 (file)
@@ -26,7 +26,7 @@
 
 #include "tools.h"
 #include "lbx.h"
-
+#include "error.h"
 
 static void printusage(void)
 {
@@ -81,7 +81,7 @@ int list(LBX *lbx, int verbose, char **argv) {
        for (i = 0; i < nfiles; i++) {
                struct lbx_statbuf stat;
 
-               lbx_stat(lbx, i, &stat);
+               lbx_file_stat(lbx, i, &stat);
 
                switch (filematch(argv, stat.name)) {
                case -1: continue;
@@ -156,7 +156,7 @@ int extract(LBX *lbx, int verbose, char **argv) {
                struct lbx_statbuf stat;
                LBXfile *file;
 
-               lbx_stat(lbx, i, &stat);
+               lbx_file_stat(lbx, i, &stat);
 
                switch (filematch(argv, stat.name)) {
                case -1: continue;
@@ -166,8 +166,7 @@ int extract(LBX *lbx, int verbose, char **argv) {
 
                file = lbx_file_open(lbx, i);
                if (!file) {
-                       errmsg("failed to open archive member %s: %s.\n",
-                               stat.name, lbx_strerror());
+                       errmsg("%s: %s.\n", stat.name, lbx_errmsg());
                        continue;
                }
 
@@ -241,7 +240,7 @@ int main(int argc, char **argv)
                lbx = lbx_open(&stdin_handle, &lbx_pipe_fops, NULL, "stdin");
 
        if (!lbx) {
-               errmsg("failed to open archive: %s.\n", lbx_strerror());
+               errmsg("%s: %s.\n", file ? file : "stdin", lbx_errmsg());
                return EXIT_FAILURE;
        }