mytar.c
unknown
plain_text
7 months ago
800 B
2
Indexable
Never
#include <stdio.h> #include <stdlib.h> #include "create.h" #define BLOCK_SIZE 512 void write_field(int fd, char *field, unsigned field_size); int main(int argc, char *argv[]){ char *tar_file; char *path; int tar_fd; int i; if(argc <= 3){ perror("usage | mytar [ctxvS]f tarfile [ path [] ]: "); exit(EXIT_FAILURE); } else{ if(parse_options(argv[1]) != 0){ perror("usage | mytar [ctxvS]f tarfile [ path []]: "); exit(EXIT_FAILURE); } tar_file = argv[2]; } tar_fd = create_archive(tar_file); for(i = 3; i < argc; i++){ path = argv[i]; archive_file(tar_fd, "", path); } write_field(tar_fd, NULL, BLOCK_SIZE); write_field(tar_fd, NULL, BLOCK_SIZE); return 0; }
Leave a Comment