From owner-freebsd-questions Thu Mar 28 7:55:26 2002 Delivered-To: freebsd-questions@freebsd.org Received: from draco.over-yonder.net (draco.over-yonder.net [198.78.58.61]) by hub.freebsd.org (Postfix) with ESMTP id 0932537B425 for ; Thu, 28 Mar 2002 07:55:21 -0800 (PST) Received: by draco.over-yonder.net (Postfix, from userid 100) id 94F77FC8; Thu, 28 Mar 2002 09:55:20 -0600 (CST) Date: Thu, 28 Mar 2002 09:55:20 -0600 From: "Matthew D. Fuller" To: Clint Olsen Cc: freebsd-questions@freebsd.org Subject: Re: Xbiff that works with maildir folders Message-ID: <20020328095520.J15139@over-yonder.net> References: <20020327192720.GA94751@0lsen.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5-fullermd.1i In-Reply-To: <20020327192720.GA94751@0lsen.net>; from clint@0lsen.net on Wed, Mar 27, 2002 at 11:27:20AM -0800 X-Editor: vi X-OS: FreeBSD Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Wed, Mar 27, 2002 at 11:27:20AM -0800 I heard the voice of Clint Olsen, and lo! it spake thus: > I was looking up how to write a nice test (in sh) for new mail delivery to > my spoolfile so that xbiff would work correctly. My guess is that someone > has done this already. Anyone care to share? There aren't any simple > tests(1) for directory modification. Obvious hacks possible for differing Maildir locations. Note that it doesn't QUITE duplicate the mbox behavior exactly (it tries to, but for reasons I never cared enough about to really dig into, it doesn't), but it's nearly the same. It doesn't very well handle monitoring more than one Maildir/ (or being invoked by more than one process) per user; you'd need to hack it further for that. I just use xbiff for my inbox, and use xbuffy (which has native Maildir support) for the rest. If you didn't care to try and figure out why the "non-new but unread" case isn't working, you could theoretically make it more efficient (especially when you get 4 digits or so of new/ messages) by using a /bin/ls -f instead of the -lT. #!/bin/sh # Quick check of Maildir/ for new mail # Author: Matthew Fuller # CURFILE="$HOME/.maildircheck/cur" PREVFILE="$HOME/.maildircheck/prev" /bin/mkdir -p $HOME/.maildircheck /bin/ls -lT $HOME/Maildir/new/ > $CURFILE if [ "`wc -l $CURFILE | awk '{print $1}'`" != "0" ]; then if [ -f $PREVFILE ]; then if(!(cmp -s $CURFILE $PREVFILE)); then mv $CURFILE $PREVFILE # New and unread messages exit 0 fi # Non-new but unread mv $CURFILE $PREVFILE exit 1 fi mv $CURFILE $PREVFILE exit 0 fi mv $CURFILE $PREVFILE # No messages exit 2 -- Matthew Fuller (MF4839) | fullermd@over-yonder.net Unix Systems Administrator | fullermd@futuresouth.com Specializing in FreeBSD | http://www.over-yonder.net/ "The only reason I'm burning my candle at both ends, is because I haven't figured out how to light the middle yet" To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message