about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--man/mdirs.17
-rw-r--r--mdirs.c9
2 files changed, 12 insertions, 4 deletions
diff --git a/man/mdirs.1 b/man/mdirs.1
index b0cf9e6..4eb0237 100644
--- a/man/mdirs.1
+++ b/man/mdirs.1
@@ -6,6 +6,7 @@
 .Nd list maildir folders, recursively
 .Sh SYNOPSIS
 .Nm
+.Op Fl 0
 .Ar dirs\ ...
 .Sh DESCRIPTION
 .Nm
@@ -27,7 +28,11 @@ By the maildir++ convention, nested maildir folder
 names must begin with
 .Sq Li \&. .
 .Pp
-There are currently no options.
+The options are as follows:
+.Bl -tag -width Ds
+.It Fl 0
+Print folders separated by a NUL character.
+.El
 .Sh EXIT STATUS
 .Ex -std
 .Sh SEE ALSO
diff --git a/mdirs.c b/mdirs.c
index 18ba9da..3c5fcbc 100644
--- a/mdirs.c
+++ b/mdirs.c
@@ -9,12 +9,14 @@
 
 #include "blaze822.h"
 
+static char sep = '\n';
+
 void
 pwd()
 {
 	char cwd[PATH_MAX];
 	if (getcwd(cwd, sizeof cwd))
-		puts(cwd);
+		printf("%s%c", cwd, sep);
 }
 
 void
@@ -72,11 +74,12 @@ int
 main(int argc, char *argv[])
 {
 	int c, i;
-	while ((c = getopt(argc, argv, "")) != -1)
+	while ((c = getopt(argc, argv, "0")) != -1)
 		switch (c) {
+		case '0': sep = '\0'; break;
 		default:
 usage:
-			fprintf(stderr, "Usage: mdirs dirs...\n");
+			fprintf(stderr, "Usage: mdirs [-0] dirs...\n");
 			exit(1);
 		}