From 0fa3308034c7776b6c078e493f3b758f0a0bf7e6 Mon Sep 17 00:00:00 2001 From: Charles Date: Sat, 20 Jun 2020 17:17:36 +0200 Subject: Added recursion for directory, not complete ustar format --- inc/tar.h | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) (limited to 'inc') diff --git a/inc/tar.h b/inc/tar.h index 8663926..1dc382f 100644 --- a/inc/tar.h +++ b/inc/tar.h @@ -4,22 +4,36 @@ # include # include +# 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 # include +# include # include # include +# include # include # include # include # include +# include +# include + +# include +# ifdef __linux__ +# include +# 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 -- cgit