diff options
| author | Charles <sircharlesaze@gmail.com> | 2020-06-20 17:17:36 +0200 |
|---|---|---|
| committer | Charles <sircharlesaze@gmail.com> | 2020-06-20 17:17:36 +0200 |
| commit | 0fa3308034c7776b6c078e493f3b758f0a0bf7e6 (patch) | |
| tree | e4f2ea5954009bfa3fcd3caf6196a4b4a9f4dc87 /inc | |
| parent | 95e1552a898078b4dec1eae3fcf975b392cfad6d (diff) | |
| download | tar-0fa3308034c7776b6c078e493f3b758f0a0bf7e6.tar.gz tar-0fa3308034c7776b6c078e493f3b758f0a0bf7e6.tar.bz2 tar-0fa3308034c7776b6c078e493f3b758f0a0bf7e6.zip | |
Added recursion for directory, not complete ustar format
Diffstat (limited to 'inc')
| -rw-r--r-- | inc/tar.h | 26 |
1 files changed, 24 insertions, 2 deletions
@@ -4,22 +4,36 @@ # include <sys/types.h> # include <sys/stat.h> +# ifndef S_IFMT +# define S_IFMT __S_IFMT +# endif # ifndef S_IFDIR # define S_IFDIR __S_IFDIR # endif -# ifndef S_IFMT -# define S_IFMT __S_IFMT +# ifndef S_IFREG +# define S_IFREG __S_IFREG # endif # include <unistd.h> # include <stdbool.h> +# include <stdint.h> # include <getopt.h> # include <fcntl.h> +# include <dirent.h> # include <stdio.h> # include <stdlib.h> # include <strings.h> # include <string.h> +# include <grp.h> +# include <pwd.h> + +# include <limits.h> +# ifdef __linux__ +# include <linux/limits.h> +# endif + +# define RECORD_SIZE 512 // # define FILE_NAME_MAX 100 @@ -44,5 +58,13 @@ typedef struct char file_name_prefix[155]; } t_header; +// header.c +int record_write(int fd, char *s, size_t size); +int header_write(int fd, char *file_name, struct stat *statbuf); + +// fs.c +int file_content_write(int fd, int file_fd, struct stat *statbuf); +int file_write(int fd, char file_name[PATH_MAX]); +int directory_write(int fd, char dir_name[PATH_MAX]); #endif // TAR_H |
