/[tar]/tar/src/tar.c
ViewVC logotype

Diff of /tar/src/tar.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.62 by eggert, Wed Sep 3 06:19:00 2003 UTC revision 1.63 by gray, Wed Sep 3 11:03:07 2003 UTC
# Line 44  Line 44 
44    
45  /* Local declarations.  */  /* Local declarations.  */
46    
47    #ifndef DEFAULT_ARCHIVE_FORMAT
48    # define DEFAULT_ARCHIVE_FORMAT GNU_FORMAT
49    #endif
50    
51  #ifndef DEFAULT_ARCHIVE  #ifndef DEFAULT_ARCHIVE
52  # define DEFAULT_ARCHIVE "tar.out"  # define DEFAULT_ARCHIVE "tar.out"
53  #endif  #endif
# Line 113  confirm (const char *message_action, con Line 117  confirm (const char *message_action, con
117    }    }
118  }  }
119    
120    static struct fmttab {
121      char const *name;
122      enum archive_format fmt;
123    } const fmttab[] = {
124      { "v7",      V7_FORMAT },
125      { "oldgnu",  OLDGNU_FORMAT },
126      { "posix",   POSIX_FORMAT },
127    #if 0 /* not fully supported yet */
128      { "star",    STAR_FORMAT },
129    #endif
130      { "gnu",     GNU_FORMAT },
131      { NULL,        0 }
132    };
133    
134  static void  static void
135  set_archive_format (char const *name)  set_archive_format (char const *name)
136  {  {
   static struct fmttab {  
     char const *name;  
     enum archive_format fmt;  
   } const fmttab[] = {  
     { "v7",      V7_FORMAT },  
     { "oldgnu",  OLDGNU_FORMAT },        
     { "posix",   POSIX_FORMAT },  
 #if 0 /* not fully supported yet */  
     { "star",    STAR_FORMAT },  
 #endif  
     { "gnu",     GNU_FORMAT },  
     { NULL,      0 }  
   };  
137    struct fmttab const *p;    struct fmttab const *p;
138    
139    for (p = fmttab; strcmp (p->name, name) != 0; )    for (p = fmttab; strcmp (p->name, name) != 0; )
# Line 141  set_archive_format (char const *name) Line 146  set_archive_format (char const *name)
146        
147    archive_format = p->fmt;    archive_format = p->fmt;
148  }  }
149    
150    static const char *
151    archive_format_string (enum archive_format fmt)
152    {
153      struct fmttab const *p;
154    
155      for (p = fmttab; p->name; p++)
156        if (p->fmt == fmt)
157          return p->name;
158      return "unknown?";
159    }
160    
161    
162  /* Options.  */  /* Options.  */
163    
# Line 479  The version control may be set with --ba Line 496  The version control may be set with --ba
496               stdout);               stdout);
497        printf (_("\        printf (_("\
498  \n\  \n\
 GNU tar cannot read nor produce `--posix' archives.  If POSIXLY_CORRECT\n\  
 is set in the environment, GNU extensions are disallowed with `--posix'.\n\  
 Support for POSIX is only partially implemented, don't count on it yet.\n\  
499  ARCHIVE may be FILE, HOST:FILE or USER@HOST:FILE; DATE may be a textual date\n\  ARCHIVE may be FILE, HOST:FILE or USER@HOST:FILE; DATE may be a textual date\n\
500  or a file name starting with `/' or `.', in which case the file's date is used.\n\  or a file name starting with `/' or `.', in which case the file's date is used.\n\
501  *This* `tar' defaults to `-f%s -b%d'.\n"),  *This* `tar' defaults to `--format=%s -f%s -b%d'.\n"),
502                  archive_format_string (DEFAULT_ARCHIVE_FORMAT),
503                DEFAULT_ARCHIVE, DEFAULT_BLOCKING);                DEFAULT_ARCHIVE, DEFAULT_BLOCKING);
504        printf (_("\nReport bugs to <%s>.\n"), PACKAGE_BUGREPORT);        printf (_("\nReport bugs to <%s>.\n"), PACKAGE_BUGREPORT);
505      }      }
# Line 1204  see the file named COPYING for details." Line 1219  see the file named COPYING for details."
1219    /* Derive option values and check option consistency.  */    /* Derive option values and check option consistency.  */
1220    
1221    if (archive_format == DEFAULT_FORMAT)    if (archive_format == DEFAULT_FORMAT)
1222      archive_format = GNU_FORMAT;      archive_format = DEFAULT_ARCHIVE_FORMAT;
1223    
1224    if (archive_format == GNU_FORMAT && getenv ("POSIXLY_CORRECT"))    if (archive_format == GNU_FORMAT && getenv ("POSIXLY_CORRECT"))
1225      archive_format = POSIX_FORMAT;      archive_format = POSIX_FORMAT;

Legend:
Removed from v.1.62  
changed lines
  Added in v.1.63

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26