svn commit: r249949 - head/bin/rm

Eitan Adler eadler at FreeBSD.org
Fri Apr 26 17:45:41 UTC 2013


Author: eadler
Date: Fri Apr 26 17:45:40 2013
New Revision: 249949
URL: http://svnweb.freebsd.org/changeset/base/249949

Log:
  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

Modified:
  head/bin/rm/rm.c

Modified: head/bin/rm/rm.c
==============================================================================
--- head/bin/rm/rm.c	Fri Apr 26 17:45:37 2013	(r249948)
+++ head/bin/rm/rm.c	Fri Apr 26 17:45:40 2013	(r249949)
@@ -63,15 +63,15 @@ static int rflag, Iflag, xflag;
 static uid_t uid;
 static volatile sig_atomic_t info;
 
-int	check(char *, char *, struct stat *);
-int	check2(char **);
-void	checkdot(char **);
-void	checkslash(char **);
-void	rm_file(char **);
-int	rm_overwrite(char *, struct stat *);
-void	rm_tree(char **);
+static int	check(const char *, const char *, struct stat *);
+static int	check2(char **);
+static void	checkdot(char **);
+static void	checkslash(char **);
+static void	rm_file(char **);
+static int	rm_overwrite(const char *, struct stat *);
+static void	rm_tree(char **);
 static void siginfo(int __unused);
-void	usage(void);
+static void	usage(void);
 
 /*
  * rm --
@@ -173,7 +173,7 @@ main(int argc, char *argv[])
 	exit (eval);
 }
 
-void
+static void
 rm_tree(char **argv)
 {
 	FTS *fts;
@@ -418,7 +418,7 @@ rm_file(char **argv)
  * have kernel support.
  */
 int
-rm_overwrite(char *file, struct stat *sbp)
+rm_overwrite(const char *file, struct stat *sbp)
 {
 	struct stat sb, sb2;
 	struct statfs fsb;
@@ -484,8 +484,8 @@ err:	eval = 1;
 }
 
 
-int
-check(char *path, char *name, struct stat *sp)
+static int
+check(const char *path, const char *name, struct stat *sp)
 {
 	int ch, first;
 	char modep[15], *flagsp;
@@ -496,7 +496,7 @@ check(char *path, char *name, struct sta
 	else {
 		/*
 		 * If it's not a symbolic link and it's unwritable and we're
-		 * talking to a terminal, ask.	Symbolic links are excluded
+		 * talking to a terminal, ask.  Symbolic links are excluded
 		 * because their permissions are meaningless.  Check stdin_ok
 		 * first because we may not have stat'ed the file.
 		 */
@@ -529,7 +529,7 @@ check(char *path, char *name, struct sta
 }
 
 #define ISSLASH(a)	((a)[0] == '/' && (a)[1] == '\0')
-void
+static void
 checkslash(char **argv)
 {
 	char **t, **u;
@@ -549,7 +549,7 @@ checkslash(char **argv)
 	}
 }
 
-int
+static int
 check2(char **argv)
 {
 	struct stat st;
@@ -600,7 +600,7 @@ check2(char **argv)
 }
 
 #define ISDOT(a)	((a)[0] == '.' && (!(a)[1] || ((a)[1] == '.' && !(a)[2])))
-void
+static void
 checkdot(char **argv)
 {
 	char *p, **save, **t;
@@ -624,7 +624,7 @@ checkdot(char **argv)
 	}
 }
 
-void
+static void
 usage(void)
 {
 


More information about the svn-src-all mailing list