CPIO(5,F) AIX Technical Reference CPIO(5,F)
-------------------------------------------------------------------------------
cpio
PURPOSE
Describes copy in and out (cpio) archive file.
DESCRIPTION
When the -c flag of the cpio command is not used, the header structure is:
struct {
short
h_magic,
h_dev;
unsigned short
h_ino,
h_mode,
h_uid,
h_gid;
short
h_nlink,
h_rdev,
h_mtime[2],
h_namesize,
h_filesize[2];
char
h_name[n]; /* described below */
} Hdr;
When the cpio command is used with the -c flag, the header for the cpio
structure may be read as:
sscanf(Chdr,"%6ho%6ho%6ho%6ho%6ho%6ho%6ho%6ho%11lo%6ho%11lo%s",
&Hdr.h_magic, &Hdr.h_dev, &Hdr.h_ino, &Hdr.h_mode,
&Hdr.h_uid, &Hdr.h_gid, &Hdr.h_nlink, &Hdr.h_rdev,
&Longtime, &Hdr.h_namesize, &Longfile, &Hdr.h_name);
Longtime and Longfile are equivalent to Hdr.h_mtime and Hdr.h_filesize,
respectively. The contents of each file together with other items describing
the file are recorded in an element of the array of varying length structures.
The member h_magic contains the constant octal 070707 (or 0x71c7). The stat
system call explains the meaning of structure members h_dev through h_mtime.
The length of the null-terminated path name, h_name, including the null byte is
indicated by n, where n = (h_namesize % 2) + h_namesize. In other words, n is
equal to h_namesize if h_namesize is even. If h_namesize is odd, n is equal to
h_namesize + 1.
The last record of the archive always contains the name "TRAILER!!!".
Directories and the trailer are recorded with h_filesize equal to 0.
Processed November 7, 1990 CPIO(5,F) 1
CPIO(5,F) AIX Technical Reference CPIO(5,F)
Directories and special files are treated in a slightly different way. A
directory is written with a 0 size, meaning no data blocks follow. Also, if
the directory is a hidden directory, an @ (at) is appended to the name. A
special file size is also 0; its major/minor device number is stored in the
h_rdev field and its device site number is stored in the h_namesize field.
RELATED INFORMATION
In this book: "scanf, fscanf, sscanf, NLscanf, NLfscanf, NLsscanf, wsscanf"
and "statx, fstatx, stat, fstat, fullstat, ffullstat, lstat."
The cpio and find commands in AIX Operating System Commands Reference.
Processed November 7, 1990 CPIO(5,F) 2