The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: reed@reedmedia.net (Jeremy C. Reed)
Subject: [pups] extract old archive format?
Date: Fri, 9 Apr 2010 00:35:38 -0500 (CDT)	[thread overview]
Message-ID: <alpine.NEB.2.01.1004090033570.13963@t1.m.reedmedia.net> (raw)
In-Reply-To: <337550.74945.qm@web82407.mail.mud.yahoo.com>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1033 bytes --]

On Thu, 8 Apr 2010, Michael Davidson wrote:

> Your modern compiler is almost certainly inserting two bytes of padding
> after ar_name[]
> so that the int32_t ar_date is aligned on a 4 byte boundary - that shifts
> everything else
> down by 2 bytes and means that ar_size lines up with the last 2 bytes of the
> size in
> the header which, as luck would have it, is the low order 16 bits of the
> size as it would
> have been stored in a 32 bit long.
> 
> Something like this should work on a modern little endian processor"
> 
> struct {
>         char    ar_name[14];
>         int16_t ar_date_16_31;
>         int16_t ar_date_00_15;
>         char    ar_uid;
>         char    ar_gid;
>         uint16_t        ar_mode;
>         uint16_t        ar_size_16_31;
>         uint16_t        ar_size_00_15;
> } ar_buf;

Thank you! That works for me! I can now get correct sizes, names, and 
data. I will clean up my little ar extractor over the next few days and 
share it.


       reply	other threads:[~2010-04-09  5:35 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <337550.74945.qm@web82407.mail.mud.yahoo.com>
2010-04-09  5:35 ` Jeremy C. Reed [this message]
2010-04-09  2:40 John Holden
     [not found] ` <n2m5904d5731004082137u5b054823wd4a9ce55113b1dee@mail.gmail.com>
2010-04-09  4:39   ` Carl Lowenstein
2010-04-09 10:23     ` Johnny Billquist
2010-04-09 10:21 ` Johnny Billquist
  -- strict thread matches above, loose matches on Subject: below --
2010-04-09  1:13 Norman Wilson
2010-04-09  2:11 ` Jeremy C. Reed
2010-04-09 10:15   ` Johnny Billquist
2010-04-09  5:49 ` Bob Eager
2010-04-08 13:25 Jeremy C. Reed
2010-04-08 14:49 ` Tim Bradshaw
2010-04-08 15:16 ` Brantley Coile
2010-04-08 17:09 ` Bob Eager
2010-04-09  5:11 ` Warren Toomey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.NEB.2.01.1004090033570.13963@t1.m.reedmedia.net \
    --to=reed@reedmedia.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).