Page MenuHomeFreeBSD

D43380.diff
No OneTemporary

D43380.diff

diff --git a/usr.bin/find/extern.h b/usr.bin/find/extern.h
--- a/usr.bin/find/extern.h
+++ b/usr.bin/find/extern.h
@@ -121,3 +121,4 @@
extern time_t now;
extern int dotfd;
extern FTS *tree;
+extern volatile sig_atomic_t showinfo;
diff --git a/usr.bin/find/find.c b/usr.bin/find/find.c
--- a/usr.bin/find/find.c
+++ b/usr.bin/find/find.c
@@ -167,6 +167,7 @@
{
FTSENT *entry;
PLAN *p;
+ size_t counter = 0;
int e;
tree = fts_open(paths, ftsoptions, (issort ? find_compare : NULL));
@@ -208,6 +209,14 @@
continue;
#endif /* FTS_W */
}
+
+ if (showinfo) {
+ fprintf(stderr, "Scanning: %s/%s\n", entry->fts_path, entry->fts_name);
+ fprintf(stderr, "Scanned: %lu\n\n", counter);
+ showinfo = 0;
+ }
+ ++counter;
+
#define BADCH " \t\n\\'\""
if (isxargs && strpbrk(entry->fts_path, BADCH)) {
(void)fflush(stdout);
diff --git a/usr.bin/find/main.c b/usr.bin/find/main.c
--- a/usr.bin/find/main.c
+++ b/usr.bin/find/main.c
@@ -59,8 +59,10 @@
int mindepth = -1, maxdepth = -1; /* minimum and maximum depth */
int regexp_flags = REG_BASIC; /* use the "basic" regexp by default*/
int exitstatus;
+volatile sig_atomic_t showinfo = 0;
static void usage(void) __dead2;
+static void siginfo_handler(int sig __unused);
int
main(int argc, char *argv[])
@@ -72,6 +74,8 @@
(void)time(&now); /* initialize the time-of-day */
+ (void)signal(SIGINFO, siginfo_handler);
+
p = start = argv;
Hflag = Lflag = 0;
ftsoptions = FTS_NOSTAT | FTS_PHYSICAL;
@@ -152,3 +156,9 @@
" find [-H | -L | -P] [-EXdsx] -f path [path ...] [expression]");
exit(1);
}
+
+static void
+siginfo_handler(int sig __unused)
+{
+ showinfo = 1;
+}

File Metadata

Mime Type
text/plain
Expires
Thu, Jan 16, 3:15 PM (17 h, 28 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15826699
Default Alt Text
D43380.diff (1 KB)

Event Timeline