Attn: C programmers

Discussion in 'OT Technology' started by teamelement3, May 12, 2005.

  1. teamelement3

    teamelement3 BFB

    Joined:
    Feb 27, 2005
    Messages:
    18,079
    Likes Received:
    0
    Anyone know how to write a tar program, or know of a tutorial? I'm in dire need of help.
     
  2. SLED

    SLED build an idiot proof device and someone else will

    Joined:
    Sep 20, 2001
    Messages:
    28,118
    Likes Received:
    0
    Location:
    AZ, like a bauce!
    you want to rewrite the unix tar program?

    linux's GNU version is open source, why don't you go download the code?
     
  3. Peyomp

    Peyomp New Member

    Joined:
    Jan 11, 2002
    Messages:
    14,017
    Likes Received:
    0
    Exactly... tar is gnu. So just get the source for GNU tar. Its the same across all GNU based systems.

    I can't think of why you would want to do this, though... its not hard to call tar from your program.
     
  4. teamelement3

    teamelement3 BFB

    Joined:
    Feb 27, 2005
    Messages:
    18,079
    Likes Received:
    0
    Have to do it for a C class I'm taking...
     
  5. Peyomp

    Peyomp New Member

    Joined:
    Jan 11, 2002
    Messages:
    14,017
    Likes Received:
    0
    Get the GNU tar implementation, read it, and then make your own.

    Otherwise, lookup the tar format. If I recall, its pretty simple. Mostly just concatenated files as binary data, one after the other. Probably with a marker in between, etc.
     
  6. teamelement3

    teamelement3 BFB

    Joined:
    Feb 27, 2005
    Messages:
    18,079
    Likes Received:
    0
    I downloaded it, and it's an assload of files. I only need one C file?? :confused:
     
  7. Peyomp

    Peyomp New Member

    Joined:
    Jan 11, 2002
    Messages:
    14,017
    Likes Received:
    0
    Tear through the .h's and figure out what is essential.
     
  8. SLED

    SLED build an idiot proof device and someone else will

    Joined:
    Sep 20, 2001
    Messages:
    28,118
    Likes Received:
    0
    Location:
    AZ, like a bauce!
    yea, tar offers no compression if I remember right. Probably just binary files concatenated together (like Peyomp said) with markers stored in a header. Shouldn't be too hard.
     
  9. turbo91

    turbo91 New Member

    Joined:
    Jun 14, 2002
    Messages:
    2,521
    Likes Received:
    0
    Location:
    San Diego, CA
    Yep. tar was originally written for writing data to tape drives...hence the name "tar -- tape archiver." Any compression to the data was assumed to be done by the device at write time.

    It should be fairly trivial to re-write tar...seems like a stupid project for a class though.
     

Share This Page