#include <ustar.h>
#include <syscall.h>
#include <stdio.h>
#include <string.h>
Go to the source code of this file.
Functions | |
static void | usage (void) |
static bool | make_tar_archive (const char *archive_name, char *files[], size_t file_cnt) |
int | main (int argc, char *argv[]) |
static bool | archive_file (char file_name[], size_t file_name_size, int archive_fd, bool *write_error) |
static bool | archive_ordinary_file (const char *file_name, int file_fd, int archive_fd, bool *write_error) |
static bool | archive_directory (char file_name[], size_t file_name_size, int file_fd, int archive_fd, bool *write_error) |
static bool | write_header (const char *file_name, enum ustar_type, int size, int archive_fd, bool *write_error) |
static bool | do_write (int fd, const char *buffer, int size, bool *write_error) |
static bool archive_directory | ( | char | file_name[], | |
size_t | file_name_size, | |||
int | file_fd, | |||
int | archive_fd, | |||
bool * | write_error | |||
) | [static] |
Definition at line 160 of file tar.c.
References archive_file(), printf(), readdir(), READDIR_MAX_LEN, strlen(), USTAR_DIRECTORY, and write_header().
Referenced by archive_file().
static bool archive_file | ( | char | file_name[], | |
size_t | file_name_size, | |||
int | archive_fd, | |||
bool * | write_error | |||
) | [static] |
Definition at line 89 of file tar.c.
References archive_directory(), archive_ordinary_file(), close(), inumber(), isdir(), open(), and printf().
Referenced by archive_directory(), and make_tar_archive().
static bool archive_ordinary_file | ( | const char * | file_name, | |
int | file_fd, | |||
int | archive_fd, | |||
bool * | write_error | |||
) | [static] |
Definition at line 124 of file tar.c.
References buf, do_write(), filesize(), memset(), printf(), read(), USTAR_REGULAR, and write_header().
Referenced by archive_file().
static bool do_write | ( | int | fd, | |
const char * | buffer, | |||
int | size, | |||
bool * | write_error | |||
) | [static] |
Definition at line 195 of file tar.c.
References printf(), and write().
Referenced by archive_ordinary_file(), make_tar_archive(), and write_header().
int main | ( | int argc | , | |
char * | argv[] | |||
) |
Definition at line 15 of file tar.c.
References EXIT_FAILURE, EXIT_SUCCESS, make_tar_archive(), and usage().
static bool make_tar_archive | ( | const char * | archive_name, | |
char * | files[], | |||
size_t | file_cnt | |||
) | [static] |
static void usage | ( | void | ) | [static] |
static bool write_header | ( | const char * | file_name, | |
enum ustar_type | type, | |||
int | size, | |||
int | archive_fd, | |||
bool * | write_error | |||
) | [static] |
Definition at line 186 of file tar.c.
References do_write(), and ustar_make_header().
Referenced by archive_directory(), and archive_ordinary_file().