Qshbiff - Qmail biff



Introduction

This is a small biff I wrote for Qmail for those with a dial-up connection ie. it gets run out of ip-up or your boxes equivalent. It basically uses xmessage(1) and a Bourne compatible shell. Of course you need to be running X.


Installation

Installation is straight forward:


#!/bin/sh
#
# a qmail biff


#-------------#
### subfunc ###
#-------------#

# Counts mail


count_mail(){
    maildir="$HOME/Maildir/$1"
    mail_no=0

    for file in $(ls -1 $maildir); do
        mail_no=$(( $mail_no + 1 ))
    done
    echo $mail_no
}


#----------#
### main ###
#----------#

new_mail_no=$(count_mail new)       # call subfunc with
old_mail_no=$(count_mail cur)       #   args & assign

xmess_out=$(
echo "
  $new_mail_no new mails
 $old_mail_no read mails
 " | xmessage -buttons quit,"read mail" -print -file - )


case $xmess_out in 
    "read mail" )
        su frank -c 'xterm -e mutt'     # Edit?
        ;; 
    quit ) 
        : 
        ;;
    * )
        echo "This should not happen." 
        return 1;; 
esac



Bugs

Only tested on FreeBSD with pdksh and /bin/sh but should work on any *nix.