From owner-svn-src-all@FreeBSD.ORG Wed Apr 29 18:08:19 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 243C8106566C; Wed, 29 Apr 2009 18:08:19 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EC6C08FC1A; Wed, 29 Apr 2009 18:08:18 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3TI8IxK087080; Wed, 29 Apr 2009 18:08:18 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3TI8IJ0087079; Wed, 29 Apr 2009 18:08:18 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200904291808.n3TI8IJ0087079@svn.freebsd.org> From: Warner Losh Date: Wed, 29 Apr 2009 18:08:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191670 - head/bin/rm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Apr 2009 18:08:19 -0000 Author: imp Date: Wed Apr 29 18:08:18 2009 New Revision: 191670 URL: http://svn.freebsd.org/changeset/base/191670 Log: Implement ^T support for rm: now it will report the next file it removes when you hit ^T. This is similar to what's done for cp. The signal handler and type definitions for "info" were borrowed directly from cp. Modified: head/bin/rm/rm.c Modified: head/bin/rm/rm.c ============================================================================== --- head/bin/rm/rm.c Wed Apr 29 17:50:48 2009 (r191669) +++ head/bin/rm/rm.c Wed Apr 29 18:08:18 2009 (r191670) @@ -60,6 +60,7 @@ __FBSDID("$FreeBSD$"); int dflag, eval, fflag, iflag, Pflag, vflag, Wflag, stdin_ok; int rflag, Iflag; uid_t uid; +volatile sig_atomic_t info; int check(char *, char *, struct stat *); int check2(char **); @@ -68,6 +69,7 @@ void checkslash(char **); void rm_file(char **); int rm_overwrite(char *, struct stat *); void rm_tree(char **); +static void siginfo(int __unused); void usage(void); /* @@ -150,6 +152,7 @@ main(int argc, char *argv[]) checkslash(argv); uid = geteuid(); + (void)signal(SIGINFO, siginfo); if (*argv) { stdin_ok = isatty(STDIN_FILENO); @@ -266,6 +269,11 @@ rm_tree(char **argv) if (rval == 0 && vflag) (void)printf("%s\n", p->fts_path); + if (rval == 0 && info) { + info = 0; + (void)printf("%s\n", + p->fts_path); + } continue; } break; @@ -276,6 +284,11 @@ rm_tree(char **argv) if (vflag) (void)printf("%s\n", p->fts_path); + if (info) { + info = 0; + (void)printf("%s\n", + p->fts_path); + } continue; } break; @@ -297,6 +310,11 @@ rm_tree(char **argv) if (rval == 0 && vflag) (void)printf("%s\n", p->fts_path); + if (rval == 0 && info) { + info = 0; + (void)printf("%s\n", + p->fts_path); + } continue; } } @@ -369,6 +387,10 @@ rm_file(char **argv) } if (vflag && rval == 0) (void)printf("%s\n", f); + if (info && rval == 0) { + info = 0; + (void)printf("%s\n", f); + } } } @@ -592,3 +614,10 @@ usage(void) " unlink file"); exit(EX_USAGE); } + +static void +siginfo(int sig __unused) +{ + + info = 1; +}