Deleted Added
full compact
compress.c (96770) compress.c (96772)
1/*-
2 * Copyright (c) 1992, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 30 unchanged lines hidden (view full) ---

39
40#if 0
41#ifndef lint
42static char sccsid[] = "@(#)compress.c 8.2 (Berkeley) 1/7/94";
43#endif
44#endif
45
46#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1992, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 30 unchanged lines hidden (view full) ---

39
40#if 0
41#ifndef lint
42static char sccsid[] = "@(#)compress.c 8.2 (Berkeley) 1/7/94";
43#endif
44#endif
45
46#include <sys/cdefs.h>
47__FBSDID("$FreeBSD: head/usr.bin/compress/compress.c 96770 2002-05-17 01:25:51Z tjr $");
47__FBSDID("$FreeBSD: head/usr.bin/compress/compress.c 96772 2002-05-17 01:42:43Z tjr $");
48
49#include <sys/param.h>
50#include <sys/stat.h>
51#include <sys/time.h>
52
53#include <err.h>
54#include <errno.h>
55#include <stdarg.h>

--- 79 unchanged lines hidden (view full) ---

135 }
136
137 if (cat == 1 && argc > 1)
138 errx(1, "the -c option permits only a single file argument");
139
140 for (; *argv; ++argv)
141 switch(style) {
142 case COMPRESS:
48
49#include <sys/param.h>
50#include <sys/stat.h>
51#include <sys/time.h>
52
53#include <err.h>
54#include <errno.h>
55#include <stdarg.h>

--- 79 unchanged lines hidden (view full) ---

135 }
136
137 if (cat == 1 && argc > 1)
138 errx(1, "the -c option permits only a single file argument");
139
140 for (; *argv; ++argv)
141 switch(style) {
142 case COMPRESS:
143 if (cat) {
143 if (strcmp(*argv, "-") == 0) {
144 compress("/dev/stdin", "/dev/stdout", bits);
145 break;
146 } else if (cat) {
144 compress(*argv, "/dev/stdout", bits);
145 break;
146 }
147 if ((p = rindex(*argv, '.')) != NULL &&
148 !strcmp(p, ".Z")) {
149 cwarnx("%s: name already has trailing .Z",
150 *argv);
151 break;

--- 5 unchanged lines hidden (view full) ---

157 }
158 memmove(newname, *argv, len);
159 newname[len] = '.';
160 newname[len + 1] = 'Z';
161 newname[len + 2] = '\0';
162 compress(*argv, newname, bits);
163 break;
164 case DECOMPRESS:
147 compress(*argv, "/dev/stdout", bits);
148 break;
149 }
150 if ((p = rindex(*argv, '.')) != NULL &&
151 !strcmp(p, ".Z")) {
152 cwarnx("%s: name already has trailing .Z",
153 *argv);
154 break;

--- 5 unchanged lines hidden (view full) ---

160 }
161 memmove(newname, *argv, len);
162 newname[len] = '.';
163 newname[len + 1] = 'Z';
164 newname[len + 2] = '\0';
165 compress(*argv, newname, bits);
166 break;
167 case DECOMPRESS:
168 if (strcmp(*argv, "-") == 0) {
169 decompress("/dev/stdin", "/dev/stdout", bits);
170 break;
171 }
165 len = strlen(*argv);
166 if ((p = rindex(*argv, '.')) == NULL ||
167 strcmp(p, ".Z")) {
168 if (len > sizeof(newname) - 3) {
169 cwarnx("%s: name too long", *argv);
170 break;
171 }
172 memmove(newname, *argv, len);

--- 260 unchanged lines hidden ---
172 len = strlen(*argv);
173 if ((p = rindex(*argv, '.')) == NULL ||
174 strcmp(p, ".Z")) {
175 if (len > sizeof(newname) - 3) {
176 cwarnx("%s: name too long", *argv);
177 break;
178 }
179 memmove(newname, *argv, len);

--- 260 unchanged lines hidden ---