wr_arhdr.c 628 B

1234567891011121314151617181920212223242526
  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"
  7. void wr_arhdr(int fd, struct ar_hdr *arhdr)
  8. {
  9. char buf[AR_TOTAL];
  10. char *c = buf;
  11. char *p = arhdr->ar_name;
  12. int i = 14;
  13. while (i--) {
  14. *c++ = *p++;
  15. }
  16. put2((int)(arhdr->ar_date>>16),c); c += 2;
  17. put2((int)(arhdr->ar_date),c); c += 2;
  18. *c++ = arhdr->ar_uid;
  19. *c++ = arhdr->ar_gid;
  20. put2(arhdr->ar_mode,c); c += 2;
  21. put2((int)(arhdr->ar_size>>16),c); c += 2;
  22. put2((int)(arhdr->ar_size),c);
  23. wr_bytes(fd, buf, (long) AR_TOTAL);
  24. }