Siginfo support from Daniel Loffgren
This commit is contained in:
parent
65ab8f813e
commit
df65f3e2c9
20
bin/rm/rm.c
20
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 <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,9 +257,11 @@ 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");
|
||||
fts_close(fts);
|
||||
|
@ -579,3 +586,10 @@ usage(void)
|
|||
exit(1);
|
||||
/* NOTREACHED */
|
||||
}
|
||||
|
||||
static void
|
||||
progress(int sig __unused)
|
||||
{
|
||||
|
||||
pinfo++;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue