I put the attached little script together to provide an easy way to
decode and view the X-Face: attachments that are frequently included
in e-mail headers.  Now I can just pipe an X-Face-equiped mail message
into the showface script to see who sent me e-mail.  The showface
script will extract the first X-Face record read from stdin, decode
it, and display the result using xv if run with X available, or using
pbmtoascii if run on a character cell terminal.

Use, share, and enjoy.

-- John Kodis.


#! /bin/sh

if [ -z $VIEWER ]; then
    if [ -z "$DISPLAY" ]; then
        VIEWER=pbmtoascii
    else
        VIEWER='xv -expand 2 -smooth -'
    fi
fi

(   echo '/* Format_version=1, Valid_bits_per_item=16,'
    echo '   Width=48, Height=48, Depth=1 */'
    perl -n -e '!$& && 
        /^X-Face:/i .. !(/^X-Face:/i && print $'\'' or /^\s/ && print)' |
    uncompface -
) | icontopbm | $VIEWER

Reply via email to