diff options
author | Christian Neukirchen <chneukirchen@gmail.com> | 2015-10-26 15:27:22 +0100 |
---|---|---|
committer | Christian Neukirchen <chneukirchen@gmail.com> | 2015-10-26 15:27:22 +0100 |
commit | 1928de576cb2e0ee617a95f9d6c4a04284540fba (patch) | |
tree | 70e23b12dcca123502482b5e89be7025eb72aac4 | |
parent | 57ad6cb3c10ebce6c6faff36160f6fe76a5d3b58 (diff) | |
download | lr-1928de576cb2e0ee617a95f9d6c4a04284540fba.tar.gz lr-1928de576cb2e0ee617a95f9d6c4a04284540fba.tar.xz lr-1928de576cb2e0ee617a95f9d6c4a04284540fba.zip |
change fnmatch flags such that * in ~~ matches / too (like find(1))
-rw-r--r-- | README.md | 3 | ||||
-rw-r--r-- | lr.c | 16 |
2 files changed, 7 insertions, 12 deletions
diff --git a/README.md b/README.md index 7cb19a6..9d0ae0b 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ Over ls: ## Usage: - lr [-0|-F|-l|-f FMT] [-D] [-H|-L] [-1Qdhsx] [-U|-o ORD] [-t TEST]* PATH... + lr [-0|-F|-l|-f FMT] [-D] [-H|-L] [-1AQdhsx] [-U|-o ORD] [-t TEST]* PATH... * `-0`: output filenames seperated by NUL bytes (implies `-Q`). * `-F`: output filenames and an indicator of their file type (`*/=>@|`). @@ -43,6 +43,7 @@ Over ls: * `-H`: only follow symlinks on command line. * `-L`: follow all symlinks. * `-1`: don't go below one level of directories. +* `-A`: don't list files starting with a dot. * `-Q`: don't shell quote file names. * `-d`: don't enter directories. * `-h`: print human readable size for `-l` (also `%s`). diff --git a/lr.c b/lr.c index a75b739..5fc1f14 100644 --- a/lr.c +++ b/lr.c @@ -701,18 +701,12 @@ eval(struct expr *e, struct fileinfo *fi) case PROP_USER: s = username(fi->sb.st_uid); break; } switch (e->op) { - case EXPR_STREQ: - return strcmp(e->b.string, s) == 0; - case EXPR_STREQI: - return strcasecmp(e->b.string, s) == 0; - case EXPR_GLOB: - return fnmatch(e->b.string, s, FNM_PATHNAME) == 0; - case EXPR_GLOBI: - return fnmatch(e->b.string, s, - FNM_PATHNAME | FNM_CASEFOLD) == 0; + case EXPR_STREQ: return strcmp(e->b.string, s) == 0; + case EXPR_STREQI: return strcasecmp(e->b.string, s) == 0; + case EXPR_GLOB: return fnmatch(e->b.string, s, 0) == 0; + case EXPR_GLOBI: return fnmatch(e->b.string, s, FNM_CASEFOLD) == 0; case EXPR_REGEX: - case EXPR_REGEXI: - return regexec(e->b.regex, s, 0, 0, 0) == 0; + case EXPR_REGEXI: return regexec(e->b.regex, s, 0, 0, 0) == 0; } } } |