'\"macro stdmacro
.if n .pH g3e.elf_getarhdr @(#)elf_getarhdr	40.9 of 10/27/89
.\" Copyright 1989 AT&T
.\"#ident	"@(#)ci5-doc:req/libelf/getarhdr.man	1.3"
.nr X
.if \nX=0 .ds x} elf_getarhdr 3E "ELF Library" "\&"
.if \nX=1 .ds x} elf_getarhdr 3E "ELF Library"
.if \nX=2 .ds x} elf_getarhdr 3E "" "\&"
.if \nX=3 .ds x} elf_getarhdr "" "" "\&"
.TH \*(x}
.SH NAME
\f4elf_getarhdr\f1 \- retrieve archive member header
.SH SYNOPSIS
\f4cc\f1
[\f2flag\fP \|.\|.\|.] \f2file\fP \|.\|.\|.
\f4\-lelf\f1
[\f2library\fP \|.\|.\|.]
.PP
.nf
.na
.ft 4
#include <libelf.h>
.sp 0.5
Elf_Arhdr \(**elf_getarhdr(Elf \(**elf);
.ft 1
.ad
.fi
.SH DESCRIPTION
\f4elf_getarhdr\fP
returns a pointer to an archive member header,
if one is available for the
.SM ELF
descriptor
.IR elf .
Otherwise, no archive member header exists,
an error occurred, or
.I elf
was null;
\f4elf_getarhdr\fP
then returns a null value.
The header includes the following members.
.P
.RS .5i
.DT
.nf
.ft 4
.ta 8u*\w' 'u +8u*\w' 'u +8u*\w' 'u +8u*\w' 'u +8u*\w' 'u +8u*\w' 'u
.ne 6
	char		\(**ar_name;
	time_t		ar_date;
	long		ar_uid;
	long		ar_gid;
	unsigned long	ar_mode;
	off_t		ar_size;
	char		\(**ar_rawname;
.fi
.RE
.P
An archive member name, available through \f4ar_name\fP,
is a null-terminated string, with the
\f4ar\fP
format control characters removed.
The \f4ar_rawname\fP member holds a null-terminated string
that represents the original name bytes in the file, including
the terminating slash and trailing blanks as specified in
the archive format.
.P
In addition to ``regular'' archive members, the archive
format defines some special members.
All special member names begin with a slash (\f4/\fP),
distinguishing them from regular members (whose names
may not contain a slash).
These special members have the names (\f4ar_name\fP) defined below.
.IP \f4/\fP 8
This is the archive symbol table.
If present, it will be the first archive member.
A program may access the archive symbol table through
\f4elf_getarsym\fP.
The information in the symbol table is useful for
random archive processing [see
\f4elf_rand\fP(3E)].
.IP \f4//\fP
This member, if present, holds a string table for
long archive member names.
An archive member's header contains a 16-byte area
for the name, which may be exceeded in some file systems.
The library automatically retrieves long member names
from the string table, setting \f4ar_name\fP
to the appropriate value.
.P
Under some error conditions, a member's name might not be
available.
Although this causes the library to set \f4ar_name\fP to a null pointer,
the \f4ar_rawname\fP member will be set as usual.
.SH "SEE ALSO"
.na
\f4elf\fP(3E),
\f4elf_begin\fP(3E),
\f4elf_getarsym\fP(3E),
\f4elf_rand\fP(3E),
\f4ar\fP(4).
