about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--man/mdirs.17
-rw-r--r--mdirs.c8
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);
 		}