Module Name: src
Committed By: christos
Date: Sat Jan 21 16:38:41 UTC 2012
Modified Files:
src/bin/rm: rm.c
Log Message:
Siginfo support from Daniel Loffgren
To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/bin/rm/rm.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/bin/rm/rm.c
diff -u src/bin/rm/rm.c:1.50 src/bin/rm/rm.c:1.51
--- src/bin/rm/rm.c:1.50 Mon Aug 29 10:48:46 2011
+++ src/bin/rm/rm.c Sat Jan 21 11:38:41 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: rm.c,v 1.50 2011/08/29 14:48:46 joerg Exp $ */
+/* $NetBSD: rm.c,v 1.51 2012/01/21 16:38:41 christos Exp $ */
/*-
* Copyright (c) 1990, 1993, 1994, 2003
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1990, 19
#if 0
static char sccsid[] = "@(#)rm.c 8.8 (Berkeley) 4/27/95";
#else
-__RCSID("$NetBSD: rm.c,v 1.50 2011/08/29 14:48:46 joerg Exp $");
+__RCSID("$NetBSD: rm.c,v 1.51 2012/01/21 16:38:41 christos Exp $");
#endif
#endif /* not lint */
@@ -54,15 +54,18 @@ __RCSID("$NetBSD: rm.c,v 1.50 2011/08/29
#include <grp.h>
#include <locale.h>
#include <pwd.h>
+#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
static int dflag, eval, fflag, iflag, Pflag, stdin_ok, vflag, Wflag;
+static sig_atomic_t pinfo;
static int check(char *, char *, struct stat *);
static void checkdot(char **);
+static void progress(int);
static void rm_file(char **);
static int rm_overwrite(char *, struct stat *);
static void rm_tree(char **);
@@ -131,6 +134,8 @@ main(int argc, char *argv[])
usage();
}
+ (void)signal(SIGINFO, progress);
+
checkdot(argv);
if (*argv) {
@@ -252,8 +257,10 @@ rm_tree(char **argv)
if (rval != 0) {
warn("%s", p->fts_path);
eval = 1;
- } else if (vflag)
+ } else if (vflag || pinfo) {
+ pinfo = 0;
(void)printf("%s\n", p->fts_path);
+ }
}
if (errno)
err(1, "fts_read");
@@ -579,3 +586,10 @@ usage(void)
exit(1);
/* NOTREACHED */
}
+
+static void
+progress(int sig __unused)
+{
+
+ pinfo++;
+}