commit 9fef9d0082f1cfb9dc1883482f45ba3f84bc5e9c
parent 5bebcbec44537372fcd4e178fdc4057d6d04f783
Author: sin <sin@2f30.org>
Date: Tue, 20 Mar 2018 18:39:12 +0000
Implement list command
Diffstat:
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/dedup.c b/dedup.c
@@ -301,6 +301,20 @@ dump_index(void)
}
void
+list(void)
+{
+ uint64_t i;
+
+ lseek(ifd, sizeof(enthdr), SEEK_SET);
+ for (i = 0; i < enthdr.nents; i++) {
+ struct ent ent;
+ read(ifd, &ent, sizeof(ent));
+ dump_md(ent.md, sizeof(ent.md));
+ putchar('\n');
+ }
+}
+
+void
usage(void)
{
fprintf(stderr, "usage: %s [-lv] [-e id]\n", argv0);
@@ -330,7 +344,7 @@ main(int argc, char *argv[])
init();
if (lflag) {
- dump_index();
+ list();
return 0;
}