[hackers] [sbase] Use recurse() in tar(1) instead of ftw(3) || sin

From: <git_AT_suckless.org>
Date: Thu, 30 Jan 2014 15:55:43 +0100

commit 0a7791a25c81300a04a62d96dbed78718bdd1797
Author: sin <sin_AT_2f30.org>
Date: Thu Jan 30 14:12:12 2014 +0000

    Use recurse() in tar(1) instead of ftw(3)

diff --git a/tar.c b/tar.c
index a478e5f..1ecf8bd 100644
--- a/tar.c
+++ b/tar.c
_AT_@ -6,7 +6,6 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <limits.h>
-#include <ftw.h>
 #include <grp.h>
 #include <pwd.h>
 #include "util.h"
_AT_@ -40,10 +39,10 @@ enum Type {
 };
 
 static void putoctal(char *, unsigned, int);
-static int archive(const char *, const struct stat *, int);
+static int archive(const char *);
 static int unarchive(char *, int, char[Blksiz]);
 static int print(char *, int , char[Blksiz]);
-static void c(char *);
+static void c(const char *);
 static void xt(int (*)(char*, int, char[Blksiz]));
 
 static FILE *tarfile;
_AT_@ -150,7 +149,7 @@ putoctal(char *dst, unsigned num, int n)
 }
 
 int
-archive(const char* path, const struct stat* sta, int type)
+archive(const char* path)
 {
         unsigned char b[Blksiz];
         unsigned chksum;
_AT_@ -286,9 +285,10 @@ print(char * fname, int l, char b[Blksiz])
 }
 
 void
-c(char * dir)
+c(const char * path)
 {
- ftw(dir, archive, FOPEN_MAX);
+ archive(path);
+ recurse(path, c);
 }
 
 void
Received on Thu Jan 30 2014 - 15:55:43 CET

This archive was generated by hypermail 2.3.0 : Thu Jan 30 2014 - 16:00:17 CET