/[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.67 by eggert, Wed Sep 24 19:11:44 2003 UTC revision 1.68 by gray, Thu Oct 2 10:29:00 2003 UTC
# Line 158  archive_format_string (enum archive_form Line 158  archive_format_string (enum archive_form
158    return "unknown?";    return "unknown?";
159  }  }
160    
161    #define FORMAT_MASK(n) (1<<(n))
162    
163    static void
164    assert_format(unsigned fmt_mask)
165    {
166      if ((FORMAT_MASK(archive_format) & fmt_mask) == 0)
167        USAGE_ERROR ((0, 0,
168                      _("GNU features wanted on incompatible archive format")));
169    }
170    
171    
172    
173  /* Options.  */  /* Options.  */
174    
# Line 176  enum Line 187  enum
187    CHECKPOINT_OPTION,    CHECKPOINT_OPTION,
188    DELETE_OPTION,    DELETE_OPTION,
189    EXCLUDE_OPTION,    EXCLUDE_OPTION,
190      FIRST_COPY_OPTION,
191    FORCE_LOCAL_OPTION,    FORCE_LOCAL_OPTION,
192    FORMAT_OPTION,    FORMAT_OPTION,
193    GROUP_OPTION,    GROUP_OPTION,
# Line 215  static int show_help; Line 227  static int show_help;
227  /* If nonzero, print the version on standard output and exit.  */  /* If nonzero, print the version on standard output and exit.  */
228  static int show_version;  static int show_version;
229    
230    /* If nonzero, stop processing when all the files from the namelist
231       where handled */
232    static int first_copy_option;
233    
234  static struct option long_options[] =  static struct option long_options[] =
235  {  {
236    {"absolute-names", no_argument, 0, 'P'},    {"absolute-names", no_argument, 0, 'P'},
# Line 244  static struct option long_options[] = Line 260  static struct option long_options[] =
260    {"extract", no_argument, 0, 'x'},    {"extract", no_argument, 0, 'x'},
261    {"file", required_argument, 0, 'f'},    {"file", required_argument, 0, 'f'},
262    {"files-from", required_argument, 0, 'T'},    {"files-from", required_argument, 0, 'T'},
263      {"first-copy", no_argument, &first_copy_option, 1},
264    {"force-local", no_argument, 0, FORCE_LOCAL_OPTION},    {"force-local", no_argument, 0, FORCE_LOCAL_OPTION},
265    {"format", required_argument, 0, FORMAT_OPTION},    {"format", required_argument, 0, FORMAT_OPTION},
266    {"get", no_argument, 0, 'x'},    {"get", no_argument, 0, 'x'},
# Line 374  Operation modifiers:\n\ Line 391  Operation modifiers:\n\
391    -G, --incremental          handle old GNU-format incremental backup\n\    -G, --incremental          handle old GNU-format incremental backup\n\
392    -g, --listed-incremental=FILE\n\    -g, --listed-incremental=FILE\n\
393                               handle new GNU-format incremental backup\n\                               handle new GNU-format incremental backup\n\
394        --ignore-failed-read   do not exit with nonzero on unreadable files\n"),        --ignore-failed-read   do not exit with nonzero on unreadable files\n\
395          --first-copy           process only the first copy of each file in the\
396                                 archive\n"),
397               stdout);               stdout);
398        fputs (_("\        fputs (_("\
399  \n\  \n\
# Line 1248  see the file named COPYING for details." Line 1267  see the file named COPYING for details."
1267      USAGE_ERROR ((0, 0,      USAGE_ERROR ((0, 0,
1268                    _("GNU features wanted on incompatible archive format")));                    _("GNU features wanted on incompatible archive format")));
1269    
1270      if (volume_label_option && subcommand_option == CREATE_SUBCOMMAND)
1271        assert_format (FORMAT_MASK (OLDGNU_FORMAT)
1272                       | FORMAT_MASK (GNU_FORMAT));
1273    
1274      if (incremental_option
1275          || multi_volume_option
1276          || sparse_option
1277          || subcommand_option == CAT_SUBCOMMAND)
1278        assert_format (FORMAT_MASK (OLDGNU_FORMAT)
1279                       | FORMAT_MASK (GNU_FORMAT));
1280      
1281      if (first_copy_option)
1282        {
1283          if (!input_files && !files_from_option)
1284            USAGE_ERROR ((0, 0,
1285                          _("--first-copy is meaningless without file list")));
1286          if (subcommand_option != DELETE_SUBCOMMAND
1287              && subcommand_option != DIFF_SUBCOMMAND
1288              && subcommand_option != EXTRACT_SUBCOMMAND
1289              && subcommand_option != LIST_SUBCOMMAND
1290              && subcommand_option != UPDATE_SUBCOMMAND)
1291                USAGE_ERROR ((0, 0,
1292                              _("--first-copy cannot be used in the requested operation mode")));
1293        }
1294      
1295    if (archive_names == 0)    if (archive_names == 0)
1296      {      {
1297        /* If no archive file name given, try TAPE from the environment, or        /* If no archive file name given, try TAPE from the environment, or
# Line 1347  see the file named COPYING for details." Line 1391  see the file named COPYING for details."
1391                 textual_date_option, treated_as));                 textual_date_option, treated_as));
1392      }      }
1393  }  }
1394    
1395    bool
1396    all_names_found ()
1397    {
1398      return first_copy_option && names_done ();
1399    }
1400    
1401    
1402  /* Tar proper.  */  /* Tar proper.  */
1403    

Legend:
Removed from v.1.67  
changed lines
  Added in v.1.68

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