improve behaviour under VPC, fixes from nicolas tittley.
[minix.git] / commands / autil / rd_arhdr.c
bloba2807dbe87485ab22b2a9943619b6e08255e16cb
1 /* $Id$ */
2 /*
3 * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
4 * See the copyright notice in the ACK home directory, in the file "Copyright".
5 */
6 #include "obj.h"
8 int
9 rd_arhdr(fd, arhdr)
10 register struct ar_hdr *arhdr;
12 char buf[AR_TOTAL];
13 register char *c = buf;
14 register char *p = arhdr->ar_name;
15 register int i;
17 i = read(fd, c, AR_TOTAL);
18 if (i == 0) return 0;
19 if (i != AR_TOTAL) {
20 rd_fatal();
22 i = 14;
23 while (i--) {
24 *p++ = *c++;
26 arhdr->ar_date = ((long) get2(c)) << 16; c += 2;
27 arhdr->ar_date |= ((long) get2(c)) & 0xffff; c += 2;
28 arhdr->ar_uid = *c++;
29 arhdr->ar_gid = *c++;
30 arhdr->ar_mode = get2(c); c += 2;
31 arhdr->ar_size = (long) get2(c) << 16; c += 2;
32 arhdr->ar_size |= (long) get2(c) & 0xffff;
33 return 1;