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 * 8 * @(#)archive.h 5.6 (Berkeley) 03/12/91 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 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 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 */ 43 #define NOPAD 0x00 /* don't pad */ 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 { 51 off_t size; /* size of the object in bytes */ 52 long date; /* date */ 53 int lname; /* size of the long name in bytes */ 54 int gid; /* group */ 55 int uid; /* owner */ 56 u_short mode; /* permissions */ 57 char name[MAXNAMLEN + 1]; /* name */ 58 } CHDR; 59 60 /* Header format strings. */ 61 #define HDR1 "%s%-13d%-12ld%-6u%-6u%-8o%-10ld%2s" 62 #define HDR2 "%-16.16s%-12ld%-6u%-6u%-8o%-10ld%2s" 63 64 #define OLDARMAXNAME 15 65 #define HDR3 "%-16.15s%-12ld%-6u%-6u%-8o%-10ld%2s" 66 67 68 #include <sys/cdefs.h> 69 70 __BEGIN_DECLS 71 void close_archive __P((int)); 72 void skip_arobj __P((int)); 73 int copy_ar __P((CF *, off_t)); 74 int get_arobj __P((int)); 75 int open_archive __P((int)); 76 struct stat; 77 int put_arobj __P((CF *, struct stat *)); 78 __END_DECLS 79 80