diff options
author | Miles Bader <miles@gnu.org> | 1997-06-20 05:01:35 +0000 |
---|---|---|
committer | Miles Bader <miles@gnu.org> | 1997-06-20 05:01:35 +0000 |
commit | 495ea95be97f58d99797c370d6b1f4593ecf863e (patch) | |
tree | e3c097c8f1082a6bd92993786af94c348fdacab3 /libstore/storecat.c | |
parent | 038414a4ea8adbfb9c88190da9ea05a9f6570219 (diff) |
Moved to ../utils.
Diffstat (limited to 'libstore/storecat.c')
-rw-r--r-- | libstore/storecat.c | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/libstore/storecat.c b/libstore/storecat.c deleted file mode 100644 index bff42c86..00000000 --- a/libstore/storecat.c +++ /dev/null @@ -1,51 +0,0 @@ -/* Test program for libstore -- outputs the concatenation of stores */ - -#include <argp.h> -#include <error.h> -#include <unistd.h> - -#include "store.h" - -int -main (int argc, char **argv) -{ - error_t err; - struct store *s; - char *name; - off_t addr; - size_t left; - const struct argp *parents[] = { &store_argp, 0 }; - struct argp argp = - { 0, 0, 0, "Write the contents of a store to stdout", parents }; - store_argp_params p = { 0 }; - - argp_parse (&argp, argc, argv, 0, 0, &p); - err = store_parsed_name (p.result, &name); - if (err) - error (2, err, "store_parsed_name"); - - err = store_parsed_open (p.result, STORE_READONLY, 0, &s); - if (err) - error (4, err, "%s", name); - - addr = 0; - left = s->size; - while (left > 0) - { - size_t read = left > 1024*1024 ? 1024*1024 : left; - char buf[4096]; - void *data = buf; - size_t data_len = sizeof (buf); - - err = store_read (s, addr, read, &data, &data_len); - if (err) - error (5, err, "%s", name); - if (write (1, data, data_len) < 0) - error (6, errno, "stdout"); - - addr += data_len >> s->log2_block_size; - left -= data_len; - } - - exit (0); -} |