wr_arhdr.c 866 B

123456789101112131415161718192021222324252627282930313233343536
  1. /* $Header$ */
  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. wr_arhdr(fd, arhdr)
  9. register struct ar_hdr *arhdr;
  10. {
  11. #if WORDS_REVERSED && !BYTES_REVERSED
  12. if (sizeof (struct ar_hdr) != AR_TOTAL)
  13. #endif
  14. {
  15. char buf[AR_TOTAL];
  16. register char *c = buf;
  17. register char *p = arhdr->ar_name;
  18. register int i = 14;
  19. while (i--) {
  20. *c++ = *p++;
  21. }
  22. put2(arhdr->ar_date>>16,c); c += 2;
  23. put2(arhdr->ar_date,c); c += 2;
  24. *c++ = arhdr->ar_uid;
  25. *c++ = arhdr->ar_gid;
  26. put2(arhdr->ar_mode,c); c += 2;
  27. put2(arhdr->ar_size>>16,c); c += 2;
  28. put2(arhdr->ar_size,c);
  29. wr_bytes(fd, buf, (long) AR_TOTAL);
  30. }
  31. #if WORDS_REVERSED && !BYTES_REVERSED
  32. else wr_bytes(fd, (char *) arhdr, (long) AR_TOTAL);
  33. #endif
  34. }