Take some improvements from DragonFlyBSD:
- add const where appropriate - add static where appropriate - fix a whitespace issues Reviewed by: brooks Obtained from: DragonFlyBSD MFC After: 1 week
This commit is contained in:
parent
d4319e7433
commit
9d6d3f96d0
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=249949
32
bin/rm/rm.c
32
bin/rm/rm.c
@ -63,15 +63,15 @@ static int rflag, Iflag, xflag;
|
|||||||
static uid_t uid;
|
static uid_t uid;
|
||||||
static volatile sig_atomic_t info;
|
static volatile sig_atomic_t info;
|
||||||
|
|
||||||
int check(char *, char *, struct stat *);
|
static int check(const char *, const char *, struct stat *);
|
||||||
int check2(char **);
|
static int check2(char **);
|
||||||
void checkdot(char **);
|
static void checkdot(char **);
|
||||||
void checkslash(char **);
|
static void checkslash(char **);
|
||||||
void rm_file(char **);
|
static void rm_file(char **);
|
||||||
int rm_overwrite(char *, struct stat *);
|
static int rm_overwrite(const char *, struct stat *);
|
||||||
void rm_tree(char **);
|
static void rm_tree(char **);
|
||||||
static void siginfo(int __unused);
|
static void siginfo(int __unused);
|
||||||
void usage(void);
|
static void usage(void);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* rm --
|
* rm --
|
||||||
@ -173,7 +173,7 @@ main(int argc, char *argv[])
|
|||||||
exit (eval);
|
exit (eval);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
rm_tree(char **argv)
|
rm_tree(char **argv)
|
||||||
{
|
{
|
||||||
FTS *fts;
|
FTS *fts;
|
||||||
@ -418,7 +418,7 @@ rm_file(char **argv)
|
|||||||
* have kernel support.
|
* have kernel support.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
rm_overwrite(char *file, struct stat *sbp)
|
rm_overwrite(const char *file, struct stat *sbp)
|
||||||
{
|
{
|
||||||
struct stat sb, sb2;
|
struct stat sb, sb2;
|
||||||
struct statfs fsb;
|
struct statfs fsb;
|
||||||
@ -484,8 +484,8 @@ err: eval = 1;
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
static int
|
||||||
check(char *path, char *name, struct stat *sp)
|
check(const char *path, const char *name, struct stat *sp)
|
||||||
{
|
{
|
||||||
int ch, first;
|
int ch, first;
|
||||||
char modep[15], *flagsp;
|
char modep[15], *flagsp;
|
||||||
@ -529,7 +529,7 @@ check(char *path, char *name, struct stat *sp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define ISSLASH(a) ((a)[0] == '/' && (a)[1] == '\0')
|
#define ISSLASH(a) ((a)[0] == '/' && (a)[1] == '\0')
|
||||||
void
|
static void
|
||||||
checkslash(char **argv)
|
checkslash(char **argv)
|
||||||
{
|
{
|
||||||
char **t, **u;
|
char **t, **u;
|
||||||
@ -549,7 +549,7 @@ checkslash(char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
static int
|
||||||
check2(char **argv)
|
check2(char **argv)
|
||||||
{
|
{
|
||||||
struct stat st;
|
struct stat st;
|
||||||
@ -600,7 +600,7 @@ check2(char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define ISDOT(a) ((a)[0] == '.' && (!(a)[1] || ((a)[1] == '.' && !(a)[2])))
|
#define ISDOT(a) ((a)[0] == '.' && (!(a)[1] || ((a)[1] == '.' && !(a)[2])))
|
||||||
void
|
static void
|
||||||
checkdot(char **argv)
|
checkdot(char **argv)
|
||||||
{
|
{
|
||||||
char *p, **save, **t;
|
char *p, **save, **t;
|
||||||
@ -624,7 +624,7 @@ checkdot(char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
usage(void)
|
usage(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user