9fans archive / 1999 / 05 / 29 / prev next
From: okamoto@gra... okamoto@gra...
Subject: [9fans] listen the sender name from mail
Date: Mon, 17 May 1999 11:24:18 +0900
I finally made a small change to /acme/mail/src/box.l (and
fns.h if neccessary), and now it appears to work fine.
However, this is my first time to write Alef program, and
am not still have confidence that i'm on the right way.
The changes are as follows, and please make coments on this.
Thanks
Kenji
----------cut here--------
/acme/mail/src/box.l
in Box.readmore() function:
add an declaration of
chan(byte*) speak;
and add lines i if(new) block like:
b->wshow();
alloc speak;
proc say(speak);
speak <-=buf;
}
and add a function called from the line say() like:
void
say(chan(byte*)speak)
{
byte *mesg[6], *user, *subj, *msg;
if(strcmp(getenv("cputype"), "sparc") != 0) {
rfork(RFFDG|RFNOTEG);
msg = <-speak;
if(!strchr(msg, '!'))
user = strchr(msg, '\t') + 1;
else
user = strchr(msg, '!') + 1;
subj = strchr(msg, '\n') + 2;
mesg[0] = "Say";
mesg[1] = "a New mail arrived from";
mesg[2] = strdup(user);
*strchr(mesg[2], '\t') = '\0';
mesg[3] = "with subject line as";
mesg[4] = strdup(subj);
mesg[5] = "";
exec("/rc/bin/Say", mesg);
}
terminate(nil);
}
------end of lines------