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

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

Minix 3.1.2a

File size: 880 bytes
Line 
1/* $Header: /cvsup/minix/src/commands/aal/rd_arhdr.c,v 1.1.1.1 2005/04/21 14:53:58 beng 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 <arch.h>
7#include "object.h"
8
9int
10rd_arhdr(fd, arhdr)
11 register struct ar_hdr *arhdr;
12{
13 char buf[AR_TOTAL];
14 register char *c = buf;
15 register char *p = arhdr->ar_name;
16 register int i;
17
18 i = read(fd, c, AR_TOTAL);
19 if (i == 0) return 0;
20 if (i != AR_TOTAL) {
21 rd_fatal();
22 }
23 i = 14;
24 while (i--) {
25 *p++ = *c++;
26 }
27 arhdr->ar_date = ((long) get2(c)) << 16; c += 2;
28 arhdr->ar_date |= ((long) get2(c)) & 0xffff; c += 2;
29 arhdr->ar_uid = *c++;
30 arhdr->ar_gid = *c++;
31 arhdr->ar_mode = get2(c); c += 2;
32 arhdr->ar_size = (long) get2(c) << 16; c += 2;
33 arhdr->ar_size |= (long) get2(c) & 0xffff;
34 return 1;
35}
Note: See TracBrowser for help on using the repository browser.