1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
/* walk.c
Walk a directory tree. */
#include "uucp.h"
#include "uudefs.h"
#include "sysdep.h"
#include "system.h"
#if HAVE_FTW_H
#include <ftw.h>
#endif
static int iswalk_dir P((const char *zname, struct stat *qstat, int iflag));
/* Walk a directory tree. */
static size_t cSlen;
static void (*puSfn) P((const char *zfull, const char *zrelative,
pointer pinfo));
static pointer pSinfo;
boolean
usysdep_walk_tree (zdir, pufn, pinfo)
const char *zdir;
void (*pufn) P((const char *zfull, const char *zrelative,
pointer pinfo));
pointer pinfo;
{
cSlen = strlen (zdir) + 1;
puSfn = pufn;
pSinfo = pinfo;
return ftw ((char *) zdir, iswalk_dir, 5) == 0;
}
/* Pass a file found in the directory tree to the system independent
function. */
/*ARGSUSED*/
static int
iswalk_dir (zname, qstat, iflag)
const char *zname;
struct stat *qstat;
int iflag;
{
char *zcopy;
if (iflag != FTW_F)
return 0;
zcopy = zbufcpy (zname + cSlen);
(*puSfn) (zname, zcopy, pSinfo);
ubuffree (zcopy);
return 0;
}
|