diff options
author | Bryan Drewery <bdrewery@FreeBSD.org> | 2018-03-07 01:55:38 +0000 |
---|---|---|
committer | Bryan Drewery <bdrewery@FreeBSD.org> | 2018-03-07 01:55:38 +0000 |
commit | fdee29d7d5d11ea64ca9d27c4d3ffe933eeb3b4e (patch) | |
tree | 47ef699c61f2c686c6502439ff77a73e82b21d85 /bin/chflags/chflags.c | |
parent | 0cc4c55e45d47bc90248a20750c21c7d8280dfa4 (diff) | |
download | src-test2-fdee29d7d5d11ea64ca9d27c4d3ffe933eeb3b4e.tar.gz src-test2-fdee29d7d5d11ea64ca9d27c4d3ffe933eeb3b4e.zip |
Notes
Diffstat (limited to 'bin/chflags/chflags.c')
-rw-r--r-- | bin/chflags/chflags.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/bin/chflags/chflags.c b/bin/chflags/chflags.c index 3121f470e13a..c1d9c18b9b6b 100644 --- a/bin/chflags/chflags.c +++ b/bin/chflags/chflags.c @@ -51,13 +51,23 @@ __FBSDID("$FreeBSD$"); #include <errno.h> #include <fcntl.h> #include <fts.h> +#include <signal.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> +static volatile sig_atomic_t siginfo; + static void usage(void); +static void +siginfo_handler(int sig __unused) +{ + + siginfo = 1; +} + int main(int argc, char *argv[]) { @@ -108,6 +118,8 @@ main(int argc, char *argv[]) if (argc < 2) usage(); + (void)signal(SIGINFO, siginfo_handler); + if (Rflag) { if (hflag) errx(1, "the -R and -h options may not be " @@ -188,13 +200,14 @@ main(int argc, char *argv[]) atflag) == -1 && !fflag) { warn("%s", p->fts_path); rval = 1; - } else if (vflag) { + } else if (vflag || siginfo) { (void)printf("%s", p->fts_path); - if (vflag > 1) + if (vflag > 1 || siginfo) (void)printf(": 0%lo -> 0%lo", (u_long)p->fts_statp->st_flags, newflags); (void)printf("\n"); + siginfo = 0; } } if (errno) |