From df65f3e2c911693976af6be93605142d03076488 Mon Sep 17 00:00:00 2001 From: christos Date: Sat, 21 Jan 2012 16:38:41 +0000 Subject: [PATCH] Siginfo support from Daniel Loffgren --- bin/rm/rm.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/bin/rm/rm.c b/bin/rm/rm.c index ad39865bc77b..0b5372541956 100644 --- a/bin/rm/rm.c +++ b/bin/rm/rm.c @@ -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, 1993, 1994\ #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 14:48:46 joerg Exp $"); #include #include #include +#include #include #include #include #include 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++; +}