[Midnightbsd-cvs] src [9375] trunk/bin/rm/rm.c: Take some improvements from DragonFlyBSD:

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sat Mar 4 15:25:24 EST 2017


Revision: 9375
          http://svnweb.midnightbsd.org/src/?rev=9375
Author:   laffer1
Date:     2017-03-04 15:25:24 -0500 (Sat, 04 Mar 2017)
Log Message:
-----------
Take some improvements from DragonFlyBSD:
		- add const where appropriate
		- add static where appropriate
		- fix a whitespace issues

Modified Paths:
--------------
    trunk/bin/rm/rm.c

Modified: trunk/bin/rm/rm.c
===================================================================
--- trunk/bin/rm/rm.c	2017-03-04 20:24:52 UTC (rev 9374)
+++ trunk/bin/rm/rm.c	2017-03-04 20:25:24 UTC (rev 9375)
@@ -1,4 +1,4 @@
-/* $MidnightBSD: src/bin/rm/rm.c,v 1.5 2007/07/26 20:13:00 laffer1 Exp $ */
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1990, 1993, 1994
  *	The Regents of the University of California.  All rights reserved.
@@ -63,15 +63,15 @@
 uid_t uid;
 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 --
@@ -170,7 +170,7 @@
 	exit (eval);
 }
 
-void
+static void
 rm_tree(char **argv)
 {
 	FTS *fts;
@@ -413,7 +413,7 @@
  * 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;
@@ -479,8 +479,8 @@
 }
 
 
-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;
@@ -491,7 +491,7 @@
 	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.
 		 */
@@ -524,7 +524,7 @@
 }
 
 #define ISSLASH(a)	((a)[0] == '/' && (a)[1] == '\0')
-void
+static void
 checkslash(char **argv)
 {
 	char **t, **u;
@@ -544,7 +544,7 @@
 	}
 }
 
-int
+static int
 check2(char **argv)
 {
 	struct stat st;
@@ -595,7 +595,7 @@
 }
 
 #define ISDOT(a)	((a)[0] == '.' && (!(a)[1] || ((a)[1] == '.' && !(a)[2])))
-void
+static void
 checkdot(char **argv)
 {
 	char *p, **save, **t;
@@ -619,7 +619,7 @@
 	}
 }
 
-void
+static void
 usage(void)
 {
 



More information about the Midnightbsd-cvs mailing list