#!/bin/sh # unnext - Extract NeXT format mail # Brian Katzung ca. March 1992 # # This software is provided on a strictly as-is basis. # Use it at your own risk. # # /usr/ucb/mail prompt usage: # pipe "unnext [-i] " # where is the directory to be created to contain the decoded # message. # The "-i" flag will cause the text body/index file index.rtf to be # decoded and $PAGER'd to the user's terminal. case $1 in -i) # Read index file rdindx=t shift ;; *) rdindx=f ;; esac trap "rm -rf $1.Z $1" 0 # Extract and uudecode the attachment sed -n '/^begin/,/^end/{ /^begin/s!.*!begin 600 '"$1.Z"'! p }' | uudecode # Uncompress the tar file into a directory mkdir $1 zcat $1.Z | ( cd $1 tar xvf - ) rm -f "$1.Z" trap 0 case $rdindx in t) echon "Press return to read index: " read return 0<&2 rtftxt $1/index.rtf | ${PAGER:-more} ;; esac exit 0