mirror of
git://git.suckless.org/sbase
synced 2024-12-22 23:13:44 +00:00
f83d7bc647
recurse() is getting smarter every day. I expect it to pass the Turing test in a few months. Along the way, it was reported that "rm -f" on nonexistant files reports their missing as an internal recurse()-error. So recurse() knows when to shut up, I added the SILENT flag to fix all these things.
44 lines
818 B
C
44 lines
818 B
C
/* See LICENSE file for copyright and license details. */
|
|
#include <sys/stat.h>
|
|
#include <sys/types.h>
|
|
|
|
struct history {
|
|
struct history *prev;
|
|
dev_t dev;
|
|
ino_t ino;
|
|
};
|
|
|
|
struct recursor {
|
|
void (*fn)(const char *, struct stat *st, void *, struct recursor *);
|
|
struct history *hist;
|
|
int depth;
|
|
int maxdepth;
|
|
int follow;
|
|
int flags;
|
|
};
|
|
|
|
enum {
|
|
SAMEDEV = 1 << 0,
|
|
DIRFIRST = 1 << 1,
|
|
SILENT = 1 << 2,
|
|
};
|
|
|
|
extern int cp_aflag;
|
|
extern int cp_fflag;
|
|
extern int cp_pflag;
|
|
extern int cp_rflag;
|
|
extern int cp_vflag;
|
|
extern int cp_follow;
|
|
extern int cp_status;
|
|
|
|
extern int rm_fflag;
|
|
extern int rm_rflag;
|
|
extern int rm_status;
|
|
|
|
extern int recurse_status;
|
|
|
|
void recurse(const char *, void *, struct recursor *);
|
|
|
|
int cp(const char *, const char *, int);
|
|
void rm(const char *, struct stat *st, void *, struct recursor *);
|