From: Paul Eggert Date: Sat, 14 Aug 1999 07:10:19 +0000 (+0000) Subject: (start_header): Include text of ignored filesystem prefix in warning. X-Git-Url: https://git.dogcows.com/gitweb?a=commitdiff_plain;h=619a95af98c8bab14dfad12c6f9db2367ba8f8af;p=chaz%2Ftar (start_header): Include text of ignored filesystem prefix in warning. (create_archive): Check for excluded names when doing incremental pass through directory. (dump_file): Do not dump old files explicitly given on command line when using --listed-incremental. Do not strip ./ from front of file names. --- diff --git a/src/create.c b/src/create.c index c6d78b2..9bd4dea 100644 --- a/src/create.c +++ b/src/create.c @@ -372,28 +372,29 @@ start_header (const char *name, struct stat *st) if (!absolute_names_option) { - static int warned_once = 0; size_t prefix_len = FILESYSTEM_PREFIX_LEN (name); if (prefix_len) { - name += prefix_len; + static int warned_once; if (!warned_once) { warned_once = 1; - WARN ((0, 0, _("Removing filesystem prefix from names in the archive"))); + WARN ((0, 0, _("Removing `%.*s' prefix from archive names"), + (int) prefix_len, name)); } + name += prefix_len; } while (*name == '/') { - name++; /* force relative path */ + static int warned_once; if (!warned_once) { warned_once = 1; - WARN ((0, 0, _("\ -Removing leading `/' from absolute path names in the archive"))); + WARN ((0, 0, _("Removing leading `/' from archive names"))); } + name++; } } @@ -851,22 +852,21 @@ create_archive (void) blank_name_list (); while (p = name_from_list (), p) - { - strcpy (buffer, p); - if (p[strlen (p) - 1] != '/') - strcat (buffer, "/"); - bufp = buffer + strlen (buffer); - for (q = gnu_list_name->dir_contents; - q && *q; - q += strlen (q) + 1) - { - if (*q == 'Y') - { - strcpy (bufp, q + 1); - dump_file (buffer, (dev_t) -1, 1); - } - } - } + if (!excluded_name (p)) + { + strcpy (buffer, p); + if (p[strlen (p) - 1] != '/') + strcat (buffer, "/"); + bufp = buffer + strlen (buffer); + q = gnu_list_name->dir_contents; + if (q) + for (; *q; q += strlen (q) + 1) + if (*q == 'Y') + { + strcpy (bufp, q + 1); + dump_file (buffer, (dev_t) -1, 1); + } + } free (buffer); } else @@ -945,14 +945,15 @@ dump_file (char *p, dev_t parent_device, int top_level) } #endif - /* See if we only want new files, and check if this one is too old to + /* See if we want only new files, and check if this one is too old to put in the archive. */ - if (!incremental_option && !S_ISDIR (current_stat.st_mode) + if ((!incremental_option || listed_incremental_option) + && !S_ISDIR (current_stat.st_mode) && current_stat.st_mtime < newer_mtime_option && (!after_date_option || current_stat.st_ctime < newer_ctime_option)) { - if (parent_device == (dev_t) -1) + if (!listed_incremental_option && parent_device == (dev_t) -1) WARN ((0, 0, _("%s: is unchanged; not dumped"), p)); /* FIXME: recheck this return. */ return; @@ -994,13 +995,11 @@ dump_file (char *p, dev_t parent_device, int top_level) while (!absolute_names_option && *link_name == '/') { - static int warned_once = 0; - + static int warned_once; if (!warned_once) { warned_once = 1; - WARN ((0, 0, _("\ -Removing leading `/' from absolute links"))); + WARN ((0, 0, _("Removing leading `/' from link names"))); } link_name++; } @@ -1550,11 +1549,6 @@ Read error at byte %s, reading %lu bytes, in file %s"), return; } - /* Hack to remove "./" from the front of all the file names. */ - - if (len == 2 && namebuf[0] == '.' && namebuf[1] == '/') - len = 0; - /* FIXME: Should speed this up by cd-ing into the dir. */ while (entry = readdir (directory), entry)