Made to work if BYTES_REVERSED and/or WORDS_REVERSED are not defined

This commit is contained in:
ceriel
1991-01-18 09:54:56 +00:00
parent 36e47ad79b
commit 8322e2d5d3
4 changed files with 49 additions and 64 deletions

View File

@@ -9,28 +9,20 @@
wr_arhdr(fd, arhdr)
register struct ar_hdr *arhdr;
{
#if WORDS_REVERSED && !BYTES_REVERSED
if (sizeof (struct ar_hdr) != AR_TOTAL)
#endif
{
char buf[AR_TOTAL];
register char *c = buf;
register char *p = arhdr->ar_name;
register int i = 14;
char buf[AR_TOTAL];
register char *c = buf;
register char *p = arhdr->ar_name;
register int i = 14;
while (i--) {
*c++ = *p++;
}
put2((int)(arhdr->ar_date>>16),c); c += 2;
put2((int)(arhdr->ar_date),c); c += 2;
*c++ = arhdr->ar_uid;
*c++ = arhdr->ar_gid;
put2(arhdr->ar_mode,c); c += 2;
put2((int)(arhdr->ar_size>>16),c); c += 2;
put2((int)(arhdr->ar_size),c);
wr_bytes(fd, buf, (long) AR_TOTAL);
while (i--) {
*c++ = *p++;
}
#if WORDS_REVERSED && !BYTES_REVERSED
else wr_bytes(fd, (char *) arhdr, (long) AR_TOTAL);
#endif
put2((int)(arhdr->ar_date>>16),c); c += 2;
put2((int)(arhdr->ar_date),c); c += 2;
*c++ = arhdr->ar_uid;
*c++ = arhdr->ar_gid;
put2(arhdr->ar_mode,c); c += 2;
put2((int)(arhdr->ar_size>>16),c); c += 2;
put2((int)(arhdr->ar_size),c);
wr_bytes(fd, buf, (long) AR_TOTAL);
}