1tar_extract_file(3)             C Library Calls            tar_extract_file(3)
2
3
4

NAME

6       tar_extract_file,       tar_extract_regfile,      tar_extract_hardlink,
7       tar_extract_symlink,     tar_extract_chardev,     tar_extract_blockdev,
8       tar_extract_dir, tar_extract_fifo, tar_skip_regfile, tar_set_file_perms
9       - extract files from a tar archive
10

SYNOPSIS

12       #include <libtar.h>
13
14       int tar_extract_file(TAR *t, char *realname);
15
16       int tar_extract_regfile(TAR *t, char *realname);
17
18       int tar_skip_regfile(TAR *t);
19
20       int tar_extract_dir(TAR *t, char *realname);
21
22       int tar_extract_hardlink(TAR *t, char *realname);
23
24       int tar_extract_symlink(TAR *t, char *realname);
25
26       int tar_extract_blockdev(TAR *t, char *realname);
27
28       int tar_extract_chardev(TAR *t, char *realname);
29
30       int tar_extract_fifo(TAR *t, char *realname);
31
32       int tar_set_file_perms(TAR *t, char *realname);
33

VERSION

35       This man page documents version 1.2 of libtar.
36

DESCRIPTION

38       The tar_extract_file() function  acts  as  a  front-end  to  the  other
39       tar_extract_*() functions.  It checks the current tar header associated
40       with the TAR handle t (which  must  be  initialized  first  by  calling
41       th_read())  to  determine  what  kind of file the header refers to.  It
42       then calls the appropriate tar_extract_*()  function  to  extract  that
43       kind of file.
44
45       The  tar_skip_regfile() function skips over the file content blocks and
46       positions the file pointer at the expected location  of  the  next  tar
47       header block.
48
49       The  tar_set_file_perms() function sets the attributes of the extracted
50       file to match the encoded values.  This includes the  file's  modifica‐
51       tion  time,  mode,  owner,  and  group.  This function is automatically
52       called by tar_extract_file(), but applications  which  call  the  other
53       tar_extract_*()     functions    directly    will    need    to    call
54       tar_set_file_perms() manually if this behavior is desired.
55

RETURN VALUES

57       On successful completion, the functions documented here will return  0.
58       On failure, they will return -1 and set errno to an appropriate value.
59
60       The  tar_extract_dir()  function will return 1 if the directory already
61       exists.
62

ERRORS

64       The tar_extract_file() function will fail if:
65
66       EEXIST If the O_NOOVERWRITE flag is set and the file already exists.
67
68       The tar_extract_*() functions will fail if:
69
70       EINVAL An entry could not be added to the internal file hash.
71
72       EINVAL Less than T_BLOCKSIZE bytes were read from the tar archive.
73
74       EINVAL The current file header associated with t refers to  a  kind  of
75              file other than the one which the called function knows about.
76
77       They  may  also  fail  if any of the following functions fail: mkdir(),
78       write(),  link(),  symlink(),  mknod(),  mkfifo(),  utime(),   chown(),
79       lchown(), chmod(), or lstat().
80

SEE ALSO

82       mkdir(2), write(2), link(2), symlink(2), mknod(2), mkfifo(2), utime(2),
83       chown(2), lchown(2), chmod(2), lstat(2)
84
85
86
87University of Illinois             Jan 2001                tar_extract_file(3)
Impressum