tar_append_file

Section: C Library Calls (3)
Updated: Jan 2001
Page Index
 

NAME

tar_append_file, tar_append_eof, tar_append_regfile - append data to tar archives  

SYNOPSIS

#include <libtar.h>

int tar_append_file(TAR *t, char *realname, char *savename);

int tar_append_regfile(TAR *t, char *realname);

int tar_append_eof(TAR *t);  

VERSION

This man page documents version 1.2 of libtar.  

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.  

RETURN VALUES

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

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.  

SEE ALSO

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


 

Index

NAME
SYNOPSIS
VERSION
DESCRIPTION
RETURN VALUES
ERRORS
SEE ALSO