]> Dogcows Code - chaz/tar/blobdiff - src/tar.c
*** empty log message ***
[chaz/tar] / src / tar.c
index 4d2c4b800762357a76fc664ef211637685c22943..7f0c5743f70621a9c9a254780e01681b4b66c630 100644 (file)
--- a/src/tar.c
+++ b/src/tar.c
@@ -1,5 +1,5 @@
 /* Tar -- a tape archiver.
-   Copyright (C) 1988, 1992 Free Software Foundation
+   Copyright (C) 1988, 1992, 1993 Free Software Foundation
 
 This file is part of GNU Tar.
 
@@ -27,7 +27,6 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #include <sys/types.h>         /* Needed for typedefs in tar.h */
 #include "getopt.h"
 #include "regex.h"
-#include "fnmatch.h"
 
 /*
  * The following causes "tar.h" to produce definitions of all the
@@ -37,28 +36,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #include "tar.h"
 
 #include "port.h"
-
-#if defined(_POSIX_VERSION) || defined(DIRENT)
-#include <dirent.h>
-#ifdef direct
-#undef direct
-#endif /* direct */
-#define direct dirent
-#define DP_NAMELEN(x) strlen((x)->d_name)
-#endif /* _POSIX_VERSION or DIRENT */
-#if !defined(_POSIX_VERSION) && !defined(DIRENT) && defined(BSD42)
-#include <sys/dir.h>
-#define DP_NAMELEN(x)  (x)->d_namlen
-#endif /* not _POSIX_VERSION and BSD42 */
-#ifdef __MSDOS__
-#include "msd_dir.h"
-#define DP_NAMELEN(x)  (x)->d_namlen
-#define direct dirent
-#endif
-#if defined(USG) && !defined(_POSIX_VERSION) && !defined(DIRENT)
-#include <ndir.h>
-#define DP_NAMELEN(x) strlen((x)->d_name)
-#endif /* USG and not _POSIX_VERSION and not DIRENT */
+#include "fnmatch.h"
 
 /*
  * We should use a conversion routine that does reasonable error
@@ -75,6 +53,8 @@ extern void diff_archive ();
 extern void create_archive ();
 extern void update_archive ();
 extern void junk_archive ();
+extern void init_volume_number ();
+extern void closeout_volume_number ();
 
 /* JF */
 extern time_t get_date ();
@@ -173,6 +153,7 @@ struct option long_options[] =
   {"listed-incremental", 1, 0, 'g'},
   {"multi-volume", 0, &f_multivol, 1},
   {"info-script", 1, 0, 'F'},
+  {"new-volume-script", 1, 0, 'F'},
   {"absolute-paths", 0, &f_absolute_paths, 1},
   {"interactive", 0, &f_confirm, 1},
   {"confirmation", 0, &f_confirm, 1},
@@ -668,7 +649,7 @@ describe ()
 -c, --create           create a new archive\n\
 -d, --diff,\n\
     --compare          find differences between archive and file system\n\
---delete                       delete from the archive (not for use on mag tapes!)\n\
+--delete               delete from the archive (not for use on mag tapes!)\n\
 -r, --append           append files to the end of an archive\n\
 -t, --list             list the contents of an archive\n\
 -u, --update           only append files that are newer than copy in archive\n\
@@ -689,22 +670,23 @@ Other options:\n\
           DEF_AR_FILE);
   fputs ("\
 --force-local          archive file is local even if has a colon\n\
--F, --info-script F    run script at end of each tape (implies -M)\n\
+-F, --info-script F\n\
+    --new-volume-script F run script at end of each tape (implies -M)\n\
 -G, --incremental      create/list/extract old GNU-format incremental backup\n\
 -g, --listed-incremental F create/list/extract new GNU-format incremental backup\n\
 -h, --dereference      don't dump symlinks; dump the files they point to\n\
 -i, --ignore-zeros     ignore blocks of zeros in archive (normally mean EOF)\n\
 --ignore-failed-read   don't exit with non-zero status on unreadable files\n\
 -k, --keep-old-files   keep existing files; don't overwrite them from archive\n\
--K, --starting-file FILE       begin at FILE in the archive\n\
+-K, --starting-file F  begin at file F in the archive\n\
 -l, --one-file-system  stay in local file system when creating an archive\n\
--L, --tape-length LENGTH change tapes after writing LENGTH\n\
+-L, --tape-length N    change tapes after writing N*1024 bytes\n\
 ", stdout);                    /* KLUDGE */
   fputs ("\
 -m, --modification-time        don't extract file modified time\n\
 -M, --multi-volume     create/list/extract multi-volume archive\n\
 -N, --after-date DATE,\n\
-    --newer DATE               only store files newer than DATE\n\
+    --newer DATE       only store files newer than DATE\n\
 -o, --old-archive,\n\
     --portability      write a V7 format archive, rather than ANSI format\n\
 -O, --to-stdout                extract files to standard output\n\
@@ -722,9 +704,9 @@ Other options:\n\
 -S, --sparse           handle sparse files efficiently\n\
 -T, --files-from F     get names to extract or create from file F\n\
 --null                 -T reads null-terminated names, disable -C\n\
---totals                       print total bytes written with --create\n\
+--totals               print total bytes written with --create\n\
 -v, --verbose          verbosely list files processed\n\
--V, --label NAME               create archive with volume name NAME\n\
+-V, --label NAME       create archive with volume name NAME\n\
 --version              print tar program version number\n\
 -w, --interactive,\n\
     --confirmation     ask for confirmation for every action\n\
@@ -886,8 +868,10 @@ tryagain:
        }
       /* End of JF quick -C hack */
 
+#if 0
       if (f_exclude && check_exclude (p))
        goto tryagain;
+#endif
       return un_quote_string (p);
     }
   while (p = read_name_from_file (buffer, &buffer_siz, namef))
@@ -911,8 +895,10 @@ tryagain:
          next_name_is_dir = 0;
          goto tryagain;
        }
+#if 0
       if (f_exclude && check_exclude (p))
        goto tryagain;
+#endif
       return un_quote_string (p);
     }
   return NULL;
@@ -1016,7 +1002,7 @@ addname (name)
       if (chdir_name[0] != '/')
        {
          char *path = ck_malloc (PATH_MAX);
-#if defined(__MSDOS__) || defined(USG) || defined(_POSIX_VERSION)
+#if defined(__MSDOS__) || defined(HAVE_GETCWD) || defined(_POSIX_VERSION)
          if (!getcwd (path, PATH_MAX))
            {
              msg ("Couldn't get current directory.");
@@ -1115,7 +1101,7 @@ again:
       /* Regular expressions (shell globbing, actually). */
       if (nlp->regexp)
        {
-         if (fnmatch (nlp->name, p, FNM_TARPATH) == 0)
+         if (fnmatch (nlp->name, p, FNM_LEADING_DIR) == 0)
            {
              nlp->found = 1;   /* Remember it matched */
              if (f_startfile)
@@ -1234,7 +1220,7 @@ again:
       /* Regular expressions */
       if (nlp->regexp)
        {
-         if (fnmatch (nlp->name, p, FNM_TARPATH) == 0)
+         if (fnmatch (nlp->name, p, FNM_LEADING_DIR) == 0)
            return nlp;         /* We got a match */
          continue;
        }
@@ -1462,7 +1448,7 @@ check_exclude (name)
 
   for (n = 0; n < size_re_exclude; n++)
     {
-      if (fnmatch (re_exclude[n], name, FNM_TARPATH) == 0)
+      if (fnmatch (re_exclude[n], name, FNM_LEADING_DIR) == 0)
        return 1;
     }
   for (n = 0; n < size_exclude; n++)
This page took 0.029889 seconds and 4 git commands to generate.