gzip-k.diff

delphij, 09/06/2007 03:17 AM

Download (3.8 KB)

View differences:

gzip.1 6 Sep 2007 03:01:59 -0000
35 35
.Nd compression/decompression tool using Lempel-Ziv coding (LZ77)
36 36
.Sh SYNOPSIS
37 37
.Nm
38
.Op Fl cdfhlNnqrtVv
38
.Op Fl cdfhklNnqrtVv
39 39
.Op Fl S Ar suffix
40 40
.Ar file
41 41
.Oo
......
43 43
.Oc
44 44
.Oc
45 45
.Nm gunzip
46
.Op Fl cfhNqrtVv
46
.Op Fl cfhkNqrtVv
47 47
.Op Fl S Ar suffix
48 48
.Ar file
49 49
.Oo
......
130 130
option, allowing non-compressed data to pass through unchanged.
131 131
.It Fl h , -help
132 132
This option prints a usage summary and exits.
133
.It Fl k , -keep
134
Keep (don't delete) input files during compression
135
or decompression.
133 136
.It Fl l , -list
134 137
This option displays information about the file's compressed and
135 138
uncompressed size, ratio, uncompressed name.
gzip.c 6 Sep 2007 02:59:15 -0000
148 148

  
149 149
#ifndef SMALL
150 150
static	int	fflag;			/* force mode */
151
static	int	kflag;			/* don't delete input files */
151 152
static	int	nflag;			/* don't save name/timestamp */
152 153
static	int	Nflag;			/* don't restore name/timestamp */
153 154
static	int	qflag;			/* quiet mode */
......
224 225
	{ "uncompress",		no_argument,		0,	'd' },
225 226
	{ "force",		no_argument,		0,	'f' },
226 227
	{ "help",		no_argument,		0,	'h' },
228
	{ "keep",		no_argument,		0,	'k' },
227 229
	{ "list",		no_argument,		0,	'l' },
228 230
	{ "no-name",		no_argument,		0,	'n' },
229 231
	{ "name",		no_argument,		0,	'N' },
......
277 279
#ifdef SMALL
278 280
#define OPT_LIST "cdhHltV123456789"
279 281
#else
280
#define OPT_LIST "cdfhHlnNqrS:tvV123456789"
282
#define OPT_LIST "cdfhHklnNqrS:tvV123456789"
281 283
#endif
282 284

  
283 285
	while ((ch = getopt_long(argc, argv, OPT_LIST, longopts, NULL)) != -1) {
......
304 306
		case 'f':
305 307
			fflag = 1;
306 308
			break;
309
		case 'k':
310
			kflag = 1;
311
			break;
307 312
		case 'n':
308 313
			nflag = 1;
309 314
			Nflag = 0;
......
1075 1080
{
1076 1081
	struct stat nsb;
1077 1082

  
1083
	if (kflag)
1084
		return;
1085

  
1078 1086
	if (stat(file, &nsb) != 0)
1079 1087
		/* Must be gone alrady */
1080 1088
		return;
......
1678 1686

  
1679 1687
	path_argv[0] = dir;
1680 1688
	path_argv[1] = 0;
1681
	fts = fts_open(path_argv, FTS_PHYSICAL, NULL);
1689
	fts = fts_open(path_argv, FTS_PHYSICAL | FTS_NOCHDIR, NULL);
1682 1690
	if (fts == NULL) {
1683 1691
		warn("couldn't fts_open %s", dir);
1684 1692
		return;
......
1696 1704
			maybe_warn("%s", entry->fts_path);
1697 1705
			continue;
1698 1706
		case FTS_F:
1699
			handle_file(entry->fts_name, entry->fts_statp);
1707
			handle_file(entry->fts_path, entry->fts_statp);
1700 1708
		}
1701 1709
	}
1702 1710
	(void)fts_close(fts);
......
1846 1854

  
1847 1855
	fprintf(stderr, "%s\n", gzip_version);
1848 1856
	fprintf(stderr,
1849
    "usage: %s [-" OPT_LIST "] [<file> [<file> ...]]\n"
1850
#ifndef SMALL
1857
#ifdef SMALL
1858
    "usage: %s [-" OPT_LIST "] [<file> [<file> ...]]\n",
1859
#else
1860
    "usage: %s [-123456789acdfhklLNnqrtVv] [-S .suffix] [<file> [<file> ...]]\n"
1851 1861
    " -c --stdout          write to stdout, keep original files\n"
1852 1862
    "    --to-stdout\n"
1853 1863
    " -d --decompress      uncompress files\n"
1854 1864
    "    --uncompress\n"
1855 1865
    " -f --force           force overwriting & compress links\n"
1856 1866
    " -h --help            display this help\n"
1867
    " -k --keep            don't delete input files during operation\n"
1857 1868
    " -n --no-name         don't save original file name or time stamp\n"
1858 1869
    " -N --name            save or restore original file name and time stamp\n"
1859 1870
    " -q --quiet           output no warnings\n"
......
1866 1877
    " -1 --fast            fastest (worst) compression\n"
1867 1878
    " -2 .. -8             set compression level\n"
1868 1879
    " -9 --best            best (slowest) compression\n",
1869
#else
1870
    ,
1871 1880
#endif
1872 1881
	    getprogname());
1873 1882
	exit(0);