aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/grep
diff options
context:
space:
mode:
authorKyle Evans <kevans@FreeBSD.org>2018-04-21 01:02:35 +0000
committerKyle Evans <kevans@FreeBSD.org>2018-04-21 01:02:35 +0000
commitf3cf3e593358c2ed25b735c5407c40292049a990 (patch)
treec6c4fa69f990307e24e256221dabb4b8ba2256dd /usr.bin/grep
parent69dcf941a42b4a14915869bef673d56236c36a79 (diff)
downloadsrc-f3cf3e593358c2ed25b735c5407c40292049a990.tar.gz
src-f3cf3e593358c2ed25b735c5407c40292049a990.zip
bsdgrep: Some light cleanup
There's no point checking for a bunch of file modes if we're not a practicing believer of DIR_SKIP or DEV_SKIP. This also reduces some style violations that were particularly ugly looking when browsing through.
Notes
Notes: svn path=/head/; revision=332850
Diffstat (limited to 'usr.bin/grep')
-rw-r--r--usr.bin/grep/util.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/usr.bin/grep/util.c b/usr.bin/grep/util.c
index 965a4138ebb5..7af2155439dc 100644
--- a/usr.bin/grep/util.c
+++ b/usr.bin/grep/util.c
@@ -308,14 +308,14 @@ procfile(const char *fn)
fn = label != NULL ? label : getstr(1);
f = grep_open(NULL);
} else {
- if (!stat(fn, &sb)) {
+ if (stat(fn, &sb) == 0) {
/* Check if we need to process the file */
s = sb.st_mode & S_IFMT;
- if (s == S_IFDIR && dirbehave == DIR_SKIP)
+ if (dirbehave == DIR_SKIP && s == S_IFDIR)
+ return (0);
+ if (devbehave == DEV_SKIP && (s == S_IFIFO ||
+ s == S_IFCHR || s == S_IFBLK || s == S_IFSOCK))
return (0);
- if ((s == S_IFIFO || s == S_IFCHR || s == S_IFBLK
- || s == S_IFSOCK) && devbehave == DEV_SKIP)
- return (0);
}
f = grep_open(fn);
}