123456789101112131415161718192021222324252627282930313233343536 |
- /* $Id$ */
- /*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- */
- #include "obj.h"
- void rd_fatal();
- #include <unistd.h>
- int rd_arhdr(int fd, struct ar_hdr *arhdr)
- {
- char buf[AR_TOTAL];
- char *c = buf;
- char *p = arhdr->ar_name;
- int i;
- i = read(fd, c, AR_TOTAL);
- if (i == 0) return 0;
- if (i != AR_TOTAL) {
- rd_fatal();
- }
- i = 14;
- while (i--) {
- *p++ = *c++;
- }
- arhdr->ar_date = ((long) get2(c)) << 16; c += 2;
- arhdr->ar_date |= ((long) get2(c)) & 0xffff; c += 2;
- arhdr->ar_uid = *c++;
- arhdr->ar_gid = *c++;
- arhdr->ar_mode = get2(c); c += 2;
- arhdr->ar_size = (long) get2(c) << 16; c += 2;
- arhdr->ar_size |= (long) get2(c) & 0xffff;
- return 1;
- }
|