Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/bin/rm Siginfo support from Daniel Loffgren



details:   https://anonhg.NetBSD.org/src/rev/359bea38dd48
branches:  trunk
changeset: 772911:359bea38dd48
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Jan 21 16:38:41 2012 +0000

description:
Siginfo support from Daniel Loffgren

diffstat:

 bin/rm/rm.c |  20 +++++++++++++++++---
 1 files changed, 17 insertions(+), 3 deletions(-)

diffs (69 lines):

diff -r 17c188580145 -r 359bea38dd48 bin/rm/rm.c
--- a/bin/rm/rm.c       Sat Jan 21 16:12:57 2012 +0000
+++ b/bin/rm/rm.c       Sat Jan 21 16:38:41 2012 +0000
@@ -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 @@
 #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 @@
 #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 @@
                usage();
        }
 
+       (void)signal(SIGINFO, progress);
+
        checkdot(argv);
 
        if (*argv) {
@@ -252,8 +257,10 @@
                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 @@
        exit(1);
        /* NOTREACHED */
 }
+
+static void
+progress(int sig __unused)
+{
+       
+       pinfo++;
+}



Home | Main Index | Thread Index | Old Index