Deleted Added
full compact
ar.c (208189) ar.c (213643)
1/*-
2 * Copyright (c) 2007 Kai Wang
3 * Copyright (c) 2007 Tim Kientzle
4 * Copyright (c) 2007 Joseph Koshy
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

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

54 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
55 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
56 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
57 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
58 * SUCH DAMAGE.
59 */
60
61#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2007 Kai Wang
3 * Copyright (c) 2007 Tim Kientzle
4 * Copyright (c) 2007 Joseph Koshy
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

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

54 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
55 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
56 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
57 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
58 * SUCH DAMAGE.
59 */
60
61#include <sys/cdefs.h>
62__FBSDID("$FreeBSD: head/usr.bin/ar/ar.c 208189 2010-05-17 09:37:59Z kaiw $");
62__FBSDID("$FreeBSD: head/usr.bin/ar/ar.c 213643 2010-10-09 05:31:08Z kientzle $");
63
64#include <sys/queue.h>
65#include <sys/types.h>
66#include <archive.h>
67#include <errno.h>
68#include <getopt.h>
69#include <libgen.h>
70#include <stdio.h>

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

149 bsdar_errc(bsdar, EX_SOFTWARE, errno,
150 "malloc failed");
151 *p = '-';
152 (void)strlcpy(p + 1, argv[1], len - 1);
153 argv[1] = p;
154 }
155 }
156
63
64#include <sys/queue.h>
65#include <sys/types.h>
66#include <archive.h>
67#include <errno.h>
68#include <getopt.h>
69#include <libgen.h>
70#include <stdio.h>

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

149 bsdar_errc(bsdar, EX_SOFTWARE, errno,
150 "malloc failed");
151 *p = '-';
152 (void)strlcpy(p + 1, argv[1], len - 1);
153 argv[1] = p;
154 }
155 }
156
157 while ((opt = getopt_long(argc, argv, "abCcdfijlMmopqrSsTtuVvxz",
157 while ((opt = getopt_long(argc, argv, "abCcdDfijlMmopqrSsTtuVvxz",
158 longopts, NULL)) != -1) {
159 switch(opt) {
160 case 'a':
161 bsdar->options |= AR_A;
162 break;
163 case 'b':
164 case 'i':
165 bsdar->options |= AR_B;
166 break;
167 case 'C':
168 bsdar->options |= AR_CC;
169 break;
170 case 'c':
171 bsdar->options |= AR_C;
172 break;
173 case 'd':
174 set_mode(bsdar, opt);
175 break;
158 longopts, NULL)) != -1) {
159 switch(opt) {
160 case 'a':
161 bsdar->options |= AR_A;
162 break;
163 case 'b':
164 case 'i':
165 bsdar->options |= AR_B;
166 break;
167 case 'C':
168 bsdar->options |= AR_CC;
169 break;
170 case 'c':
171 bsdar->options |= AR_C;
172 break;
173 case 'd':
174 set_mode(bsdar, opt);
175 break;
176 case 'D':
177 bsdar->options |= AR_D;
178 break;
176 case 'f':
177 case 'T':
178 bsdar->options |= AR_TR;
179 break;
180 case 'j':
181 /* ignored */
182 break;
183 case 'l':

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

264 if (bsdar->options & AR_A)
265 only_mode(bsdar, "-a", "mqr");
266 if (bsdar->options & AR_B)
267 only_mode(bsdar, "-b", "mqr");
268 if (bsdar->options & AR_C)
269 only_mode(bsdar, "-c", "qr");
270 if (bsdar->options & AR_CC)
271 only_mode(bsdar, "-C", "x");
179 case 'f':
180 case 'T':
181 bsdar->options |= AR_TR;
182 break;
183 case 'j':
184 /* ignored */
185 break;
186 case 'l':

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

267 if (bsdar->options & AR_A)
268 only_mode(bsdar, "-a", "mqr");
269 if (bsdar->options & AR_B)
270 only_mode(bsdar, "-b", "mqr");
271 if (bsdar->options & AR_C)
272 only_mode(bsdar, "-c", "qr");
273 if (bsdar->options & AR_CC)
274 only_mode(bsdar, "-C", "x");
275 if (bsdar->options & AR_D)
276 only_mode(bsdar, "-D", "qr");
272 if (bsdar->options & AR_O)
273 only_mode(bsdar, "-o", "x");
274 if (bsdar->options & AR_SS)
275 only_mode(bsdar, "-S", "mqr");
276 if (bsdar->options & AR_U)
277 only_mode(bsdar, "-u", "qrx");
278
279 if (bsdar->mode == 'M') {

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

351static void
352bsdar_usage(void)
353{
354
355 (void)fprintf(stderr, "usage: ar -d [-Tjsvz] archive file ...\n");
356 (void)fprintf(stderr, "\tar -m [-Tjsvz] archive file ...\n");
357 (void)fprintf(stderr, "\tar -m [-Tabijsvz] position archive file ...\n");
358 (void)fprintf(stderr, "\tar -p [-Tv] archive [file ...]\n");
277 if (bsdar->options & AR_O)
278 only_mode(bsdar, "-o", "x");
279 if (bsdar->options & AR_SS)
280 only_mode(bsdar, "-S", "mqr");
281 if (bsdar->options & AR_U)
282 only_mode(bsdar, "-u", "qrx");
283
284 if (bsdar->mode == 'M') {

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

356static void
357bsdar_usage(void)
358{
359
360 (void)fprintf(stderr, "usage: ar -d [-Tjsvz] archive file ...\n");
361 (void)fprintf(stderr, "\tar -m [-Tjsvz] archive file ...\n");
362 (void)fprintf(stderr, "\tar -m [-Tabijsvz] position archive file ...\n");
363 (void)fprintf(stderr, "\tar -p [-Tv] archive [file ...]\n");
359 (void)fprintf(stderr, "\tar -q [-Tcjsvz] archive file ...\n");
360 (void)fprintf(stderr, "\tar -r [-Tcjsuvz] archive file ...\n");
361 (void)fprintf(stderr, "\tar -r [-Tabcijsuvz] position archive file ...\n");
364 (void)fprintf(stderr, "\tar -q [-TcDjsvz] archive file ...\n");
365 (void)fprintf(stderr, "\tar -r [-TcDjsuvz] archive file ...\n");
366 (void)fprintf(stderr, "\tar -r [-TabcDijsuvz] position archive file ...\n");
362 (void)fprintf(stderr, "\tar -s [-jz] archive\n");
363 (void)fprintf(stderr, "\tar -t [-Tv] archive [file ...]\n");
364 (void)fprintf(stderr, "\tar -x [-CTouv] archive [file ...]\n");
365 (void)fprintf(stderr, "\tar -V\n");
366 exit(EX_USAGE);
367}
368
369static void

--- 21 unchanged lines hidden ---
367 (void)fprintf(stderr, "\tar -s [-jz] archive\n");
368 (void)fprintf(stderr, "\tar -t [-Tv] archive [file ...]\n");
369 (void)fprintf(stderr, "\tar -x [-CTouv] archive [file ...]\n");
370 (void)fprintf(stderr, "\tar -V\n");
371 exit(EX_USAGE);
372}
373
374static void

--- 21 unchanged lines hidden ---