wr_ranlib.c 770 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 <ranlib.h>
  7. #include "object.h"
  8. wr_ranlib(fd, ran, cnt)
  9. register struct ranlib *ran;
  10. register long cnt;
  11. {
  12. #if ! (BYTES_REVERSED || WORDS_REVERSED)
  13. if (sizeof (struct ranlib) != SZ_RAN)
  14. #endif
  15. {
  16. char buf[100 * SZ_RAN];
  17. while (cnt) {
  18. register int i = (cnt > 100) ? 100 : cnt;
  19. register char *c = buf;
  20. long j = i * SZ_RAN;
  21. cnt -= i;
  22. while (i--) {
  23. put4(ran->ran_off,c); c += 4;
  24. put4(ran->ran_pos,c); c += 4;
  25. ran++;
  26. }
  27. wr_bytes(fd, buf, j);
  28. }
  29. }
  30. #if ! (BYTES_REVERSED || WORDS_REVERSED)
  31. else wr_bytes(fd, (char *) ran, cnt * SZ_RAN);
  32. #endif
  33. }