From owner-freebsd-questions Tue Dec 12 04:36:51 1995 Return-Path: owner-questions Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id EAA09820 for questions-outgoing; Tue, 12 Dec 1995 04:36:51 -0800 (PST) Received: from mramirez.sy.yale.edu (mramirez.sy.yale.edu [130.132.57.207]) by freefall.freebsd.org (8.7.3/8.7.3) with SMTP id EAA09815 for ; Tue, 12 Dec 1995 04:36:46 -0800 (PST) Received: (from mrami@localhost) by mramirez.sy.yale.edu (8.6.12/8.6.9) id HAA00971; Tue, 12 Dec 1995 07:34:01 -0500 Date: Tue, 12 Dec 1995 07:34:00 -0500 (EST) From: Marc Ramirez Reply-To: mrami@minerva.cis.yale.edu To: M C Wong cc: freebsd-questions@freefall.freebsd.org Subject: Re: tar In-Reply-To: <199512120032.AA010738367@hp.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-questions@FreeBSD.ORG Precedence: bulk On Tue, 12 Dec 1995, M C Wong wrote: > Where can I find the higher level description of tar format (tar header and > etc) files ? I need to understand the format briefly without diving into > the code immediately. I will have to implement extraction from a tar > file (not directly from the tape device at all at any time). For some reason, there is no tar(5). Anyway, the format is (taken from tar(5) in my O'Reilly): #define TBLOCK 512 #define NAMSIZ 100 union hblock { char dummy[TBLOCK]; struct header { char name[NAMSIZ]; char mode[8]; char uid[8]; char gid[8]; char size[12]; char mtime[12]; char cksum[8]; char linkflag; char linkname[NAMSIZ]; } dbuf; } 'name' and 'linkname' are null-terminated strings, and the rest are zero-filled octal numbers in ASCII representation. 'uid' and 'gid' are the uid and gid, 'size' is the size in bytes, 'mtime' is the last modification time. 'cksum' is the sum of all the bytes in the header block. When computing 'cksum', it is assumed the field contains all blanks [sic]. 'linkflag' is NULL if the file is a normal file, ASCII '1' if it is a hard link, and '2' if it is a symbolic link. The name of the file linked to is contained in 'linkname'. The first time a particular i-node is dumped, it is dumped as a regular file. All subsequent times, it is sumped as a link instead. Marc.