/* Common declarations for the tar program.
- Copyright 1988, 1992-1994, 1996-1997, 1999-2010, 2012-2013 Free
+ Copyright 1988, 1992-1994, 1996-1997, 1999-2010, 2012-2016 Free
Software Foundation, Inc.
This file is part of GNU tar.
do not get archived (also see after_date_option above). */
GLOBAL struct timespec newer_mtime_option;
-/* If true, override actual mtime (see below) */
-GLOBAL bool set_mtime_option;
-/* Value to be put in mtime header field instead of the actual mtime */
+enum set_mtime_option_mode
+{
+ USE_FILE_MTIME,
+ FORCE_MTIME,
+ CLAMP_MTIME,
+};
+
+/* Override actual mtime if set to FORCE_MTIME or CLAMP_MTIME */
+GLOBAL enum set_mtime_option_mode set_mtime_option;
+/* Value to use when forcing or clamping the mtime header field. */
GLOBAL struct timespec mtime_option;
-/* Return true if newer_mtime_option is initialized. */
-#define NEWER_OPTION_INITIALIZED(opt) (0 <= (opt).tv_nsec)
+/* Return true if mtime_option or newer_mtime_option is initialized. */
+#define TIME_OPTION_INITIALIZED(opt) (0 <= (opt).tv_nsec)
/* Return true if the struct stat ST's M time is less than
newer_mtime_option. */
GLOBAL bool one_file_system_option;
+/* Create a top-level directory for extracting based on the archive name. */
+GLOBAL bool one_top_level_option;
+GLOBAL char *one_top_level_dir;
+
/* Specified value to be put into tar file in place of stat () results, or
just null and -1 if such an override should not take place. */
GLOBAL char const *owner_name_option;
GLOBAL unsigned tar_sparse_major;
GLOBAL unsigned tar_sparse_minor;
+enum hole_detection_method
+ {
+ HOLE_DETECTION_DEFAULT,
+ HOLE_DETECTION_RAW,
+ HOLE_DETECTION_SEEK
+ };
+
+GLOBAL enum hole_detection_method hole_detection;
+
GLOBAL bool starting_file_option;
/* Specified maximum byte length of each tape volume (multiple of 1024). */
/* Unquote filenames */
GLOBAL bool unquote_option;
+GLOBAL int savedir_sort_order;
+
/* Show file or archive names after transformation.
In particular, when creating archive in verbose mode, list member names
as stored in the archive */
set for incremental archives. */
GLOBAL bool delay_directory_restore_option;
-/* Warn about implicit use of the wildcards in command line arguments.
- (Default for tar prior to 1.15.91, but changed afterwards */
-GLOBAL bool warn_regex_usage;
+/* When set, tar will not refuse to create empty archives */
+GLOBAL bool files_from_option;
\f
/* Declarations for each module. */
off_t current_block_ordinal (void);
void close_archive (void);
void closeout_volume_number (void);
-void compute_duration (void);
+double compute_duration (void);
union block *find_next_block (void);
void flush_read (void);
void flush_write (void);
off_t seek_archive (off_t size);
void set_start_time (void);
+#define TF_READ 0
+#define TF_WRITE 1
+#define TF_DELETED 2
+int format_total_stats (FILE *fp, char const *const *formats, int eor, int eol);
+void print_total_stats (void);
+
void mv_begin_write (const char *file_name, off_t totsize, off_t sizeleft);
void mv_begin_read (struct tar_stat_info *st);
void extract_finish (void);
bool rename_directory (char *src, char *dst);
+void remove_delayed_set_stat (const char *fname);
+
/* Module delete.c. */
void delete_archive_members (void);
namebuf_t namebuf_create (const char *dir);
void namebuf_free (namebuf_t buf);
char *namebuf_name (namebuf_t buf, const char *name);
-void namebuf_add_dir (namebuf_t buf, const char *name);
-char *namebuf_finish (namebuf_t buf);
const char *tar_dirname (void);
int uname_to_uid (char const *uname, uid_t *puid);
void name_init (void);
-void name_add_name (const char *name, int matching_flags);
-void name_add_dir (const char *name);
-void name_add_file (const char *name, int term);
+void name_add_name (const char *name);
void name_term (void);
const char *name_next (int change_dirs);
void name_gather (void);
struct name *name_scan (const char *name);
struct name const *name_from_list (void);
void blank_name_list (void);
-char *new_name (const char *dir_name, const char *name);
+char *make_file_name (const char *dir_name, const char *name);
size_t stripped_prefix_len (char const *file_name, size_t num);
bool all_names_found (struct tar_stat_info *st);
-bool excluded_name (char const *name);
-
void add_avoided_name (char const *name);
bool is_avoided_name (char const *name);
bool contains_dot_dot (char const *name);
-#define ISFOUND(c) ((occurrence_option == 0) ? (c)->found_count : \
- (c)->found_count == occurrence_option)
-#define WASFOUND(c) ((occurrence_option == 0) ? (c)->found_count : \
- (c)->found_count >= occurrence_option)
+#define ISFOUND(c) (occurrence_option == 0 \
+ ? (c)->found_count != 0 \
+ : (c)->found_count == occurrence_option)
+#define WASFOUND(c) (occurrence_option == 0 \
+ ? (c)->found_count != 0 \
+ : (c)->found_count >= occurrence_option)
/* Module tar.c. */
void set_exit_status (int val);
void request_stdin (const char *option);
-void more_options (int argc, char **argv);
+
+/* Where an option comes from: */
+enum option_source
+ {
+ OPTS_ENVIRON, /* Environment variable TAR_OPTIONS */
+ OPTS_COMMAND_LINE, /* Command line */
+ OPTS_FILE /* File supplied by --files-from */
+ };
+
+/* Option location */
+struct option_locus
+{
+ enum option_source source; /* Option origin */
+ char const *name; /* File or variable name */
+ size_t line; /* Number of input line if source is OPTS_FILE */
+ struct option_locus *prev; /* Previous occurrence of the option of same
+ class */
+};
+
+void more_options (int argc, char **argv, struct option_locus *loc);
/* Module update.c. */
/* Module suffix.c */
void set_compression_program_by_suffix (const char *name, const char *defprog);
+char *strip_compression_suffix (const char *name);
/* Module checkpoint.c */
void checkpoint_compile_action (const char *str);
void checkpoint_finish_compile (void);
void checkpoint_run (bool do_write);
+void checkpoint_finish (void);
+void checkpoint_flush_actions (void);
/* Module warning.c */
#define WARN_ALONE_ZERO_BLOCK 0x00000001
/* Module exit.c */
extern void (*fatal_exit_hook) (void);
+/* Module exclist.c */
+#define EXCL_DEFAULT 0x00
+#define EXCL_RECURSIVE 0x01
+#define EXCL_NON_RECURSIVE 0x02
+
+void excfile_add (const char *name, int flags);
+void info_attach_exclist (struct tar_stat_info *dir);
+void info_free_exclist (struct tar_stat_info *dir);
+bool excluded_name (char const *name, struct tar_stat_info *st);
+void exclude_vcs_ignores (void);
+
+/* Module map.c */
+void owner_map_read (char const *name);
+int owner_map_translate (uid_t uid, uid_t *new_uid, char const **new_name);
+void group_map_read (char const *file);
+int group_map_translate (gid_t gid, gid_t *new_gid, char const **new_name);
+
+
_GL_INLINE_HEADER_END