chiark / gitweb /
mbox2maildir: support --help; switch to mb2md
authorColin Watson <cjwatson@chiark.greenend.org.uk>
Sat, 18 Jan 2014 15:53:25 +0000 (15:53 +0000)
committerColin Watson <cjwatson@chiark.greenend.org.uk>
Sat, 18 Jan 2014 15:53:25 +0000 (15:53 +0000)
mbox2maildir

index 42d6816..0eab9ec 100755 (executable)
@@ -1,12 +1,19 @@
 #! /bin/sh -e
 
-if [ -z "$1" ]; then
+if [ -z "$1" ] || [ "x$1" = "x--help" ]; then
     echo "Usage: $0 <mbox>" >&2
     exit 1
 fi
 
-maildirmake "$1.maildir"
-perfect-maildir "$1.maildir" < "$1"
+mbox="$1"
+if [ "${mbox#/}" = "$mbox" ]; then
+    # mb2md has stupid semantics for relative paths.
+    mbox="$(pwd)/$mbox"
+fi
+
+#maildirmake.dovecot "$1.maildir"
+#perfect-maildir "$1.maildir" < "$1"
+mb2md -s "$mbox" -d "$mbox.maildir"
 mv "$1" "$1.mbox"
 mv "$1.maildir" "$1"