diff options
-rw-r--r-- | design.txt | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/design.txt b/design.txt new file mode 100644 index 0000000..844e9cb --- /dev/null +++ b/design.txt @@ -0,0 +1,31 @@ +file_read(buffer, size, user_data) + file = user_data + return fread(buffer, 1, size, file) + +extract(file_name, outer_member, inner_action) + file = fopen(file_name, "rb") + outer_gzip = gzip_init(&file_read, file) + outer_ustar = ustar_init(outer_gzip) + ustar_seek(outer_ustar, outer_member) + inner_gzip = gzip_init(ustar_next_data_record, outer_ustar) + inner_ustar = ustar_init(inner_gzip) + inner_action(inner_ustar) + +print_data(data, size) + fwrite(data, 1, size, stdout) + +read_control(inner_ustar) + ustar_seek(inner_ustar, "control") + ustar_read(inner_ustar, &print_data) + +print_member(member) + printf("%s", member->name) + +list_members(inner_ustar) + ustar_list(inner_ustar, &print_member) + +main() + if -I + extract(argv[1], "control.tar.gz", &read_control) + else if -c + extract(argv[1], "data.tar.gz", &list_members) |