Merge from vendor branch LIBSTDC++:
[dragonfly.git] / contrib / cpio / cpiohdr.h
1 /* Extended cpio header from POSIX.1.
2    Copyright (C) 1992 Free Software Foundation, Inc.
3
4    This program is free software; you can redistribute it and/or modify
5    it under the terms of the GNU General Public License as published by
6    the Free Software Foundation; either version 2, or (at your option)
7    any later version.
8
9    This program is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12    GNU General Public License for more details.
13
14    You should have received a copy of the GNU General Public License
15    along with this program; if not, write to the Free Software
16    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
17
18 #ifndef _CPIOHDR_H
19
20 #define _CPIOHDR_H 1
21
22 #include <cpio.h>
23
24 struct old_cpio_header
25 {
26   unsigned short c_magic;
27   short c_dev;
28   unsigned short c_ino;
29   unsigned short c_mode;
30   unsigned short c_uid;
31   unsigned short c_gid;
32   unsigned short c_nlink;
33   short c_rdev;
34   unsigned short c_mtimes[2];
35   unsigned short c_namesize;
36   unsigned short c_filesizes[2];
37   unsigned long c_mtime;        /* Long-aligned copy of `c_mtimes'. */
38   unsigned long c_filesize;     /* Long-aligned copy of `c_filesizes'. */
39   char *c_name;
40 };
41
42 /* "New" portable format and CRC format:
43
44    Each file has a 110 byte header,
45    a variable length, NUL terminated filename,
46    and variable length file data.
47    A header for a filename "TRAILER!!!" indicates the end of the archive.  */
48
49 /* All the fields in the header are ISO 646 (approximately ASCII) strings
50    of hexadecimal numbers, left padded, not NUL terminated.
51
52    Field Name   Length in Bytes Notes
53    c_magic      6               "070701" for "new" portable format
54                                 "070702" for CRC format
55    c_ino        8
56    c_mode       8
57    c_uid        8
58    c_gid        8
59    c_nlink      8
60    c_mtime      8
61    c_filesize   8               must be 0 for FIFOs and directories
62    c_maj        8
63    c_min        8
64    c_rmaj       8               only valid for chr and blk special files
65    c_rmin       8               only valid for chr and blk special files
66    c_namesize   8               count includes terminating NUL in pathname
67    c_chksum     8               0 for "new" portable format; for CRC format
68                                 the sum of all the bytes in the file  */
69
70 struct new_cpio_header
71 {
72   unsigned short c_magic;
73   unsigned long c_ino;
74   unsigned long c_mode;
75   unsigned long c_uid;
76   unsigned long c_gid;
77   unsigned long c_nlink;
78   unsigned long c_mtime;
79   unsigned long c_filesize;
80   long c_dev_maj;
81   long c_dev_min;
82   long c_rdev_maj;
83   long c_rdev_min;
84   unsigned long c_namesize;
85   unsigned long c_chksum;
86   char *c_name;
87   char *c_tar_linkname;
88 };
89
90 #endif /* cpiohdr.h */