1 /*- 2 * Copyright (c) 1991, 1993, 1994 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Hugh Smith at The University of Guelph. 7 * 8 * %sccs.include.redist.c% 9 * 10 * @(#)archive.h 8.3 (Berkeley) 04/02/94 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 23 #define AR_T 0x0200 24 #define AR_TR 0x0400 25 #define AR_U 0x0800 26 #define AR_V 0x1000 27 #define AR_X 0x2000 28 extern 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. */ 40 typedef struct { 41 int rfd; /* read file descriptor */ 42 char *rname; /* read name */ 43 int wfd; /* write file descriptor */ 44 char *wname; /* write name */ 45 #define NOPAD 0x00 /* don't pad */ 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. */ 52 typedef struct { 53 off_t size; /* size of the object in bytes */ 54 long date; /* date */ 55 int lname; /* size of the long name in bytes */ 56 int gid; /* group */ 57 int uid; /* owner */ 58 u_short mode; /* permissions */ 59 char name[MAXNAMLEN + 1]; /* name */ 60 } CHDR; 61 62 /* Header format strings. */ 63 #define HDR1 "%s%-13d%-12ld%-6u%-6u%-8o%-10qd%2s" 64 #define HDR2 "%-16.16s%-12ld%-6u%-6u%-8o%-10qd%2s" 65 66 #define OLDARMAXNAME 15 67 #define HDR3 "%-16.15s%-12ld%-6u%-6u%-8o%-10qd%2s" 68 69 70 #include <sys/cdefs.h> 71 72 struct stat; 73 74 void close_archive __P((int)); 75 void copy_ar __P((CF *, off_t)); 76 int get_arobj __P((int)); 77 int open_archive __P((int)); 78 void put_arobj __P((CF *, struct stat *)); 79 void skip_arobj __P((int)); 80