diff options
author | Leah Neukirchen <leah@vuxu.org> | 2020-01-22 11:41:30 +0100 |
---|---|---|
committer | Leah Neukirchen <leah@vuxu.org> | 2020-01-22 11:42:02 +0100 |
commit | 113ac5a24ddc8a27ae301537d30e57006eb7d2ec (patch) | |
tree | 2f07aa630025fb32ccfbbea78949ec9a05a00b7f | |
parent | 1755fa6279ad46422c62484203b612e17c50bec0 (diff) | |
download | mblaze-113ac5a24ddc8a27ae301537d30e57006eb7d2ec.tar.gz mblaze-113ac5a24ddc8a27ae301537d30e57006eb7d2ec.tar.xz mblaze-113ac5a24ddc8a27ae301537d30e57006eb7d2ec.zip |
mdirs: add -a to list all subfolders, ignoring maildir++ convention
Based on a patch by Kylie McClain <kylie@somas.is>.
-rw-r--r-- | man/mdirs.1 | 7 | ||||
-rw-r--r-- | mdirs.c | 8 |
2 files changed, 10 insertions, 5 deletions
diff --git a/man/mdirs.1 b/man/mdirs.1 index 4eb0237..44ffae4 100644 --- a/man/mdirs.1 +++ b/man/mdirs.1 @@ -1,4 +1,4 @@ -.Dd July 22, 2016 +.Dd January 22, 2020 .Dt MDIRS 1 .Os .Sh NAME @@ -6,7 +6,7 @@ .Nd list maildir folders, recursively .Sh SYNOPSIS .Nm -.Op Fl 0 +.Op Fl 0a .Ar dirs\ ... .Sh DESCRIPTION .Nm @@ -27,11 +27,14 @@ and By the maildir++ convention, nested maildir folder names must begin with .Sq Li \&. . +.Pq This can be disabled using Fl a . .Pp The options are as follows: .Bl -tag -width Ds .It Fl 0 Print folders separated by a NUL character. +.It Fl a +Traverse into all subfolders, without considering the maildir++ name conventions. .El .Sh EXIT STATUS .Ex -std diff --git a/mdirs.c b/mdirs.c index 3c5fcbc..68b7e3f 100644 --- a/mdirs.c +++ b/mdirs.c @@ -10,6 +10,7 @@ #include "blaze822.h" static char sep = '\n'; +int aflag; void pwd() @@ -58,7 +59,7 @@ mdirs(char *fpath) d->d_name[2] == 0) continue; - if (dotonly && d->d_name[0] != '.') + if (!aflag && dotonly && d->d_name[0] != '.') continue; mdirs(d->d_name); @@ -74,12 +75,13 @@ int main(int argc, char *argv[]) { int c, i; - while ((c = getopt(argc, argv, "0")) != -1) + while ((c = getopt(argc, argv, "0a")) != -1) switch (c) { case '0': sep = '\0'; break; + case 'a': aflag = 1; break; default: usage: - fprintf(stderr, "Usage: mdirs [-0] dirs...\n"); + fprintf(stderr, "Usage: mdirs [-0a] dirs...\n"); exit(1); } |