|
|
1.1 root 1: struct tarbuf {
2: char name[100]; /* strncpy format */
3: char mode[8]; /* octal NUL-terminated */
4: char uid[8]; /* octal */
5: char gid[8]; /* octal */
6: char size[12]; /* octal */
7: char mtime[12]; /* octal */
8: char chksum[8]; /* octal sum of header bytes; set to
9: blanks while computing chksum */
10: char typeflag[1]; /* see below */
11: char linkname[100]; /* strncpy */
12: char magic[6]; /* see below */
13: char version[2]; /* see below */
14: char uname[32]; /* strcpy format */
15: char gname[32]; /* strcpy */
16: char devmajor[8]; /* octal */
17: char devminor[8]; /* octal */
18: char prefix[155]; /* strncpy */
19: char zeropad[12];
20: };
21:
22: #define TSIZE (sizeof (struct tarbuf))
23:
24: #define TMAGIC "ustar" /* ustar\0 */
25: #define TMAGLEN 6
26: #define TVERSION "00" /* strncpy, n == 2 */
27: #define TVERSLEN 2
28:
29: /* typeflag values */
30: #define AREGTYPE '\0' /* historical regular file */
31: #define REGTYPE '0' /* regular file */
32: #define LNKTYPE '1' /* hard link */
33: #define SYMTYPE '2' /* reserved (symbolic link) */
34: #define CHRTYPE '3' /* character special */
35: #define BLKTYPE '4' /* block special */
36: #define DIRTYPE '5' /* directory */
37: #define FIFOTYPE '6' /* fifo special */
38: #define CONTTYPE '7' /* reserved (socket?) */
39:
40: /* mode bits */
41: #define TSUID 04000 /* set user id on execution */
42: #define TSGID 02000 /* set group id on execution */
43: #define TSVTX 01000 /* reserved */
44: #define TUREAD 00400 /* read by owner */
45: #define TUWRITE 00200 /* write by owner */
46: #define TUEXEC 00100 /* exec/search by owner */
47: #define TGREAD 00040 /* read by group */
48: #define TGWRITE 00020 /* write by group */
49: #define TGEXEC 00010 /* exec/search by group */
50: #define TOREAD 00004 /* read by other */
51: #define TOWRITE 00002 /* write by other */
52: #define TOEXEC 00001 /* exec/search by other */
53: #define TMASK 07777 /* mask of all bits (not in POSIX) */
54:
55: #define TNAMEMAX 256
56: #define TLINKMAX 100
57: #define TUGNAMEMAX 31
58:
59: /* incore equivalent of a tar buffer */
60: struct tarhdr {
61: char name[TNAMEMAX + 1];
62: int mode;
63: int uid;
64: int gid;
65: long size;
66: time_t mtime;
67: char typeflag;
68: char linkname[TLINKMAX + 1];
69: char uname[TUGNAMEMAX + 1];
70: char gname[TUGNAMEMAX + 1];
71: int devmajor;
72: int devminor;
73: };
74:
75: extern int thdrget(struct tarhdr *hdr, struct tarbuf *buf);
76: extern int thdrput(struct tarbuf *buf, struct tarhdr *hdr);
77:
78: /* stuff the user needs to provide */
79: extern int gidnum(char *);
80: extern char *gidstr(int);
81: extern int uidnum(char *);
82: extern char *uidstr(int);
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.