www.LinuxHowtos.org





ARCHIVE_UTIL

Section: C Library Functions (3)
Index Return to Main Contents

BSD mandoc
 

NAME

archive_clear_error archive_compression archive_compression_name archive_copy_error archive_errno archive_error_string archive_file_count archive_filter_code archive_filter_count archive_filter_name archive_format archive_format_name archive_position archive_set_error - libarchive utility functions  

LIBRARY

Streaming Archive Library (libarchive, -larchive)  

SYNOPSIS

In archive.h Ft void Fn archive_clear_error struct archive * Ft int Fn archive_compression struct archive * Ft const char * Fn archive_compression_name struct archive * Ft void Fn archive_copy_error struct archive * struct archive * Ft int Fn archive_errno struct archive * Ft const char * Fn archive_error_string struct archive * Ft int Fn archive_file_count struct archive * Ft int Fn archive_filter_code struct archive * int Ft int Fn archive_filter_count struct archive * int Ft const char * Fn archive_filter_name struct archive * int Ft int Fn archive_format struct archive * Ft const char * Fn archive_format_name struct archive * Ft int64_t Fn archive_position struct archive * int Ft void Fo archive_set_error Fa struct archive * Fa int error_code Fa const char *fmt Fa ... Fc  

DESCRIPTION

These functions provide access to various information about the struct archive object used in the libarchive(3) library.

Fn archive_clear_error
Clears any error information left over from a previous call. Not generally used in client code.
Fn archive_compression
Synonym for Fn archive_filter_code(a, 0) .
Fn archive_compression_name
Synonym for Fn archive_filter_name(a, 0) .
Fn archive_copy_error
Copies error information from one archive to another.
Fn archive_errno
Returns a numeric error code (see errno(2)) indicating the reason for the most recent error return. Note that this can not be reliably used to detect whether an error has occurred. It should be used only after another libarchive function has returned an error status.
Fn archive_error_string
Returns a textual error message suitable for display. The error message here is usually more specific than that obtained from passing the result of Fn archive_errno to strerror(3).
Fn archive_file_count
Returns a count of the number of files processed by this archive object. The count is incremented by calls to archive_write_header3 or archive_read_next_header3.
Fn archive_filter_code
Returns a numeric code identifying the indicated filter. See Fn archive_filter_count for details of the numbering.
Fn archive_filter_count
Returns the number of filters in the current pipeline. For read archive handles, these filters are added automatically by the automatic format detection. For write archive handles, these filters are added by calls to the various Fn archive_write_add_filter_XXX functions. Filters in the resulting pipeline are numbered so that filter 0 is the filter closest to the format handler. As a convenience, functions that expect a filter number will accept -1 as a synonym for the highest-numbered filter.

For example, when reading a uuencoded gzipped tar archive, there are three filters: filter 0 is the gunzip filter, filter 1 is the uudecode filter, and filter 2 is the pseudo-filter that wraps the archive read functions. In this case, requesting Fn archive_position(a, -1) would be a synonym for Fn archive_position(a, 2) which would return the number of bytes currently read from the archive, while Fn archive_position(a, 1) would return the number of bytes after uudecoding, and Fn archive_position(a, 0) would return the number of bytes after decompression.

Fn archive_filter_name
Returns a textual name identifying the indicated filter. See Fn archive_filter_count for details of the numbering.
Fn archive_format
Returns a numeric code indicating the format of the current archive entry. This value is set by a successful call to Fn archive_read_next_header . Note that it is common for this value to change from entry to entry. For example, a tar archive might have several entries that utilize GNU tar extensions and several entries that do not. These entries will have different format codes.
Fn archive_format_name
A textual description of the format of the current entry.
Fn archive_position
Returns the number of bytes read from or written to the indicated filter. In particular, Fn archive_position(a, 0) returns the number of bytes read or written by the format handler, while Fn archive_position(a, -1) returns the number of bytes read or written to the archive. See Fn archive_filter_count for details of the numbering here.
Fn archive_set_error
Sets the numeric error code and error description that will be returned by Fn archive_errno and Fn archive_error_string . This function should be used within I/O callbacks to set system-specific error codes and error descriptions. This function accepts a printf-like format string and arguments. However, you should be careful to use only the following printf format specifiers: ``%c'' ``%d'' ``%jd'' ``%jo'' ``%ju'' ``%jx'' ``%ld'' ``%lo'' ``%lu'' ``%lx'' ``%o'' ``%u'' ``%s'' ``%x'' ``%%'' Field-width specifiers and other printf features are not uniformly supported and should not be used.

 

SEE ALSO

archive_read3, archive_write3, libarchive(3), printf(3)  

HISTORY

The libarchive library first appeared in Fx 5.3 .  

AUTHORS

An -nosplit The libarchive library was written by An Tim Kientzle Aq kientzle@acm.org .


 

Index

NAME
LIBRARY
SYNOPSIS
DESCRIPTION
SEE ALSO
HISTORY
AUTHORS