Untitled

mail@pastecode.io avatar
unknown
plain_text
2 months ago
629 B
3
Indexable
Never
#include <stdio.h>
#include <stdlib.h>
#include "create.h"

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);
    }

    return 0;
}
Leave a Comment