#include "bsdtar_platform.h"
#include <stdio.h>
#define DEFAULT_BYTES_PER_BLOCK (20*512)
struct bsdtar {
const char *filename;
const char *create_format;
char *pending_chdir;
const char *names_from_file;
time_t newer_ctime_sec;
long newer_ctime_nsec;
time_t newer_mtime_sec;
long newer_mtime_nsec;
int bytes_per_block;
int verbose;
int extract_flags;
int strip_components;
char mode;
char symlink_mode;
char create_compression;
const char *compress_program;
char option_absolute_paths;
char option_chroot;
char option_dont_traverse_mounts;
char option_fast_read;
char option_honor_nodump;
char option_interactive;
char option_no_owner;
char option_no_subdirs;
char option_null;
char option_numeric_owner;
char option_stdout;
char option_totals;
char option_unlink_first;
char option_warn_links;
char day_first;
int disable_copyfile;
int fd;
struct archive *archive;
const char *progname;
int argc;
char **argv;
const char *optarg;
size_t gs_width;
size_t u_width;
uid_t user_uid;
int return_value;
char warned_lead_slash;
char next_line_is_dir;
struct archive_entry_linkresolver *resolver;
struct archive_dir *archive_dir;
struct name_cache *gname_cache;
char *buff;
struct matching *matching;
struct security *security;
struct name_cache *uname_cache;
struct siginfo_data *siginfo;
struct substitution *substitution;
};
enum {
OPTION_CHECK_LINKS = 1,
OPTION_CHROOT,
OPTION_DISABLE_COPYFILE,
OPTION_EXCLUDE,
OPTION_FORMAT,
OPTION_HELP,
OPTION_INCLUDE,
OPTION_KEEP_NEWER_FILES,
OPTION_NEWER_CTIME,
OPTION_NEWER_CTIME_THAN,
OPTION_NEWER_MTIME,
OPTION_NEWER_MTIME_THAN,
OPTION_NODUMP,
OPTION_NO_SAME_OWNER,
OPTION_NO_SAME_PERMISSIONS,
OPTION_NULL,
OPTION_NUMERIC_OWNER,
OPTION_ONE_FILE_SYSTEM,
OPTION_POSIX,
OPTION_STRIP_COMPONENTS,
OPTION_TOTALS,
OPTION_USE_COMPRESS_PROGRAM,
OPTION_VERSION
};
void bsdtar_errc(struct bsdtar *, int _eval, int _code,
const char *fmt, ...) __LA_DEAD;
int bsdtar_getopt(struct bsdtar *);
void bsdtar_warnc(struct bsdtar *, int _code, const char *fmt, ...);
void cleanup_exclusions(struct bsdtar *);
void do_chdir(struct bsdtar *);
int edit_pathname(struct bsdtar *, struct archive_entry *);
int exclude(struct bsdtar *, const char *pattern);
int exclude_from_file(struct bsdtar *, const char *pathname);
int excluded(struct bsdtar *, const char *pathname);
int include(struct bsdtar *, const char *pattern);
int include_from_file(struct bsdtar *, const char *pathname);
int pathcmp(const char *a, const char *b);
int process_lines(struct bsdtar *bsdtar, const char *pathname,
int (*process)(struct bsdtar *, const char *));
void safe_fprintf(FILE *, const char *fmt, ...);
void set_chdir(struct bsdtar *, const char *newdir);
void siginfo_init(struct bsdtar *);
void siginfo_setinfo(struct bsdtar *, const char * oper,
const char * path, int64_t size);
void siginfo_printinfo(struct bsdtar *, off_t progress);
void siginfo_done(struct bsdtar *);
void tar_mode_c(struct bsdtar *bsdtar);
void tar_mode_r(struct bsdtar *bsdtar);
void tar_mode_t(struct bsdtar *bsdtar);
void tar_mode_u(struct bsdtar *bsdtar);
void tar_mode_x(struct bsdtar *bsdtar);
int unmatched_inclusions(struct bsdtar *bsdtar);
int unmatched_inclusions_warn(struct bsdtar *bsdtar, const char *msg);
void usage(struct bsdtar *);
int yes(const char *fmt, ...);
#if HAVE_REGEX_H
void add_substitution(struct bsdtar *, const char *);
int apply_substitution(struct bsdtar *, const char *, char **, int);
void cleanup_substitution(struct bsdtar *);
#endif