svn commit: r191677 - head/usr.bin/du
Warner Losh
imp at FreeBSD.org
Thu Apr 30 01:24:54 UTC 2009
Author: imp
Date: Thu Apr 30 01:24:53 2009
New Revision: 191677
URL: http://svn.freebsd.org/changeset/base/191677
Log:
Report the next directory being scanned when a ^T is pressed (or any
SIGINFO). Provides some progress report for the impatient. This
won't report that we're blocking in our walk due to disk/network
problems, however. There's no really good way to report that
condition that I'm aware of...
Modified:
head/usr.bin/du/du.c
Modified: head/usr.bin/du/du.c
==============================================================================
--- head/usr.bin/du/du.c Wed Apr 29 23:04:31 2009 (r191676)
+++ head/usr.bin/du/du.c Thu Apr 30 01:24:53 2009 (r191677)
@@ -77,10 +77,12 @@ static void prthumanval(int64_t);
static void ignoreadd(const char *);
static void ignoreclean(void);
static int ignorep(FTSENT *);
+static void siginfo(int __unused);
static int nodumpflag = 0;
static int Aflag;
static long blocksize, cblocksize;
+static volatile sig_atomic_t info;
int
main(int argc, char *argv[])
@@ -248,6 +250,8 @@ main(int argc, char *argv[])
rval = 0;
+ (void)signal(SIGINFO, siginfo);
+
if ((fts = fts_open(argv, ftsoptions, NULL)) == NULL)
err(1, "fts_open");
@@ -278,6 +282,10 @@ main(int argc, char *argv[])
p->fts_path);
}
}
+ if (info) {
+ info = 0;
+ (void)printf("\t%s\n", p->fts_path);
+ }
break;
case FTS_DC: /* Ignore. */
break;
@@ -531,3 +539,10 @@ ignorep(FTSENT *ent)
return 1;
return 0;
}
+
+static void
+siginfo(int sig __unused)
+{
+
+ info = 1;
+}
More information about the svn-src-all
mailing list