This assignment enters with 3% into the total grade!
Assignment 7
Write an archiver program arch322. Your program
should accept
any number of arguments (to be treated as filenames). It should write
(to stdout) an archive, i.e. a file that contains enough
information to recreate the original files with their names. For
simplicity, allow only files in the current directory to be archived
(check, if the arguments contain a / and print an error
message if yes). Also print useful error messages if one of the
named files does not exist, etc.
Write a dearchiver dearch322 that accepts an archive
file (in your format) on stdin and recreates the original
files in the current directory. Print an error message if the file
is not a valid archive.
You are free to design your own archive format, but you may get
some ideas from reading the documentation (man/info) on
tar/gtar. Please document your format in one or two
paragraphs. You may assume UNIX I/O, i.e. no difference between
text and binary I/O.
Example:
$ arch322 Makefile sort_csc322.c utilities.c > myarch.arch
$ mkdir NEW
$ cd NEW
$ dearch322 < ../myarch.arch
Recreating Makefile
Recreating sort_csc322.c
Recreating utilities.c
$ ls
Makefile sort_csc322.c utilities.c