ar.h (0c099281) ar.h (d192f3d3)
1/*-
2 * Copyright (c) 2007 Kai Wang
3 * 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

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

21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 *
26 * $FreeBSD$
27 */
28
1/*-
2 * Copyright (c) 2007 Kai Wang
3 * 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

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

21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 *
26 * $FreeBSD$
27 */
28
29#define BSDAR_VERSION "1.1.0"
30
31/*
32 * ar(1) options.
33 */
34#define AR_A 0x0001 /* position-after */
35#define AR_B 0x0002 /* position-before */
36#define AR_C 0x0004 /* creating new archive */
37#define AR_CC 0x0008 /* do not overwrite when extracting */
38#define AR_J 0x0010 /* bzip2 compression */

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

49/*
50 * Convenient wrapper for general libarchive error handling.
51 */
52#define AC(CALL) do { \
53 if ((CALL)) \
54 bsdar_errc(bsdar, EX_SOFTWARE, 0, "%s", \
55 archive_error_string(a)); \
56} while (0)
29/*
30 * ar(1) options.
31 */
32#define AR_A 0x0001 /* position-after */
33#define AR_B 0x0002 /* position-before */
34#define AR_C 0x0004 /* creating new archive */
35#define AR_CC 0x0008 /* do not overwrite when extracting */
36#define AR_J 0x0010 /* bzip2 compression */

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

47/*
48 * Convenient wrapper for general libarchive error handling.
49 */
50#define AC(CALL) do { \
51 if ((CALL)) \
52 bsdar_errc(bsdar, EX_SOFTWARE, 0, "%s", \
53 archive_error_string(a)); \
54} while (0)
57
55
58/*
59 * In-memory representation of archive member(object).
60 */
61struct ar_obj {
62 char *name; /* member name */
63 void *maddr; /* mmap start address */
64 uid_t uid; /* user id */
65 gid_t gid; /* group id */
66 mode_t md; /* octal file permissions */
67 size_t size; /* member size */
68 time_t mtime; /* modification time */
69 int fd; /* file descriptor */
70 dev_t dev; /* inode's device */
71 ino_t ino; /* inode's number */
72
73 TAILQ_ENTRY(ar_obj) objs;
74};
75
76/*
56/*
57 * In-memory representation of archive member(object).
58 */
59struct ar_obj {
60 char *name; /* member name */
61 void *maddr; /* mmap start address */
62 uid_t uid; /* user id */
63 gid_t gid; /* group id */
64 mode_t md; /* octal file permissions */
65 size_t size; /* member size */
66 time_t mtime; /* modification time */
67 int fd; /* file descriptor */
68 dev_t dev; /* inode's device */
69 ino_t ino; /* inode's number */
70
71 TAILQ_ENTRY(ar_obj) objs;
72};
73
74/*
77 * Structure encapsulates the "global" data for "ar" program.
75 * Structure encapsulates the "global" data for "ar" program.
78 */
79struct bsdar {
80 const char *filename; /* archive name. */
76 */
77struct bsdar {
78 const char *filename; /* archive name. */
81 const char *addlib; /* target of ADDLIB. */
82 const char *posarg; /* position arg for modifiers -a, -b. */
83 char mode; /* program mode */
84 char compression; /* compression mode */
85 int options; /* command line options */
86
87 const char *progname; /* program name */
88 int argc;
89 char **argv;

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

111};
112
113void bsdar_errc(struct bsdar *, int _eval, int _code,
114 const char *fmt, ...);
115void bsdar_warnc(struct bsdar *, int _code, const char *fmt, ...);
116void ar_mode_d(struct bsdar *bsdar);
117void ar_mode_m(struct bsdar *bsdar);
118void ar_mode_p(struct bsdar *bsdar);
79 const char *posarg; /* position arg for modifiers -a, -b. */
80 char mode; /* program mode */
81 char compression; /* compression mode */
82 int options; /* command line options */
83
84 const char *progname; /* program name */
85 int argc;
86 char **argv;

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

108};
109
110void bsdar_errc(struct bsdar *, int _eval, int _code,
111 const char *fmt, ...);
112void bsdar_warnc(struct bsdar *, int _code, const char *fmt, ...);
113void ar_mode_d(struct bsdar *bsdar);
114void ar_mode_m(struct bsdar *bsdar);
115void ar_mode_p(struct bsdar *bsdar);
119void ar_mode_q(struct bsdar *bsdar);
120void ar_mode_r(struct bsdar *bsdar);
121void ar_mode_s(struct bsdar *bsdar);
122void ar_mode_t(struct bsdar *bsdar);
123void ar_mode_x(struct bsdar *bsdar);
116void ar_mode_r(struct bsdar *bsdar);
117void ar_mode_s(struct bsdar *bsdar);
118void ar_mode_t(struct bsdar *bsdar);
119void ar_mode_x(struct bsdar *bsdar);
124void ar_mode_A(struct bsdar *bsdar);
125void ar_mode_script(struct bsdar *ar);