logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

tar_append_file, tar_append_eof, tar_append_regfile - append data to tar archives

Description

       The  tar_append_file() function creates a tar file header block describing the file named by the realname
       argument, but with the encoded filename of savename.  It then sets the current header associated with the
       TAR handle t to the newly created header block, and writes this block to the tar archive associated  with
       t.   If  the  file  named  by  realname  is  a  regular  file  (and  is  not  encoded  as  a  hard link),
       tar_append_file() will call tar_append_regfile() to append the contents of the file.

       The tar_append_regfile() function appends the contents of a regular file to the  tar  archive  associated
       with t.  Since this function is called by tar_append_file(), it should only be necessary for applications
       that construct and write the tar file header on their own.

       The  tar_append_eof()  function writes an EOF marker (two blocks of all zeros) to the tar file associated
       with t.

Errors

       The tar_append_*() functions will fail if:

       EINVAL Less than T_BLOCKSIZE bytes were written to the tar archive.

       EINVAL Less than T_BLOCKSIZE bytes were read from the realname file.

       They may also fail if any of the following functions fail: lstat(), malloc(), open(), read(), th_write(),
       or the write function for the file type associated with the TAR handle t.

Name

       tar_append_file, tar_append_eof, tar_append_regfile - append data to tar archives

Return Values

       On successful completion, these functions will return 0.  On failure, they will return -1 and  set  errno
       to an appropriate value.

See Also

read(2), open(2), lstat(2), th_write(3)

University of Illinois                              Jan 2001                                  tar_append_file(3)

Synopsis

#include<libtar.h>inttar_append_file(TAR*t,char*realname,char*savename);inttar_append_regfile(TAR*t,char*realname);inttar_append_eof(TAR*t);

Version

       This man page documents version 1.2 of libtar.

See Also