sltar

a simple tar implementation
git clone git://git.suckless.org/sltar
Log | Files | Refs | LICENSE

commit 24ca114b0f8a88332f45ae4d2dff2c0b44c17456
parent 04d5e4ffad8b43fe476a0b6e8d2fbae627f14c9b
Author: gottox@rootkit.lan <unknown>
Date:   Wed, 19 Dec 2007 11:02:10 +0100

reformating some stuff. Error messages are send to stderr now.
Diffstat:
sltar.c | 9++++-----
1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/sltar.c b/sltar.c @@ -18,15 +18,14 @@ enum Header { int main(int argc, char *argv[]) { int a, l; char b[END],fname[101],lname[101]; - FILE *f; + FILE *f = 0; if((argc != 2 || (a = argv[1][0]) == '\0') || argv[1][1] != '\0' || (a != 't' && a != 'x')) { puts("sltar-" VERSION " - suckless tar\nsltar [xt]"); exit(EXIT_FAILURE); } - lname[100] = fname[100] = '\0'; - for(l = 0, f = NULL; fread(b,END,1,stdin); l -= END) { + for(lname[100] = fname[100] = l = 0; fread(b,END,1,stdin); l -= END) { if(l <= 0) { if(*b == '\0') break; @@ -39,7 +38,7 @@ int main(int argc, char *argv[]) { } if(f) { fclose(f); - f = NULL; + f = 0; } unlink(fname); switch(b[TYPE]) { @@ -67,7 +66,7 @@ int main(int argc, char *argv[]) { /* TODO */ break; default: - puts("not supported filetype"); + fputs("not supported filetype\n",stderr); } } else if(a == 'x' && f && !fwrite(b,l > 512 ? END : l,1,f)) {