tar: Remove support for old syntax (we now require '-' to parse flags)

This commit is contained in:
sin 2015-01-26 16:13:01 +00:00
parent 1412d07b7d
commit 2334c04952

47
tar.c
View File

@ -271,10 +271,8 @@ xt(int (*fn)(char*, int, char[Blksiz]))
static void static void
usage(void) usage(void)
{ {
eprintf("usage: tar [-f tarfile] [-C dir] [-]j|z [-]x[m]|t\n" eprintf("usage: tar [-f tarfile] [-C dir] -j|z -x[m]|t\n"
" tar [-f tarfile] [-C dir] [-]c dir\n" " tar [-f tarfile] [-C dir] -c dir\n"
" tar [-C dir] cf tarfile dir\n"
" tar [-C dir] j|z x[m]|tf tarfile\n");
} }
int int
@ -312,47 +310,6 @@ main(int argc, char *argv[])
usage(); usage();
} ARGEND; } ARGEND;
if (!mode) {
if (argc < 1)
usage();
for (ap = argv[0]; *ap; ap++) {
switch (*ap) {
case 'x':
case 'c':
case 't':
if (mode)
usage();
mode = *ap;
break;
case 'f':
if (argc < 2)
usage();
argc--, argv++;
file = argv[0];
break;
case 'C':
if (argc < 2)
usage();
argc--, argv++;
dir = argv[0];
break;
case 'm':
mflag = 1;
break;
case 'j':
case 'z':
if (filtermode)
usage();
filtermode = *ap;
break;
default:
usage();
}
}
argc--, argv++;
}
if (!mode || argc != (mode == 'c')) if (!mode || argc != (mode == 'c'))
usage(); usage();