rd_arhdr now returns 1 if it succeeds, and 0 at end-of-file.

This commit is contained in:
ceriel 1987-01-08 16:04:20 +00:00
parent ecf93dbf4f
commit 4219306f55

View file

@ -1,6 +1,7 @@
#include <arch.h>
#include "object.h"
int
rd_arhdr(fd, arhdr)
register struct ar_hdr *arhdr;
{
@ -11,9 +12,14 @@ rd_arhdr(fd, arhdr)
char buf[AR_TOTAL];
register char *c = buf;
register char *p = arhdr->ar_name;
register int i = 14;
register int i;
rd_bytes(fd, c, (long) AR_TOTAL);
i = read(fd, c, AR_TOTAL);
if (i == 0) return 0;
if (i < 0 || i != AR_TOTAL) {
rd_fatal();
}
i = 14;
while (i--) {
*p++ = *c++;
}
@ -24,6 +30,12 @@ rd_arhdr(fd, arhdr)
arhdr->ar_size = get4(c);
}
#if ! (BYTES_REVERSED || WORDS_REVERSED)
else rd_bytes(fd, (char *) arhdr, (long) AR_TOTAL);
else {
register int i;
i = read(fd, (char *) arhdr, AR_TOTAL);
if (i == 0) return 0;
if (i < 0 || i != AR_TOTAL) rd_fatal();
}
#endif
return 1;
}