Commit | Line | Data |
---|---|---|
ada13728 KB |
1 | /*- |
2 | * Copyright (c) 1990 The Regents of the University of California. | |
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 | * | |
5504c5d3 | 8 | * @(#)archive.h 5.4 (Berkeley) %G% |
ada13728 KB |
9 | */ |
10 | ||
11 | /* Ar(1) options. */ | |
12 | #define AR_A 0x0001 | |
13 | #define AR_B 0x0002 | |
14 | #define AR_C 0x0004 | |
15 | #define AR_D 0x0008 | |
16 | #define AR_M 0x0010 | |
17 | #define AR_O 0x0020 | |
18 | #define AR_P 0x0040 | |
19 | #define AR_Q 0x0080 | |
20 | #define AR_R 0x0100 | |
616b39cf KB |
21 | #define AR_S 0x0200 |
22 | #define AR_T 0x0400 | |
23 | #define AR_U 0x0800 | |
24 | #define AR_V 0x1000 | |
25 | #define AR_X 0x2000 | |
ada13728 KB |
26 | extern u_int options; |
27 | ||
28 | /* Set up file copy. */ | |
29 | #define SETCF(from, fromname, to, toname, pad) { \ | |
30 | cf.rfd = from; \ | |
31 | cf.rname = fromname; \ | |
32 | cf.wfd = to; \ | |
33 | cf.wname = toname; \ | |
34 | cf.flags = pad; \ | |
35 | } | |
36 | ||
37 | /* File copy structure. */ | |
38 | typedef struct { | |
39 | int rfd; /* read file descriptor */ | |
40 | char *rname; /* read name */ | |
41 | int wfd; /* write file descriptor */ | |
42 | char *wname; /* write name */ | |
1d913281 | 43 | #define NOPAD 0x00 /* don't pad */ |
ada13728 KB |
44 | #define RPAD 0x01 /* pad on reads */ |
45 | #define WPAD 0x02 /* pad on writes */ | |
46 | u_int flags; /* pad flags */ | |
47 | } CF; | |
48 | ||
49 | /* Header structure internal format. */ | |
50 | typedef struct { | |
1d913281 | 51 | off_t size; /* size of the object in bytes */ |
ada13728 | 52 | long date; /* date */ |
1d913281 | 53 | int lname; /* size of the long name in bytes */ |
ada13728 | 54 | int gid; /* group */ |
ada13728 KB |
55 | int uid; /* owner */ |
56 | u_short mode; /* permissions */ | |
57 | char name[MAXNAMLEN + 1]; /* name */ | |
58 | } CHDR; | |
59 | ||
ada13728 KB |
60 | /* Print out any files that weren't in the archive. */ |
61 | #define ORPHANS { \ | |
62 | if (*argv) { \ | |
63 | eval = 1; \ | |
64 | do { \ | |
65 | (void)fprintf(stderr, \ | |
66 | "ar: %s: not found in archive.\n", *argv); \ | |
67 | } while (*++argv); \ | |
68 | } \ | |
69 | } | |
70 | ||
71 | /* Header format strings. */ | |
72 | #define HDR1 "%s%-13d%-12ld%-6u%-6u%-8o%-10ld%2s" | |
616b39cf | 73 | #define HDR2 "%-16.16s%-12ld%-6u%-6u%-8o%-10ld%2s" |
ada13728 | 74 | |
5504c5d3 KB |
75 | #define OLDARMAXNAME 15 |
76 | #define HDR3 "%-16.15s%-12ld%-6u%-6u%-8o%-10ld%2s" | |
77 | ||
ada13728 KB |
78 | #include <stdlib.h> |
79 | #include <string.h> |