Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ fgetarhdr(3C) — UTek 3.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

ar(1)

open(2)

fopen(3s)

ar(5)

oldar(5)



GETARHDR(3C)            COMMAND REFERENCE            GETARHDR(3C)



NAME
     getarhdr, fgetarhdr - read archive header

SYNOPSIS
     #include <ar.h>
     int getarhdr(fd, header)
     int fd;
     struct arhdr *header;

     #include <stdio.h>
     #include <ar.h>
     int fgetarhdr(fp, header);
     FILE *fp;
     struct arhdr *header;

DESCRIPTION
     The subroutine getarhdr reads the archive header from the
     file whose descriptor is fd and places this information in
     the structure pointed to by header. The value returned is
     the length of the name field in the archive file, including
     slashes and padding, except when there is a problem or end-
     of-file is reached (see RETURN VALUE).  The subroutine
     fgetarhdr is similar, except that it takes a FILE pointer
     instead of a file descriptor.

     The name field is terminated by a null.  This means that by
     using fgetarhdr or getarhdr, filenames with imbedded spaces
     can be handled correctly.

     The subroutine is needed because the archive format supports
     long filenames by surrounding them by slashes instead of
     making the name field longer.  This means that it is no
     longer possible to read the entire header into a structure
     with a single read.  See ar(1) and ar(5) for more
     information on the archive format.

EXAMPLES
     A typical program that reads archive files would read and
     check the magic number and use getarhdr to get the header
     for each member of the archive file.

DIAGNOSTICS
     Getarhdr and fgetarhdr return 0 on end-of-file and -1 when
     the archive file is malformed.

CAVEATS
     Files opened via fopen(3s) should use fgetarhdr, especially
     if seeks are performed.

     The file is expected to be an archive file, but it can be
     either a long or short format file (see ar(5) ).




Printed 5/12/88                                                 1





GETARHDR(3C)            COMMAND REFERENCE            GETARHDR(3C)



SEE ALSO
     ar(1), open(2), fopen(3s), ar(5), and oldar(5).





















































Printed 5/12/88                                                 2





































































%%index%%
na:360,93;
sy:453,1753;
de:2206,1480;
ex:3686,338;
di:4024,393;
ca:4417,401;
se:5250,230;
%%index%%000000000123

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026