flat assembler
Message board for the users of flat assembler.

Index > Main > Tar from scratch

Author
Thread Post new topic Reply to topic
maslan



Joined: 08 Sep 2003
Posts: 54
maslan 17 Jul 2004, 18:12
how can i create unix-compatible tar (not ustar) from scratch
i don't know how to calculate the checksum

[code]
/* Minix tar.h but it makes ustar tar */

/* The <tar.h> header is used with the tape archiver, tar. */

#ifndef _TAR_H
#define _TAR_H

#define TBLOCK 512
#define NAMSIZ 100
#define PFXSIZ 155

#define TMODLEN 8
#define TUIDLEN 8
#define TGIDLEN 8
#define TSIZLEN 12
#define TMTMLEN 12
#define TCKSLEN 8

#define TMAGIC "ustar"
#define TMAGLEN 6
#define TVERSION "00"
#define TVERSLEN 2
#define TUNMLEN 32
#define TGNMLEN 32
#define TDEVLEN 8

#define REGTYPE '0'
#define AREGTYPE '\0'
#define LNKTYPE '1'
#define SYMTYPE '2'
#define CHRTYPE '3'
#define BLKTYPE '4'
#define DIRTYPE '5'
#define FIFOTYPE '6'
#define CONTTYPE '7'

#define TSUID 04000
#define TSGID 02000
#define TSVTX 01000

#define TUREAD 00400
#define TUWRITE 00200
#define TUEXEC 00100
#define TGREAD 00040
#define TGWRITE 00020
#define TGEXEC 00010
#define TOREAD 00004
#define TOWRITE 00002
#define TOEXEC 00001

union hblock {
char dummy[TBLOCK];
struct header {
char name[NAMSIZ];
char mode[TMODLEN];
char uid[TUIDLEN];
char gid[TGIDLEN];
char size[TSIZLEN];
char mtime[TMTMLEN];
char chksum[TCKSLEN];
char typeflag;
char linkname[NAMSIZ];
char magic[TMAGLEN];
char version[TVERSLEN];
char uname[TUNMLEN];
char gname[TGNMLEN];
char devmajor[TDEVLEN];
char devminor[TDEVLEN];
char prefix[PFXSIZ];
} dbuf;
};

#endif /* _TAR_H */
[\code]


Table 1: tar Header Block (TAR Format)

Field Width Field Name Meaning

------------------------------------------
100 name name of file
8 mode file mode
8 uid owner user ID
8 gid owner group ID
12 size length of file in bytes
12 mtime modify time of file
8 chksum checksum for header
1 link indicator for links
100 linkname name of linked file


can any 1 give me a source in c or asm

or calc the chksum for me and time

[code]
name db "test.txt"
rb 92
mode db "0",0,0,0,0,0,0,0
uid db "0",0,0,0,0,0,0,0
gid db "0",0,0,0,0,0,0,0
size db "2",0,0,0,0,0,0,0,0,0,0,0
mtime db "0",0,0,0,0,0,0,0,0,0,0,0
chksum db "0",0,0,0,0,0,0,0
link db "0"
rb 100
content db "hi"
rb 255
rb 511
db 0
[/code]

_________________
Maslan
I'm searching for perfection so, even if u need portability u 've to use Assembly
---
http://www.maslanlab.org
---
http://libosdk.berlios.de
http://maslanedit.sf.net
http://maslancms.sf.net
Post 17 Jul 2004, 18:12
View user's profile Send private message Reply with quote
ronware



Joined: 08 Jan 2004
Posts: 179
Location: Israel
ronware 19 Jul 2004, 15:30
maslan wrote:
how can i create unix-compatible tar (not ustar) from scratch
i don't know how to calculate the checksum


Grab the source for GNU tar, and look there.
Post 19 Jul 2004, 15:30
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger Reply with quote
maslan



Joined: 08 Sep 2003
Posts: 54
maslan 19 Jul 2004, 18:17
it's too big and have gnu extension for tape archieves

_________________
Maslan
I'm searching for perfection so, even if u need portability u 've to use Assembly
---
http://www.maslanlab.org
---
http://libosdk.berlios.de
http://maslanedit.sf.net
http://maslancms.sf.net
Post 19 Jul 2004, 18:17
View user's profile Send private message Reply with quote
fasm9



Joined: 19 Jun 2003
Posts: 439
fasm9 19 Jul 2004, 21:19
Hi, tar.asm is in
http://linuxassembly.org/asmutils/asmutils-0.17.tar.gz

it written in nasm.
Post 19 Jul 2004, 21:19
View user's profile Send private message Reply with quote
maslan



Joined: 08 Sep 2003
Posts: 54
maslan 20 Jul 2004, 19:02
thnx i will check it Cool

_________________
Maslan
I'm searching for perfection so, even if u need portability u 've to use Assembly
---
http://www.maslanlab.org
---
http://libosdk.berlios.de
http://maslanedit.sf.net
http://maslancms.sf.net
Post 20 Jul 2004, 19:02
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.