Bug fix: order in archive longs is PDP-11 order!
This commit is contained in:
parent
3ca2fcad1c
commit
5a0140cf3a
|
@ -5,7 +5,7 @@ int
|
|||
rd_arhdr(fd, arhdr)
|
||||
register struct ar_hdr *arhdr;
|
||||
{
|
||||
#if ! (BYTES_REVERSED || WORDS_REVERSED)
|
||||
#if WORDS_REVERSED && ! BYTES_REVERSED
|
||||
if (sizeof (struct ar_hdr) != AR_TOTAL)
|
||||
#endif
|
||||
{
|
||||
|
@ -23,13 +23,15 @@ rd_arhdr(fd, arhdr)
|
|||
while (i--) {
|
||||
*p++ = *c++;
|
||||
}
|
||||
arhdr->ar_date = get4(c); c += 4;
|
||||
arhdr->ar_date = get2(c) << 16; c += 2;
|
||||
arhdr->ar_date |= get2(c) & 0xffff; c += 2;
|
||||
arhdr->ar_uid = *c++;
|
||||
arhdr->ar_gid = *c++;
|
||||
arhdr->ar_mode = get2(c); c += 2;
|
||||
arhdr->ar_size = get4(c);
|
||||
arhdr->ar_size = get2(c) << 16; c += 2;
|
||||
arhdr->ar_size |= get2(c) & 0xffff;
|
||||
}
|
||||
#if ! (BYTES_REVERSED || WORDS_REVERSED)
|
||||
#if WORDS_REVERSED && !BYTES_REVERSED
|
||||
else {
|
||||
register int i;
|
||||
i = read(fd, (char *) arhdr, AR_TOTAL);
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
wr_arhdr(fd, arhdr)
|
||||
register struct ar_hdr *arhdr;
|
||||
{
|
||||
#if ! (BYTES_REVERSED || WORDS_REVERSED)
|
||||
#if WORDS_REVERSED && !BYTES_REVERSED
|
||||
if (sizeof (struct ar_hdr) != AR_TOTAL)
|
||||
#endif
|
||||
{
|
||||
|
@ -16,14 +16,16 @@ wr_arhdr(fd, arhdr)
|
|||
while (i--) {
|
||||
*c++ = *p++;
|
||||
}
|
||||
put4(arhdr->ar_date,c); c += 4;
|
||||
put2(arhdr->ar_date>>16,c); c += 2;
|
||||
put2(arhdr->ar_date,c); c += 2;
|
||||
*c++ = arhdr->ar_uid;
|
||||
*c++ = arhdr->ar_gid;
|
||||
put2(arhdr->ar_mode,c); c += 2;
|
||||
put4(arhdr->ar_size,c);
|
||||
put2(arhdr->ar_size>>16,c); c += 2;
|
||||
put2(arhdr->ar_size,c);
|
||||
wr_bytes(fd, buf, (long) AR_TOTAL);
|
||||
}
|
||||
#if ! (BYTES_REVERSED || WORDS_REVERSED)
|
||||
#if WORDS_REVERSED && !BYTES_REVERSED
|
||||
else wr_bytes(fd, (char *) arhdr, (long) AR_TOTAL);
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue