/* Common declarations for the tar program.
Copyright (C) 1988, 1992, 1993, 1994, 1996, 1997, 1999, 2000, 2001,
/* Common declarations for the tar program.
Copyright (C) 1988, 1992, 1993, 1994, 1996, 1997, 1999, 2000, 2001,
- 2003, 2004, 2005 Free Software Foundation, Inc.
+ 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
/* Return true if the struct stat ST's M time is less than
newer_mtime_option. */
#define OLDER_STAT_TIME(st, m) \
/* Return true if the struct stat ST's M time is less than
newer_mtime_option. */
#define OLDER_STAT_TIME(st, m) \
- (timespec_cmp (get_stat_##m##time (&st), newer_mtime_option) < 0)
+ (timespec_cmp (get_stat_##m##time (&(st)), newer_mtime_option) < 0)
+
+/* Likewise, for struct tar_stat_info ST. */
+#define OLDER_TAR_STAT_TIME(st, m) \
+ (timespec_cmp ((st).m##time, newer_mtime_option) < 0)
/* Zero if there is no recursion, otherwise FNM_LEADING_DIR. */
GLOBAL int recursion_option;
/* Zero if there is no recursion, otherwise FNM_LEADING_DIR. */
GLOBAL int recursion_option;
/* Return true if the extracted files are not being written to disk */
#define EXTRACT_OVER_PIPE (to_stdout_option || to_command_option)
/* Return true if the extracted files are not being written to disk */
#define EXTRACT_OVER_PIPE (to_stdout_option || to_command_option)
size_t length; /* cached strlen(name) */
uintmax_t found_count; /* number of times a matching file has
been found */
size_t length; /* cached strlen(name) */
uintmax_t found_count; /* number of times a matching file has
been found */
char firstch; /* first char is literally matched */
char regexp; /* this name is a regexp, not literal */
int change_dir; /* set with the -C option */
char firstch; /* first char is literally matched */
char regexp; /* this name is a regexp, not literal */
int change_dir; /* set with the -C option */
+
+GLOBAL bool test_label_option; /* Test archive volume label and exit */
+
+/* When creating archive in verbose mode, list member names as stored in the
+ archive */
+GLOBAL bool show_stored_names_option;
+
+/* Delay setting modification times and permissions of extracted directories
+ until the end of extraction. This variable helps correctly restore directory
+ timestamps from archives with an unusual member order. It is automatically
+ set for incremental archives. */
+GLOBAL bool delay_directory_restore_option;
+
union block *start_header (struct tar_stat_info *st);
void finish_header (struct tar_stat_info *, union block *, off_t);
void simple_finish_header (union block *header);
union block *start_header (struct tar_stat_info *st);
void finish_header (struct tar_stat_info *, union block *, off_t);
void simple_finish_header (union block *header);
#define UNAME_TO_CHARS(name,buf) string_to_chars (name, buf, sizeof(buf))
#define GNAME_TO_CHARS(name,buf) string_to_chars (name, buf, sizeof(buf))
#define UNAME_TO_CHARS(name,buf) string_to_chars (name, buf, sizeof(buf))
#define GNAME_TO_CHARS(name,buf) string_to_chars (name, buf, sizeof(buf))
-void gid_to_chars (gid_t, char *, size_t);
-void major_to_chars (major_t, char *, size_t);
-void minor_to_chars (minor_t, char *, size_t);
-void mode_to_chars (mode_t, char *, size_t);
-void off_to_chars (off_t, char *, size_t);
-void size_to_chars (size_t, char *, size_t);
-void time_to_chars (time_t, char *, size_t);
-void uid_to_chars (uid_t, char *, size_t);
-void uintmax_to_chars (uintmax_t, char *, size_t);
+bool gid_to_chars (gid_t, char *, size_t);
+bool major_to_chars (major_t, char *, size_t);
+bool minor_to_chars (minor_t, char *, size_t);
+bool mode_to_chars (mode_t, char *, size_t);
+bool off_to_chars (off_t, char *, size_t);
+bool size_to_chars (size_t, char *, size_t);
+bool time_to_chars (time_t, char *, size_t);
+bool uid_to_chars (uid_t, char *, size_t);
+bool uintmax_to_chars (uintmax_t, char *, size_t);
void write_directory_file (void);
void purge_directory (char const *);
void list_dumpdir (char *buffer, size_t size);
void write_directory_file (void);
void purge_directory (char const *);
void list_dumpdir (char *buffer, size_t size);
int unquote_string (char *);
void code_ns_fraction (int, char *);
int unquote_string (char *);
void code_ns_fraction (int, char *);
+char const *code_timespec (struct timespec, char *);
+enum { BILLION = 1000000000, LOG10_BILLION = 9 };
+enum { TIMESPEC_STRSIZE_BOUND =
+ UINTMAX_STRSIZE_BOUND + LOG10_BILLION + sizeof "-." - 1 };
int name_match (const char *);
void names_notfound (void);
void collect_and_sort_names (void);
int name_match (const char *);
void names_notfound (void);
void collect_and_sort_names (void);
char *name_from_list (void);
void blank_name_list (void);
char *new_name (const char *, const char *);
char *name_from_list (void);
void blank_name_list (void);
char *new_name (const char *, const char *);
void tar_stat_init (struct tar_stat_info *st);
void tar_stat_destroy (struct tar_stat_info *st);
void usage (int) __attribute__ ((noreturn));
void tar_stat_init (struct tar_stat_info *st);
void tar_stat_destroy (struct tar_stat_info *st);
void usage (int) __attribute__ ((noreturn));
void xheader_read (union block *, size_t);
void xheader_write (char type, char *name, struct xheader *xhdr);
void xheader_write_global (void);
void xheader_read (union block *, size_t);
void xheader_write (char type, char *name, struct xheader *xhdr);
void xheader_write_global (void);
void xheader_write (char, char *, struct xheader *);
void xheader_write_global (void);
void xheader_set_option (char *string);
void xheader_write (char, char *, struct xheader *);
void xheader_write_global (void);
void xheader_set_option (char *string);
+void xheader_string_begin (void);
+void xheader_string_add (char const *s);
+void xheader_string_end (char const *keyword);
+bool xheader_keyword_deleted_p (const char *kw);
+char *xheader_format_name (struct tar_stat_info *st, const char *fmt,
+ size_t n);
bool sys_get_archive_stat (void);
int sys_exec_command (char *file_name, int typechar, struct tar_stat_info *st);
void sys_wait_command (void);
bool sys_get_archive_stat (void);
int sys_exec_command (char *file_name, int typechar, struct tar_stat_info *st);
void sys_wait_command (void);