st_size is now a quad, st_mtime is now a timespec
[unix-history] / usr / src / usr.bin / ar / archive.h
CommitLineData
ada13728 1/*-
de57e398 2 * Copyright (c) 1991 The Regents of the University of California.
ada13728
KB
3 * All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Hugh Smith at The University of Guelph.
7 *
de57e398
KB
8 * %sccs.include.redist.c%
9 *
6a8fdfdd 10 * @(#)archive.h 5.9 (Berkeley) %G%
ada13728
KB
11 */
12
13/* Ar(1) options. */
14#define AR_A 0x0001
15#define AR_B 0x0002
16#define AR_C 0x0004
17#define AR_D 0x0008
18#define AR_M 0x0010
19#define AR_O 0x0020
20#define AR_P 0x0040
21#define AR_Q 0x0080
22#define AR_R 0x0100
4f81e05f
KB
23#define AR_T 0x0200
24#define AR_TR 0x0400
616b39cf
KB
25#define AR_U 0x0800
26#define AR_V 0x1000
27#define AR_X 0x2000
ada13728
KB
28extern u_int options;
29
30/* Set up file copy. */
31#define SETCF(from, fromname, to, toname, pad) { \
32 cf.rfd = from; \
33 cf.rname = fromname; \
34 cf.wfd = to; \
35 cf.wname = toname; \
36 cf.flags = pad; \
37}
38
39/* File copy structure. */
40typedef struct {
41 int rfd; /* read file descriptor */
42 char *rname; /* read name */
43 int wfd; /* write file descriptor */
44 char *wname; /* write name */
1d913281 45#define NOPAD 0x00 /* don't pad */
ada13728
KB
46#define RPAD 0x01 /* pad on reads */
47#define WPAD 0x02 /* pad on writes */
48 u_int flags; /* pad flags */
49} CF;
50
51/* Header structure internal format. */
52typedef struct {
1d913281 53 off_t size; /* size of the object in bytes */
ada13728 54 long date; /* date */
1d913281 55 int lname; /* size of the long name in bytes */
ada13728 56 int gid; /* group */
ada13728
KB
57 int uid; /* owner */
58 u_short mode; /* permissions */
59 char name[MAXNAMLEN + 1]; /* name */
60} CHDR;
61
ada13728 62/* Header format strings. */
6a8fdfdd
KB
63#define HDR1 "%s%-13d%-12ld%-6u%-6u%-8o%-10qd%2s"
64#define HDR2 "%-16.16s%-12ld%-6u%-6u%-8o%-10qd%2s"
ada13728 65
5504c5d3 66#define OLDARMAXNAME 15
6a8fdfdd 67#define HDR3 "%-16.15s%-12ld%-6u%-6u%-8o%-10qd%2s"
5504c5d3 68
24136810
KB
69
70#include <sys/cdefs.h>
71
72__BEGIN_DECLS
73void close_archive __P((int));
ce478bb7
KB
74void skip_arobj __P((int));
75int copy_ar __P((CF *, off_t));
76int get_arobj __P((int));
24136810
KB
77int open_archive __P((int));
78struct stat;
ce478bb7 79int put_arobj __P((CF *, struct stat *));
24136810
KB
80__END_DECLS
81