[hackers] [sbase] Fix recurse() prototype and convert char to int flags || sin
commit 8f068589fbda368eb77953e05319646d7c445c5c
Author: sin <sin_AT_2f30.org>
Date: Mon Feb 16 16:23:12 2015 +0000
Fix recurse() prototype and convert char to int flags
diff --git a/chgrp.c b/chgrp.c
index 27027dd..d31d6a7 100644
--- a/chgrp.c
+++ b/chgrp.c
_AT_@ -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
index e5074be..1ddc87c 100644
--- a/chmod.c
+++ b/chmod.c
_AT_@ -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
index 3763bec..917d2bb 100644
--- a/du.c
+++ b/du.c
_AT_@ -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
index d9faeac..7c59515 100644
--- a/fs.h
+++ b/fs.h
_AT_@ -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;
_AT_@ -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
index 7e0cd3a..9145590 100644
--- a/libutil/cp.c
+++ b/libutil/cp.c
_AT_@ -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
index ba1bb23..e4ab2e0 100644
--- a/libutil/recurse.c
+++ b/libutil/recurse.c
_AT_@ -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
index 505ef28..53ae3f2 100644
--- a/libutil/rm.c
+++ b/libutil/rm.c
_AT_@ -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
index 4464ff7..b57b4c3 100644
--- a/mv.c
+++ b/mv.c
_AT_@ -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
index 867e207..b18ec68 100644
--- a/rm.c
+++ b/rm.c
_AT_@ -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
index dec1bdc..6c2af26 100644
--- a/tar.c
+++ b/tar.c
_AT_@ -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;
_AT_@ -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 *
_AT_@ -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
index 5f95809..4d89560 100644
--- a/util.h
+++ b/util.h
_AT_@ -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);
Received on Tue Mar 24 2015 - 23:53:52 CET
This archive was generated by hypermail 2.3.0
: Wed Mar 25 2015 - 00:10:22 CET