source: trunk/minix/commands/autil/rd_arhdr.c@ 10

Last change on this file since 10 was 9, checked in by Mattia Monga, 13 years ago

Minix 3.1.2a

File size: 823 bytes
Line 
1/* $Id: rd_arhdr.c,v 1.1 2005/06/23 09:50:54 philip Exp $ */
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"
7
8int
9rd_arhdr(fd, arhdr)
10 register struct ar_hdr *arhdr;
11{
12 char buf[AR_TOTAL];
13 register char *c = buf;
14 register char *p = arhdr->ar_name;
15 register int i;
16
17 i = read(fd, c, AR_TOTAL);
18 if (i == 0) return 0;
19 if (i != AR_TOTAL) {
20 rd_fatal();
21 }
22 i = 14;
23 while (i--) {
24 *p++ = *c++;
25 }
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;
34}
Note: See TracBrowser for help on using the repository browser.