commit 8f068589fbda368eb77953e05319646d7c445c5c
parent d8fa891008996aff63891ff223c8991c5a8f5f78
Author: sin <sin@2f30.org>
Date: Mon, 16 Feb 2015 16:23:12 +0000
Fix recurse() prototype and convert char to int flags
Diffstat:
11 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/chgrp.c b/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);
diff --git a/chmod.c b/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;
diff --git a/du.c b/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)
diff --git a/fs.h b/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);
diff --git a/libutil/cp.c b/libutil/cp.c
@@ -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)
diff --git a/libutil/recurse.c b/libutil/recurse.c
@@ -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;
diff --git a/libutil/rm.c b/libutil/rm.c
@@ -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');
diff --git a/mv.c b/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;
diff --git a/rm.c b/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;
}
diff --git a/tar.c b/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);
diff --git a/util.h b/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);