1tar_append_file(3) C Library Calls tar_append_file(3)
2
3
4
6 tar_append_file, tar_append_eof, tar_append_regfile - append data to
7 tar archives
8
10 #include <libtar.h>
11
12 int tar_append_file(TAR *t, char *realname, char *savename);
13
14 int tar_append_regfile(TAR *t, char *realname);
15
16 int tar_append_eof(TAR *t);
17
19 This man page documents version 1.2 of libtar.
20
22 The tar_append_file() function creates a tar file header block describ‐
23 ing the file named by the realname argument, but with the encoded file‐
24 name of savename. It then sets the current header associated with the
25 TAR handle t to the newly created header block, and writes this block
26 to the tar archive associated with t. If the file named by realname is
27 a regular file (and is not encoded as a hard link), tar_append_file()
28 will call tar_append_regfile() to append the contents of the file.
29
30 The tar_append_regfile() function appends the contents of a regular
31 file to the tar archive associated with t. Since this function is
32 called by tar_append_file(), it should only be necessary for applica‐
33 tions that construct and write the tar file header on their own.
34
35 The tar_append_eof() function writes an EOF marker (two blocks of all
36 zeros) to the tar file associated with t.
37
39 On successful completion, these functions will return 0. On failure,
40 they will return -1 and set errno to an appropriate value.
41
43 The tar_append_*() functions will fail if:
44
45 EINVAL Less than T_BLOCKSIZE bytes were written to the tar archive.
46
47 EINVAL Less than T_BLOCKSIZE bytes were read from the realname file.
48
49 They may also fail if any of the following functions fail: lstat(),
50 malloc(), open(), read(), th_write(), or the write function for the
51 file type associated with the TAR handle t.
52
54 read(2), open(2), lstat(2), th_write(3)
55
56
57
58University of Illinois Jan 2001 tar_append_file(3)