X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=src%2Fsuffix.c;h=d11e9ee20ff00bf24ca1f37daf41bafe7fff6261;hb=cd7bdd4076ca154575bbef85eb2157e59befcfe2;hp=fcf229798badb877575b19f67eca695102d9f0a7;hpb=af3e05b6af31232236b5d2c1b5a5da5392ed3018;p=chaz%2Ftar diff --git a/src/suffix.c b/src/suffix.c index fcf2297..d11e9ee 100644 --- a/src/suffix.c +++ b/src/suffix.c @@ -1,5 +1,5 @@ /* This file is part of GNU tar. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright 2007, 2009, 2013 Free Software Foundation, Inc. Written by Sergey Poznyakoff. @@ -26,30 +26,35 @@ struct compression_suffix const char *program; }; -struct compression_suffix compression_suffixes[] = { -#define S(s,p) #s, sizeof (#s) - 1, #p - { S(gz, gzip) }, - { S(tgz, gzip) }, - { S(taz, gzip) }, - { S(Z, compress) }, - { S(taZ, compress) }, - { S(bz2, bzip2) }, - { S(tbz, bzip2) }, - { S(tbz2, bzip2) }, - { S(tz2, bzip2) }, - { S(lzma, lzma) }, - { S(tlz, lzma) }, +static struct compression_suffix compression_suffixes[] = { +#define __CAT2__(a,b) a ## b +#define S(s,p) #s, sizeof (#s) - 1, __CAT2__(p,_PROGRAM) + { S(gz, GZIP) }, + { S(tgz, GZIP) }, + { S(taz, GZIP) }, + { S(Z, COMPRESS) }, + { S(taZ, COMPRESS) }, + { S(bz2, BZIP2) }, + { S(tbz, BZIP2) }, + { S(tbz2, BZIP2) }, + { S(tz2, BZIP2) }, + { S(lz, LZIP) }, + { S(lzma, LZMA) }, + { S(tlz, LZMA) }, + { S(lzo, LZOP) }, + { S(xz, XZ) }, #undef S +#undef __CAT2__ }; -int nsuffixes = sizeof (compression_suffixes) / - sizeof (compression_suffixes[0]); +static int nsuffixes = sizeof (compression_suffixes) / + sizeof (compression_suffixes[0]); static const char * find_compression_program (const char *name, const char *defprog) { char *suf = strrchr (name, '.'); - + if (suf) { int i; @@ -69,10 +74,9 @@ find_compression_program (const char *name, const char *defprog) } void -set_comression_program_by_suffix (const char *name, const char *defprog) +set_compression_program_by_suffix (const char *name, const char *defprog) { const char *program = find_compression_program (name, defprog); if (program) use_compress_program_option = program; } -