summaryrefslogtreecommitdiff
path: root/bin/rm
diff options
context:
space:
mode:
authorchristos <christos@NetBSD.org>1997-07-20 20:51:08 +0000
committerchristos <christos@NetBSD.org>1997-07-20 20:51:08 +0000
commit25b23032f56d5dc40d8a24bebf2dd4e98c4475fd (patch)
tree780037900b93df75d5696823b200c3b22b213e6f /bin/rm
parentf43c13bff44c4cbcec76dc7cfdbd0cbbb6c8018e (diff)
Fix compiler warnings.
Add WARNS=1
Diffstat (limited to 'bin/rm')
-rw-r--r--bin/rm/Makefile3
-rw-r--r--bin/rm/rm.c28
2 files changed, 19 insertions, 12 deletions
diff --git a/bin/rm/Makefile b/bin/rm/Makefile
index e4759870891..a708cce9ad6 100644
--- a/bin/rm/Makefile
+++ b/bin/rm/Makefile
@@ -1,6 +1,7 @@
-# $NetBSD: Makefile,v 1.7 1995/03/21 09:08:20 cgd Exp $
+# $NetBSD: Makefile,v 1.8 1997/07/20 20:51:08 christos Exp $
# @(#)Makefile 8.1 (Berkeley) 5/31/93
+WARNS= 1
PROG= rm
.include <bsd.prog.mk>
diff --git a/bin/rm/rm.c b/bin/rm/rm.c
index 3ed91f469d7..b0ed3c00cbe 100644
--- a/bin/rm/rm.c
+++ b/bin/rm/rm.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rm.c,v 1.19 1995/09/07 06:48:50 jtc Exp $ */
+/* $NetBSD: rm.c,v 1.20 1997/07/20 20:51:09 christos Exp $ */
/*-
* Copyright (c) 1990, 1993, 1994
@@ -33,17 +33,17 @@
* SUCH DAMAGE.
*/
+#include <sys/cdefs.h>
#ifndef lint
-static char copyright[] =
-"@(#) Copyright (c) 1990, 1993, 1994\n\
- The Regents of the University of California. All rights reserved.\n";
+__COPYRIGHT("@(#) Copyright (c) 1990, 1993, 1994\n\
+ The Regents of the University of California. All rights reserved.\n");
#endif /* not lint */
#ifndef lint
#if 0
static char sccsid[] = "@(#)rm.c 8.8 (Berkeley) 4/27/95";
#else
-static char rcsid[] = "$NetBSD: rm.c,v 1.19 1995/09/07 06:48:50 jtc Exp $";
+__RCSID("$NetBSD: rm.c,v 1.20 1997/07/20 20:51:09 christos Exp $");
#endif
#endif /* not lint */
@@ -59,6 +59,8 @@ static char rcsid[] = "$NetBSD: rm.c,v 1.19 1995/09/07 06:48:50 jtc Exp $";
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <pwd.h>
+#include <grp.h>
int dflag, eval, fflag, iflag, Pflag, Wflag, stdin_ok;
@@ -68,6 +70,7 @@ void rm_file __P((char **));
void rm_overwrite __P((char *, struct stat *));
void rm_tree __P((char **));
void usage __P((void));
+int main __P((int, char *[]));
/*
* rm --
@@ -159,8 +162,9 @@ rm_tree(argv)
flags |= FTS_NOSTAT;
if (Wflag)
flags |= FTS_WHITEOUT;
- if (!(fts = fts_open(argv, flags, (int (*)())NULL)))
- err(1, NULL);
+ if (!(fts = fts_open(argv, flags,
+ (int (*) __P((const FTSENT **, const FTSENT **)))NULL)))
+ err(1, "%s", "");
while ((p = fts_read(fts)) != NULL) {
switch (p->fts_info) {
case FTS_DNR:
@@ -212,20 +216,22 @@ rm_tree(argv)
switch (p->fts_info) {
case FTS_DP:
case FTS_DNR:
- if (!rmdir(p->fts_accpath) || fflag && errno == ENOENT)
+ if (!rmdir(p->fts_accpath) ||
+ (fflag && errno == ENOENT))
continue;
break;
case FTS_W:
if (!undelete(p->fts_accpath) ||
- fflag && errno == ENOENT)
+ (fflag && errno == ENOENT))
continue;
break;
default:
if (Pflag)
rm_overwrite(p->fts_accpath, NULL);
- if (!unlink(p->fts_accpath) || fflag && errno == ENOENT)
+ if (!unlink(p->fts_accpath) ||
+ (fflag && errno == ENOENT))
continue;
}
warn("%s", p->fts_path);
@@ -385,7 +391,7 @@ check(path, name, sp)
* Since POSIX.2 defines basename as the final portion of a path after
* trailing slashes have been removed, we'll remove them here.
*/
-#define ISDOT(a) ((a)[0] == '.' && (!(a)[1] || (a)[1] == '.' && !(a)[2]))
+#define ISDOT(a) ((a)[0] == '.' && (!(a)[1] || ((a)[1] == '.' && !(a)[2])))
void
checkdot(argv)
char **argv;