187 |
CHECKPOINT_OPTION, |
CHECKPOINT_OPTION, |
188 |
DELETE_OPTION, |
DELETE_OPTION, |
189 |
EXCLUDE_OPTION, |
EXCLUDE_OPTION, |
|
FIRST_COPY_OPTION, |
|
190 |
FORCE_LOCAL_OPTION, |
FORCE_LOCAL_OPTION, |
191 |
FORMAT_OPTION, |
FORMAT_OPTION, |
192 |
GROUP_OPTION, |
GROUP_OPTION, |
202 |
NO_WILDCARDS_MATCH_SLASH_OPTION, |
NO_WILDCARDS_MATCH_SLASH_OPTION, |
203 |
NULL_OPTION, |
NULL_OPTION, |
204 |
NUMERIC_OWNER_OPTION, |
NUMERIC_OWNER_OPTION, |
205 |
|
OCCURRENCE_OPTION, |
206 |
OVERWRITE_OPTION, |
OVERWRITE_OPTION, |
207 |
OWNER_OPTION, |
OWNER_OPTION, |
208 |
POSIX_OPTION, |
POSIX_OPTION, |
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 |
|
|
|
/* If nonzero, stop processing when all the files from the namelist |
|
|
where handled */ |
|
|
static int first_copy_option; |
|
|
|
|
230 |
static struct option long_options[] = |
static struct option long_options[] = |
231 |
{ |
{ |
232 |
{"absolute-names", no_argument, 0, 'P'}, |
{"absolute-names", no_argument, 0, 'P'}, |
256 |
{"extract", no_argument, 0, 'x'}, |
{"extract", no_argument, 0, 'x'}, |
257 |
{"file", required_argument, 0, 'f'}, |
{"file", required_argument, 0, 'f'}, |
258 |
{"files-from", required_argument, 0, 'T'}, |
{"files-from", required_argument, 0, 'T'}, |
|
{"first-copy", no_argument, &first_copy_option, 1}, |
|
259 |
{"force-local", no_argument, 0, FORCE_LOCAL_OPTION}, |
{"force-local", no_argument, 0, FORCE_LOCAL_OPTION}, |
260 |
{"format", required_argument, 0, FORMAT_OPTION}, |
{"format", required_argument, 0, FORMAT_OPTION}, |
261 |
{"get", no_argument, 0, 'x'}, |
{"get", no_argument, 0, 'x'}, |
290 |
{"no-same-owner", no_argument, &same_owner_option, -1}, |
{"no-same-owner", no_argument, &same_owner_option, -1}, |
291 |
{"no-same-permissions", no_argument, &same_permissions_option, -1}, |
{"no-same-permissions", no_argument, &same_permissions_option, -1}, |
292 |
{"numeric-owner", no_argument, 0, NUMERIC_OWNER_OPTION}, |
{"numeric-owner", no_argument, 0, NUMERIC_OWNER_OPTION}, |
293 |
|
{"occurrence", optional_argument, 0, OCCURRENCE_OPTION}, |
294 |
{"old-archive", no_argument, 0, 'o'}, |
{"old-archive", no_argument, 0, 'o'}, |
295 |
{"one-file-system", no_argument, 0, 'l'}, |
{"one-file-system", no_argument, 0, 'l'}, |
296 |
{"overwrite", no_argument, 0, OVERWRITE_OPTION}, |
{"overwrite", no_argument, 0, OVERWRITE_OPTION}, |
388 |
-g, --listed-incremental=FILE\n\ |
-g, --listed-incremental=FILE\n\ |
389 |
handle new GNU-format incremental backup\n\ |
handle new GNU-format incremental backup\n\ |
390 |
--ignore-failed-read do not exit with nonzero on unreadable files\n\ |
--ignore-failed-read do not exit with nonzero on unreadable files\n\ |
391 |
--first-copy process only the first copy of each file in the\ |
--occurrence[=NUM] process only the NUMth occurrence of each file in\n\ |
392 |
archive\n"), |
the archive. This option is valid only in\n\ |
393 |
|
conjunction with one of the subcommands --delete,\n\ |
394 |
|
--diff, --extract or --list and when a list of\n\ |
395 |
|
files is given either on the command line or\n\ |
396 |
|
via -T option.\n\ |
397 |
|
NUM defaults to 1.\n"), |
398 |
stdout); |
stdout); |
399 |
fputs (_("\ |
fputs (_("\ |
400 |
\n\ |
\n\ |
1039 |
numeric_owner_option = true; |
numeric_owner_option = true; |
1040 |
break; |
break; |
1041 |
|
|
1042 |
|
case OCCURRENCE_OPTION: |
1043 |
|
if (!optarg) |
1044 |
|
occurrence_option = 1; |
1045 |
|
else |
1046 |
|
{ |
1047 |
|
uintmax_t u; |
1048 |
|
if (xstrtoumax (optarg, 0, 10, &u, "") == LONGINT_OK) |
1049 |
|
occurrence_option = u; |
1050 |
|
else |
1051 |
|
FATAL_ERROR ((0, 0, "%s: %s", quotearg_colon (optarg), |
1052 |
|
_("Invalid number"))); |
1053 |
|
} |
1054 |
|
break; |
1055 |
|
|
1056 |
case OVERWRITE_OPTION: |
case OVERWRITE_OPTION: |
1057 |
old_files_option = OVERWRITE_OLD_FILES; |
old_files_option = OVERWRITE_OLD_FILES; |
1058 |
break; |
break; |
1292 |
assert_format (FORMAT_MASK (OLDGNU_FORMAT) |
assert_format (FORMAT_MASK (OLDGNU_FORMAT) |
1293 |
| FORMAT_MASK (GNU_FORMAT)); |
| FORMAT_MASK (GNU_FORMAT)); |
1294 |
|
|
1295 |
if (first_copy_option) |
if (occurrence_option) |
1296 |
{ |
{ |
1297 |
if (!input_files && !files_from_option) |
if (!input_files && !files_from_option) |
1298 |
USAGE_ERROR ((0, 0, |
USAGE_ERROR ((0, 0, |
1299 |
_("--first-copy is meaningless without file list"))); |
_("--occurrence is meaningless without file list"))); |
1300 |
if (subcommand_option != DELETE_SUBCOMMAND |
if (subcommand_option != DELETE_SUBCOMMAND |
1301 |
&& subcommand_option != DIFF_SUBCOMMAND |
&& subcommand_option != DIFF_SUBCOMMAND |
1302 |
&& subcommand_option != EXTRACT_SUBCOMMAND |
&& subcommand_option != EXTRACT_SUBCOMMAND |
1303 |
&& subcommand_option != LIST_SUBCOMMAND) |
&& subcommand_option != LIST_SUBCOMMAND) |
1304 |
USAGE_ERROR ((0, 0, |
USAGE_ERROR ((0, 0, |
1305 |
_("--first-copy cannot be used in the requested operation mode"))); |
_("--occurrence cannot be used in the requested operation mode"))); |
1306 |
} |
} |
1307 |
|
|
1308 |
if (archive_names == 0) |
if (archive_names == 0) |
1405 |
} |
} |
1406 |
} |
} |
1407 |
|
|
|
bool |
|
|
all_names_found () |
|
|
{ |
|
|
return first_copy_option && names_done (); |
|
|
} |
|
|
|
|
1408 |
|
|
1409 |
/* Tar proper. */ |
/* Tar proper. */ |
1410 |
|
|