diff --git a/mblaze/m.sh b/mblaze/m.sh index da9bdcb..7c53dfd 100644 --- a/mblaze/m.sh +++ b/mblaze/m.sh @@ -22,6 +22,36 @@ Usage: exit 1 } +_mlist_i_rec_ln() +{ + if [ $# -eq 4 ]; then + printf "%6d unseen %3d flagged %6d msg %s\n" "$@" + else + printf "%6d unseen %3d flagged %6d msg\n" "$@" + fi +} + +_mlist_i_rec() +{ + tuc=0 + tfc=0 + tmc=0 + entries=0 + while IFS= read -r dir; do + mdirs "$dir" | mlist -i | tail -n 1 | { + IFS=" " read -r uc ut fc ft mc mt dummy + _mlist_i_rec_ln "$uc" "$fc" "$mc" "$dir" + tuc=$((tuc + uc)) + tfc=$((tfc + fc)) + tmc=$((tmc + mc)) + entries=$((entries + 1)) + } + done + if [ $entries -gt 1 ]; then + _mlist_i_rec_ln "$tuc" "$tfc" "$tmc" + fi +} + m_fetch_usage() { printf "Usage: %s f|fetch\n" "${0##*/}" >&2 @@ -53,7 +83,18 @@ m_list() { pwd=$(pwd) # cut(1) lists are 1-based, and +1 for leading slash - mdirs "${@:-.}" | sort -t / | cut -c $((${#pwd} + 2))- | mlist -i + pwd_offset=$((${#pwd} + 2)) + if [ $# -eq 0 ] && [ -n "$M_LIST_PATH" ]; then + oldIFS=$IFS + IFS=: + set -- $M_LIST_PATH + IFS=$oldIFS + + printf "%s\n" "$@" | sort -t / | cut -c $pwd_offset- | + _mlist_i_rec + else + mdirs "${@:-.}" | sort -t / | cut -c $pwd_offset- | mlist -i + fi } m_read()