[hackers] [sltar] reformating some stuff. Error messages are send to stderr now. || gottox

From: <hg_AT_suckless.org>
Date: Sun, 11 Nov 2012 17:23:39 +0100 (CET)

changeset: 5:db772b7d817e
user: gottox_AT_rootkit.lan
date: Wed Dec 19 11:02:10 2007 +0100
files: sltar.c
description:
reformating some stuff. Error messages are send to stderr now.


diff -r f7ee26a7be4e -r db772b7d817e sltar.c
--- a/sltar.c Wed Dec 19 10:47:24 2007 +0100
+++ b/sltar.c Wed Dec 19 11:02:10 2007 +0100
_AT_@ -18,15 +18,14 @@
 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;
_AT_@ -39,7 +38,7 @@
                         }
                         if(f) {
                                 fclose(f);
- f = NULL;
+ f = 0;
                         }
                         unlink(fname);
                         switch(b[TYPE]) {
_AT_@ -67,7 +66,7 @@
                                 /* 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)) {
Received on Sun Nov 11 2012 - 17:23:39 CET

This archive was generated by hypermail 2.3.0 : Sun Nov 11 2012 - 17:24:18 CET