rd_arhdr.c

Go to the documentation of this file.
00001 /* $Header: /opt/proj/minix/cvsroot/src/commands/aal/rd_arhdr.c,v 1.1.1.1 2005/04/21 14:53:58 beng Exp $ */
00002 /*
00003  * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
00004  * See the copyright notice in the ACK home directory, in the file "Copyright".
00005  */
00006 #include <arch.h>
00007 #include "object.h"
00008 
00009 int
00010 rd_arhdr(fd, arhdr)
00011         register struct ar_hdr  *arhdr;
00012 {
00013         char buf[AR_TOTAL];
00014         register char *c = buf;
00015         register char *p = arhdr->ar_name;
00016         register int i;
00017 
00018         i = read(fd, c, AR_TOTAL);
00019         if (i == 0) return 0;
00020         if (i != AR_TOTAL) {
00021                 rd_fatal();
00022         }
00023         i = 14;
00024         while (i--) {
00025                 *p++ = *c++;
00026         }
00027         arhdr->ar_date = ((long) get2(c)) << 16; c += 2;
00028         arhdr->ar_date |= ((long) get2(c)) & 0xffff; c += 2;
00029         arhdr->ar_uid = *c++;
00030         arhdr->ar_gid = *c++;
00031         arhdr->ar_mode = get2(c); c += 2;
00032         arhdr->ar_size = (long) get2(c) << 16; c += 2;
00033         arhdr->ar_size |= (long) get2(c) & 0xffff;
00034         return 1;
00035 }

Generated on Fri Apr 14 22:56:37 2006 for minix by  doxygen 1.4.6