112 |
return reply == 'y' || reply == 'Y'; |
return reply == 'y' || reply == 'Y'; |
113 |
} |
} |
114 |
} |
} |
115 |
|
|
116 |
|
void |
117 |
|
set_archive_format (char *name) |
118 |
|
{ |
119 |
|
static struct fmttab { |
120 |
|
char *name; |
121 |
|
enum archive_format fmt; |
122 |
|
} fmttab[] = { |
123 |
|
{ "v7", V7_FORMAT }, |
124 |
|
{ "oldgnu", OLDGNU_FORMAT }, |
125 |
|
{ "posix", POSIX_FORMAT }, |
126 |
|
#if 0 /* not fully supported yet */ |
127 |
|
{ "star", STAR_FORMAT }, |
128 |
|
#endif |
129 |
|
{ "gnu", GNU_FORMAT }, |
130 |
|
NULL |
131 |
|
}; |
132 |
|
struct fmttab *p; |
133 |
|
enum archive_format fmt; |
134 |
|
|
135 |
|
for (p = fmttab; p->name; p++) |
136 |
|
{ |
137 |
|
if (strcmp (p->name, name) == 0) |
138 |
|
{ |
139 |
|
fmt = p->fmt; |
140 |
|
break; |
141 |
|
} |
142 |
|
} |
143 |
|
|
144 |
|
if (archive_format != DEFAULT_FORMAT && archive_format != fmt) |
145 |
|
USAGE_ERROR ((0, 0, _("Conflicting archive format options"))); |
146 |
|
|
147 |
|
archive_format = fmt; |
148 |
|
} |
149 |
|
|
150 |
/* Options. */ |
/* Options. */ |
151 |
|
|
165 |
DELETE_OPTION, |
DELETE_OPTION, |
166 |
EXCLUDE_OPTION, |
EXCLUDE_OPTION, |
167 |
FORCE_LOCAL_OPTION, |
FORCE_LOCAL_OPTION, |
168 |
|
FORMAT_OPTION, |
169 |
GROUP_OPTION, |
GROUP_OPTION, |
170 |
IGNORE_CASE_OPTION, |
IGNORE_CASE_OPTION, |
171 |
IGNORE_FAILED_READ_OPTION, |
IGNORE_FAILED_READ_OPTION, |
232 |
{"file", required_argument, 0, 'f'}, |
{"file", required_argument, 0, 'f'}, |
233 |
{"files-from", required_argument, 0, 'T'}, |
{"files-from", required_argument, 0, 'T'}, |
234 |
{"force-local", no_argument, 0, FORCE_LOCAL_OPTION}, |
{"force-local", no_argument, 0, FORCE_LOCAL_OPTION}, |
235 |
|
{"format", required_argument, 0, FORMAT_OPTION}, |
236 |
{"get", no_argument, 0, 'x'}, |
{"get", no_argument, 0, 'x'}, |
237 |
{"group", required_argument, 0, GROUP_OPTION}, |
{"group", required_argument, 0, GROUP_OPTION}, |
238 |
{"gunzip", no_argument, 0, 'z'}, |
{"gunzip", no_argument, 0, 'z'}, |
404 |
fputs (_("\ |
fputs (_("\ |
405 |
\n\ |
\n\ |
406 |
Archive format selection:\n\ |
Archive format selection:\n\ |
407 |
|
--format=FMTNAME create archive of the given format.\n\ |
408 |
|
FMTNAME is one of the following:\n\ |
409 |
|
v7 old V7 tar format\n\ |
410 |
|
oldgnu GNU format as per tar <= 1.12\n\ |
411 |
|
posix POSIX 1003.1-2001 tar format\n\ |
412 |
|
gnu GNU format\n\ |
413 |
|
--old-archive, --portability same as --format=v7\n\ |
414 |
|
--posix same as --format=posix\n\ |
415 |
-V, --label=NAME create archive with volume name NAME\n\ |
-V, --label=NAME create archive with volume name NAME\n\ |
416 |
PATTERN at list/extract time, a globbing PATTERN\n\ |
PATTERN at list/extract time, a globbing PATTERN\n\ |
|
--old-archive, --portability write a V7 format archive\n\ |
|
|
--posix write a POSIX format archive\n\ |
|
417 |
-j, --bzip2 filter the archive through bzip2\n\ |
-j, --bzip2 filter the archive through bzip2\n\ |
418 |
-z, --gzip, --ungzip filter the archive through gzip\n\ |
-z, --gzip, --ungzip filter the archive through gzip\n\ |
419 |
-Z, --compress, --uncompress filter the archive through compress\n\ |
-Z, --compress, --uncompress filter the archive through compress\n\ |
938 |
force_local_option = 1; |
force_local_option = 1; |
939 |
break; |
break; |
940 |
|
|
941 |
|
case FORMAT_OPTION: |
942 |
|
set_archive_format (optarg); |
943 |
|
break; |
944 |
|
|
945 |
case INDEX_FILE_OPTION: |
case INDEX_FILE_OPTION: |
946 |
index_file_name = optarg; |
index_file_name = optarg; |
947 |
break; |
break; |
1025 |
break; |
break; |
1026 |
|
|
1027 |
case POSIX_OPTION: |
case POSIX_OPTION: |
1028 |
#if OLDGNU_COMPATIBILITY |
set_archive_format ("posix"); |
|
if (archive_format == DEFAULT_FORMAT) |
|
|
archive_format = GNU_FORMAT; |
|
|
else if (archive_format != GNU_FORMAT) |
|
|
USAGE_ERROR ((0, 0, _("Conflicting archive format options"))); |
|
|
#else |
|
|
if (archive_format == DEFAULT_FORMAT) |
|
|
archive_format = POSIX_FORMAT; |
|
|
else if (archive_format != POSIX_FORMAT) |
|
|
USAGE_ERROR ((0, 0, _("Conflicting archive format options"))); |
|
|
#endif |
|
1029 |
break; |
break; |
1030 |
|
|
1031 |
case PRESERVE_OPTION: |
case PRESERVE_OPTION: |
1145 |
xrealloc (archive_name_array, |
xrealloc (archive_name_array, |
1146 |
sizeof (const char *) * allocated_archive_names); |
sizeof (const char *) * allocated_archive_names); |
1147 |
} |
} |
1148 |
archive_name_array[archive_names++] = buf; |
archive_name_array[archive_names++] = strdup (buf); |
|
|
|
|
/* FIXME: How comes this works for many archives when buf is |
|
|
not xstrdup'ed? */ |
|
1149 |
} |
} |
1150 |
break; |
break; |
1151 |
|
|
1171 |
if (subcommand_option == CREATE_SUBCOMMAND) |
if (subcommand_option == CREATE_SUBCOMMAND) |
1172 |
{ |
{ |
1173 |
/* GNU Tar <= 1.13 compatibility */ |
/* GNU Tar <= 1.13 compatibility */ |
1174 |
if (archive_format == DEFAULT_FORMAT) |
set_archive_format ("v7"); |
|
archive_format = V7_FORMAT; |
|
|
else if (archive_format != V7_FORMAT) |
|
|
USAGE_ERROR ((0, 0, _("Conflicting archive format options"))); |
|
1175 |
} |
} |
1176 |
else |
else |
1177 |
{ |
{ |
1209 |
/* Derive option values and check option consistency. */ |
/* Derive option values and check option consistency. */ |
1210 |
|
|
1211 |
if (archive_format == DEFAULT_FORMAT) |
if (archive_format == DEFAULT_FORMAT) |
1212 |
{ |
archive_format = GNU_FORMAT; |
|
#if OLDGNU_COMPATIBILITY |
|
|
archive_format = OLDGNU_FORMAT; |
|
|
#else |
|
|
archive_format = GNU_FORMAT; |
|
|
#endif |
|
|
} |
|
1213 |
|
|
1214 |
if (archive_format == GNU_FORMAT && getenv ("POSIXLY_CORRECT")) |
if (archive_format == GNU_FORMAT && getenv ("POSIXLY_CORRECT")) |
1215 |
archive_format = POSIX_FORMAT; |
archive_format = POSIX_FORMAT; |
1435 |
free (st->gname); |
free (st->gname); |
1436 |
memset (st, 0, sizeof (*st)); |
memset (st, 0, sizeof (*st)); |
1437 |
} |
} |
1438 |
|
|