Use recurse() in tar(1) instead of ftw(3)
This commit is contained in:
parent
94e97f19cd
commit
0a7791a25c
12
tar.c
12
tar.c
|
@ -6,7 +6,6 @@
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <ftw.h>
|
|
||||||
#include <grp.h>
|
#include <grp.h>
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
@ -40,10 +39,10 @@ enum Type {
|
||||||
};
|
};
|
||||||
|
|
||||||
static void putoctal(char *, unsigned, int);
|
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 unarchive(char *, int, char[Blksiz]);
|
||||||
static int print(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 void xt(int (*)(char*, int, char[Blksiz]));
|
||||||
|
|
||||||
static FILE *tarfile;
|
static FILE *tarfile;
|
||||||
|
@ -150,7 +149,7 @@ putoctal(char *dst, unsigned num, int n)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
archive(const char* path, const struct stat* sta, int type)
|
archive(const char* path)
|
||||||
{
|
{
|
||||||
unsigned char b[Blksiz];
|
unsigned char b[Blksiz];
|
||||||
unsigned chksum;
|
unsigned chksum;
|
||||||
|
@ -286,9 +285,10 @@ print(char * fname, int l, char b[Blksiz])
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
c(char * dir)
|
c(const char * path)
|
||||||
{
|
{
|
||||||
ftw(dir, archive, FOPEN_MAX);
|
archive(path);
|
||||||
|
recurse(path, c);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Reference in New Issue
Block a user