Fix recurse() prototype and convert char to int flags
This commit is contained in:
parent
d8fa891008
commit
8f068589fb
4
chgrp.c
4
chgrp.c
|
@ -10,13 +10,13 @@
|
|||
static int gid;
|
||||
static int status;
|
||||
static int rflag;
|
||||
static char fflag = 'P';
|
||||
static int fflag = 'P';
|
||||
static struct stat st;
|
||||
static char *chown_f_name = "chown";
|
||||
static int (*chown_f)(const char *, uid_t, gid_t) = chown;
|
||||
|
||||
static void
|
||||
chgrp(const char *path, char fflag)
|
||||
chgrp(const char *path, int fflag)
|
||||
{
|
||||
if (chown_f(path, st.st_uid, gid) < 0) {
|
||||
weprintf("%s %s:", chown_f_name, path);
|
||||
|
|
2
chmod.c
2
chmod.c
|
@ -9,7 +9,7 @@ static mode_t mask = 0;
|
|||
static int ret = 0;
|
||||
|
||||
void
|
||||
chmodr(const char *path, char fflag)
|
||||
chmodr(const char *path, int fflag)
|
||||
{
|
||||
struct stat st;
|
||||
mode_t m;
|
||||
|
|
2
du.c
2
du.c
|
@ -21,7 +21,7 @@ static int dflag = 0;
|
|||
static int sflag = 0;
|
||||
static int kflag = 0;
|
||||
static int hflag = 0;
|
||||
static char HLflag = 'P';
|
||||
static int HLflag = 'P';
|
||||
|
||||
static char *
|
||||
xrealpath(const char *pathname, char *resolved)
|
||||
|
|
4
fs.h
4
fs.h
|
@ -4,7 +4,7 @@ extern int cp_fflag;
|
|||
extern int cp_pflag;
|
||||
extern int cp_rflag;
|
||||
extern int cp_vflag;
|
||||
extern char cp_HLPflag;
|
||||
extern int cp_HLPflag;
|
||||
extern int cp_status;
|
||||
|
||||
extern int rm_fflag;
|
||||
|
@ -12,4 +12,4 @@ extern int rm_rflag;
|
|||
extern int rm_status;
|
||||
|
||||
int cp(const char *, const char *, char);
|
||||
void rm(const char *);
|
||||
void rm(const char *, int);
|
||||
|
|
|
@ -21,7 +21,7 @@ int cp_pflag = 0;
|
|||
int cp_rflag = 0;
|
||||
int cp_vflag = 0;
|
||||
int cp_status = 0;
|
||||
char cp_HLPflag = 'L';
|
||||
int cp_HLPflag = 'L';
|
||||
|
||||
int
|
||||
cp(const char *s1, const char *s2, char ff)
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#include "../util.h"
|
||||
|
||||
void
|
||||
recurse(const char *path, void (*fn)(const char *, char), int follow)
|
||||
recurse(const char *path, void (*fn)(const char *, int), int follow)
|
||||
{
|
||||
char buf[PATH_MAX];
|
||||
struct dirent *d;
|
||||
|
|
|
@ -9,7 +9,7 @@ int rm_rflag = 0;
|
|||
int rm_status = 0;
|
||||
|
||||
void
|
||||
rm(const char *path)
|
||||
rm(const char *path, int unused)
|
||||
{
|
||||
if (rm_rflag)
|
||||
recurse(path, rm, 'P');
|
||||
|
|
2
mv.c
2
mv.c
|
@ -18,7 +18,7 @@ mv(const char *s1, const char *s2, char ff)
|
|||
cp_aflag = cp_rflag = cp_pflag = 1;
|
||||
rm_rflag = 1;
|
||||
cp(s1, s2, ff);
|
||||
rm(s1);
|
||||
rm(s1, 0);
|
||||
return (mv_status = cp_status || rm_status);
|
||||
}
|
||||
mv_status = 1;
|
||||
|
|
2
rm.c
2
rm.c
|
@ -34,7 +34,7 @@ main(int argc, char *argv[])
|
|||
}
|
||||
|
||||
for (; argc > 0; argc--, argv++)
|
||||
rm(argv[0]);
|
||||
rm(argv[0], 0);
|
||||
|
||||
return rm_status;
|
||||
}
|
||||
|
|
6
tar.c
6
tar.c
|
@ -44,7 +44,7 @@ static void putoctal(char *, unsigned, int);
|
|||
static int archive(const char *);
|
||||
static int unarchive(char *, int, char[Blksiz]);
|
||||
static int print(char *, int , char[Blksiz]);
|
||||
static void c(const char *, char);
|
||||
static void c(const char *, int);
|
||||
static void xt(int (*)(char*, int, char[Blksiz]));
|
||||
|
||||
static FILE *tarfile;
|
||||
|
@ -52,7 +52,7 @@ static ino_t tarinode;
|
|||
static dev_t tardev;
|
||||
|
||||
static int mflag;
|
||||
static char fflag = 'P';
|
||||
static int fflag = 'P';
|
||||
static char filtermode;
|
||||
|
||||
static FILE *
|
||||
|
@ -246,7 +246,7 @@ print(char * fname, int l, char b[Blksiz])
|
|||
}
|
||||
|
||||
static void
|
||||
c(const char * path, char fflag)
|
||||
c(const char * path, int fflag)
|
||||
{
|
||||
archive(path);
|
||||
recurse(path, c, fflag);
|
||||
|
|
2
util.h
2
util.h
|
@ -60,7 +60,7 @@ mode_t getumask(void);
|
|||
char *humansize(double);
|
||||
mode_t parsemode(const char *, mode_t, mode_t);
|
||||
void putword(const char *);
|
||||
void recurse(const char *, void (*)(const char *, char), int);
|
||||
void recurse(const char *, void (*)(const char *, int), int);
|
||||
#undef strtonum
|
||||
long long strtonum(const char *, long long, long long, const char **);
|
||||
long long enstrtonum(int, const char *, long long, long long);
|
||||
|
|
Loading…
Reference in New Issue
Block a user