Annotation of src/usr.bin/ar/archive.h, Revision 1.1.1.1
1.1 deraadt 1: /* $NetBSD: archive.h,v 1.6 1995/03/25 06:39:43 glass Exp $ */
2:
3: /*-
4: * Copyright (c) 1991, 1993, 1994
5: * The Regents of the University of California. All rights reserved.
6: *
7: * This code is derived from software contributed to Berkeley by
8: * Hugh Smith at The University of Guelph.
9: *
10: * Redistribution and use in source and binary forms, with or without
11: * modification, are permitted provided that the following conditions
12: * are met:
13: * 1. Redistributions of source code must retain the above copyright
14: * notice, this list of conditions and the following disclaimer.
15: * 2. Redistributions in binary form must reproduce the above copyright
16: * notice, this list of conditions and the following disclaimer in the
17: * documentation and/or other materials provided with the distribution.
18: * 3. All advertising materials mentioning features or use of this software
19: * must display the following acknowledgement:
20: * This product includes software developed by the University of
21: * California, Berkeley and its contributors.
22: * 4. Neither the name of the University nor the names of its contributors
23: * may be used to endorse or promote products derived from this software
24: * without specific prior written permission.
25: *
26: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
27: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
30: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36: * SUCH DAMAGE.
37: *
38: * @(#)archive.h 8.3 (Berkeley) 4/2/94
39: */
40:
41: /* Ar(1) options. */
42: #define AR_A 0x0001
43: #define AR_B 0x0002
44: #define AR_C 0x0004
45: #define AR_D 0x0008
46: #define AR_M 0x0010
47: #define AR_O 0x0020
48: #define AR_P 0x0040
49: #define AR_Q 0x0080
50: #define AR_R 0x0100
51: #define AR_T 0x0200
52: #define AR_TR 0x0400
53: #define AR_U 0x0800
54: #define AR_V 0x1000
55: #define AR_X 0x2000
56: extern u_int options;
57:
58: /* Set up file copy. */
59: #define SETCF(from, fromname, to, toname, pad) { \
60: cf.rfd = from; \
61: cf.rname = fromname; \
62: cf.wfd = to; \
63: cf.wname = toname; \
64: cf.flags = pad; \
65: }
66:
67: /* File copy structure. */
68: typedef struct {
69: int rfd; /* read file descriptor */
70: char *rname; /* read name */
71: int wfd; /* write file descriptor */
72: char *wname; /* write name */
73: #define NOPAD 0x00 /* don't pad */
74: #define RPAD 0x01 /* pad on reads */
75: #define WPAD 0x02 /* pad on writes */
76: u_int flags; /* pad flags */
77: } CF;
78:
79: /* Header structure internal format. */
80: typedef struct {
81: off_t size; /* size of the object in bytes */
82: time_t date; /* date */
83: int lname; /* size of the long name in bytes */
84: gid_t gid; /* group */
85: uid_t uid; /* owner */
86: u_short mode; /* permissions */
87: char name[MAXNAMLEN + 1]; /* name */
88: } CHDR;
89:
90: /* Header format strings. */
91: #define HDR1 "%s%-13d%-12ld%-6u%-6u%-8o%-10qd%2s"
92: #define HDR2 "%-16.16s%-12ld%-6u%-6u%-8o%-10qd%2s"
93:
94: #define OLDARMAXNAME 15
95: #define HDR3 "%-16.15s%-12ld%-6u%-6u%-8o%-10qd%2s"
96:
97:
98: #include <sys/cdefs.h>
99:
100: struct stat;
101:
102: void close_archive __P((int));
103: void copy_ar __P((CF *, off_t));
104: int get_arobj __P((int));
105: int open_archive __P((int));
106: void put_arobj __P((CF *, struct stat *));
107: void skip_arobj __P((int));