summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick McDermott <patrick.mcdermott@libiquity.com>2023-04-13 09:14:46 (EDT)
committer Patrick McDermott <patrick.mcdermott@libiquity.com>2023-04-13 09:23:53 (EDT)
commit305667ec3b4816c44286de2a3177e0862596b655 (patch)
tree08bf1662e75d186e8335dd09632593d4f4908a46
parentfd9c8d89e43b57149471d7af4378c3424242fe18 (diff)
design.txt: New file
-rw-r--r--design.txt31
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)