Cocksuckstress, and I should know.
Jan. 17th, 2006 05:46 pmThis could be, line for line, the most horrible shell script I have ever perpetrated. At least it admits it.
#!/usr/bin/ksh
# XXX_XXXX_receive
# Receives mail to user mail_in, saves attachments, deletes mail
#
# D. Gerard 17-Jan-2006 First version
# This version is horribly inefficient,
# but it works and it's very clear what it does.
# A more efficient version would process the
# mailbox file itself to extract the message.
# This script requires the installation of munpack to decode the attachments
# - see http://www.uwsg.iu.edu/usail/mail/mime/munpack.html
# http://asg.web.cmu.edu/andrew2/staff/jgm/
# http://www.sunfreeware.com/programlistsparc8.html#mpack
# this is where our incoming files end up
SAVEDIR=/tmp/XXXX_receive
# is there any mail at all?
if mailx -e -u mail_in
then
# We have mail.
# Loop through mailbox one message at a time
while mailx -e -u mail_in
do
# We go into mailx, print a message and delete it
# note that /home/mail_in/.mailrc contains:
# set quiet
# unset header
# set prompt=""
# Then we extract attachment if any (not text)
(echo P; echo d; echo q) | mailx -Bn -u mail_in | munpack -C $SAVEDIR
done
rm /tmp/$$
rm -f $SAVEDIR/*.desc
fi
My geeky readers are about to tell me how I should have done it. But that doesn't account for the law of conservation of programmer mental effort. Besides, this is proprietary software; I have standards to work to.
(no subject)
Date: 2006-01-17 05:56 pm (UTC)(no subject)
Date: 2006-01-17 06:00 pm (UTC)(no subject)
Date: 2006-01-17 06:02 pm (UTC)(no subject)
Date: 2006-01-17 06:06 pm (UTC)(no subject)
Date: 2006-01-17 06:08 pm (UTC)(no subject)
Date: 2006-01-17 06:11 pm (UTC)(no subject)
Date: 2006-01-17 06:23 pm (UTC)(no subject)
Date: 2006-01-17 06:25 pm (UTC)(no subject)
Date: 2006-01-17 06:31 pm (UTC)(no subject)
Date: 2006-01-17 06:12 pm (UTC)(no subject)
Date: 2006-01-17 06:06 pm (UTC)(no subject)
Date: 2006-01-17 06:17 pm (UTC)(no subject)
Date: 2006-01-17 06:21 pm (UTC)(no subject)
Date: 2006-01-17 06:28 pm (UTC)(no subject)
Date: 2006-01-17 06:30 pm (UTC)(no subject)
Date: 2006-01-17 06:38 pm (UTC)(no subject)
Date: 2006-01-17 06:29 pm (UTC)(no subject)
Date: 2006-01-17 06:30 pm (UTC)(no subject)
Date: 2006-01-17 11:50 pm (UTC)awk 'BEGIN { cnt=0; } /^From / { cnt++; } {print >> cnt; ]' < $MAIL
Lands you with files numbered from 1 upwards, in the current directory, one mail per file, using Standard Mbox File Format (line starting "From " is the first line of a new mail, that's why "From" first on a line gets mangled to ">From").
On the other hand, that'd probably be considered "abstruse awk" and that type of thing can land you in the awk-ward.
(no subject)
Date: 2006-01-18 12:38 am (UTC)(no subject)
Date: 2006-01-17 07:43 pm (UTC)(no subject)
Date: 2006-01-17 08:09 pm (UTC)The DEC box could do graphics using ony one of two makes and models of video card and was limited to, I believe, 640x480 resolution. This fine program lacked the standard resizable windows and needed at least 800x600 in order not to truncate the display (which included the names and time/date stamps of the files available to restore). Their engineers just couldn't understand that a server just might not have a large monitor at its console and a gamer's video card (this was the mid-1990s). They'd have been happy to add resizable windows as a customization if we'd pay them to. Bastards.
(no subject)
Date: 2006-01-18 12:26 am (UTC)Totally off topic!
Date: 2006-01-18 12:25 am (UTC)http://tate.org.uk/britain/exhibitions/gothicnightmares/default.shtm
With my aromatherapy business, each line is associated with a particular famous painting. The first cab off the rank was a "Nightmare Mist" and this is the painting for that range (my print of it is being framed as we speak) :)
I was wondering if you could please keep an eye out for any free literature or brochures about the exhibition and post them to me? I'd be eternally grateful!
Re: Totally off topic!
Date: 2006-01-18 12:26 am (UTC)Re: Totally off topic!
Date: 2006-01-18 12:31 am (UTC)Postal address is
Miss Havisham
PO Box 615
Marrickville
NSW 1475
(no subject)
Date: 2006-01-18 04:56 am (UTC)I figure you spent about as long making sure the commands to mailx did the right thing across the board as you could have spent reading docs.