Bug #802 ยป gzip-k.diff
gzip.1 6 Sep 2007 03:01:59 -0000 | ||
---|---|---|
.Nd compression/decompression tool using Lempel-Ziv coding (LZ77)
|
||
.Sh SYNOPSIS
|
||
.Nm
|
||
.Op Fl cdfhlNnqrtVv
|
||
.Op Fl cdfhklNnqrtVv
|
||
.Op Fl S Ar suffix
|
||
.Ar file
|
||
.Oo
|
||
... | ... | |
.Oc
|
||
.Oc
|
||
.Nm gunzip
|
||
.Op Fl cfhNqrtVv
|
||
.Op Fl cfhkNqrtVv
|
||
.Op Fl S Ar suffix
|
||
.Ar file
|
||
.Oo
|
||
... | ... | |
option, allowing non-compressed data to pass through unchanged.
|
||
.It Fl h , -help
|
||
This option prints a usage summary and exits.
|
||
.It Fl k , -keep
|
||
Keep (don't delete) input files during compression
|
||
or decompression.
|
||
.It Fl l , -list
|
||
This option displays information about the file's compressed and
|
||
uncompressed size, ratio, uncompressed name.
|
gzip.c 6 Sep 2007 02:59:15 -0000 | ||
---|---|---|
#ifndef SMALL
|
||
static int fflag; /* force mode */
|
||
static int kflag; /* don't delete input files */
|
||
static int nflag; /* don't save name/timestamp */
|
||
static int Nflag; /* don't restore name/timestamp */
|
||
static int qflag; /* quiet mode */
|
||
... | ... | |
{ "uncompress", no_argument, 0, 'd' },
|
||
{ "force", no_argument, 0, 'f' },
|
||
{ "help", no_argument, 0, 'h' },
|
||
{ "keep", no_argument, 0, 'k' },
|
||
{ "list", no_argument, 0, 'l' },
|
||
{ "no-name", no_argument, 0, 'n' },
|
||
{ "name", no_argument, 0, 'N' },
|
||
... | ... | |
#ifdef SMALL
|
||
#define OPT_LIST "cdhHltV123456789"
|
||
#else
|
||
#define OPT_LIST "cdfhHlnNqrS:tvV123456789"
|
||
#define OPT_LIST "cdfhHklnNqrS:tvV123456789"
|
||
#endif
|
||
while ((ch = getopt_long(argc, argv, OPT_LIST, longopts, NULL)) != -1) {
|
||
... | ... | |
case 'f':
|
||
fflag = 1;
|
||
break;
|
||
case 'k':
|
||
kflag = 1;
|
||
break;
|
||
case 'n':
|
||
nflag = 1;
|
||
Nflag = 0;
|
||
... | ... | |
{
|
||
struct stat nsb;
|
||
if (kflag)
|
||
return;
|
||
if (stat(file, &nsb) != 0)
|
||
/* Must be gone alrady */
|
||
return;
|
||
... | ... | |
path_argv[0] = dir;
|
||
path_argv[1] = 0;
|
||
fts = fts_open(path_argv, FTS_PHYSICAL, NULL);
|
||
fts = fts_open(path_argv, FTS_PHYSICAL | FTS_NOCHDIR, NULL);
|
||
if (fts == NULL) {
|
||
warn("couldn't fts_open %s", dir);
|
||
return;
|
||
... | ... | |
maybe_warn("%s", entry->fts_path);
|
||
continue;
|
||
case FTS_F:
|
||
handle_file(entry->fts_name, entry->fts_statp);
|
||
handle_file(entry->fts_path, entry->fts_statp);
|
||
}
|
||
}
|
||
(void)fts_close(fts);
|
||
... | ... | |
fprintf(stderr, "%s\n", gzip_version);
|
||
fprintf(stderr,
|
||
"usage: %s [-" OPT_LIST "] [<file> [<file> ...]]\n"
|
||
#ifndef SMALL
|
||
#ifdef SMALL
|
||
"usage: %s [-" OPT_LIST "] [<file> [<file> ...]]\n",
|
||
#else
|
||
"usage: %s [-123456789acdfhklLNnqrtVv] [-S .suffix] [<file> [<file> ...]]\n"
|
||
" -c --stdout write to stdout, keep original files\n"
|
||
" --to-stdout\n"
|
||
" -d --decompress uncompress files\n"
|
||
" --uncompress\n"
|
||
" -f --force force overwriting & compress links\n"
|
||
" -h --help display this help\n"
|
||
" -k --keep don't delete input files during operation\n"
|
||
" -n --no-name don't save original file name or time stamp\n"
|
||
" -N --name save or restore original file name and time stamp\n"
|
||
" -q --quiet output no warnings\n"
|
||
... | ... | |
" -1 --fast fastest (worst) compression\n"
|
||
" -2 .. -8 set compression level\n"
|
||
" -9 --best best (slowest) compression\n",
|
||
#else
|
||
,
|
||
#endif
|
||
getprogname());
|
||
exit(0);
|