#include <ustar.h>
#include <limits.h>
#include <packed.h>
#include <stdio.h>
#include <string.h>
Go to the source code of this file.
Data Structures | |
struct | ustar_header |
Functions | |
static unsigned int | calculate_chksum (const struct ustar_header *h) |
static const char * | strip_antisocial_prefixes (const char *file_name) |
bool | ustar_make_header (const char *file_name, enum ustar_type type, int size, char header[USTAR_HEADER_SIZE]) |
static bool | parse_octal_field (const char *s, size_t size, unsigned long int *value) |
static bool | is_all_zeros (const char *block, size_t cnt) |
const char * | ustar_parse_header (const char header[USTAR_HEADER_SIZE], const char **file_name, enum ustar_type *type, int *size) |
Variables | |
struct ustar_header | PACKED |
static unsigned int calculate_chksum | ( | const struct ustar_header * | h | ) | [static] |
Definition at line 38 of file ustar.c.
References ustar_header::chksum, offsetof, and USTAR_HEADER_SIZE.
Referenced by ustar_make_header(), and ustar_parse_header().
static bool is_all_zeros | ( | const char * | block, | |
size_t | cnt | |||
) | [static] |
static bool parse_octal_field | ( | const char * | s, | |
size_t | size, | |||
unsigned long int * | value | |||
) | [static] |
static const char* strip_antisocial_prefixes | ( | const char * | file_name | ) | [static] |
Definition at line 67 of file ustar.c.
References memcmp(), strchr(), and strcmp().
Referenced by ustar_make_header(), and ustar_parse_header().
bool ustar_make_header | ( | const char * | file_name, | |
enum ustar_type | type, | |||
int | size, | |||
char | header[USTAR_HEADER_SIZE] | |||
) |
Definition at line 84 of file ustar.c.
References ASSERT, calculate_chksum(), ustar_header::chksum, ustar_header::gid, ustar_header::gname, ustar_header::magic, memset(), ustar_header::mode, ustar_header::mtime, ustar_header::name, printf(), ustar_header::size, snprintf(), strip_antisocial_prefixes(), strlcpy(), strlen(), ustar_header::typeflag, ustar_header::uid, ustar_header::uname, USTAR_DIRECTORY, USTAR_REGULAR, and ustar_header::version.
Referenced by fsutil_append(), and write_header().
const char* ustar_parse_header | ( | const char | header[USTAR_HEADER_SIZE], | |
const char ** | file_name, | |||
enum ustar_type * | type, | |||
int * | size | |||
) |
Definition at line 183 of file ustar.c.
References ASSERT, calculate_chksum(), ustar_header::chksum, INT_MAX, is_all_zeros(), ustar_header::magic, memcmp(), ustar_header::name, NULL, parse_octal_field(), ustar_header::prefix, ustar_header::size, strip_antisocial_prefixes(), ustar_header::typeflag, USTAR_DIRECTORY, USTAR_EOF, USTAR_REGULAR, and ustar_header::version.
Referenced by fsutil_extract().
struct ustar_header PACKED |