dpw@unisec.usi.com (Darryl P. Wagoner) (07/21/87)
#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create the files:
# README
# email.c
# makefile
# This archive created: Sat Jul 18 11:00:48 1987
export PATH; PATH=/bin:$PATH
if test -f 'README'
then
echo shar: will not over-write existing file "'README'"
else
cat << \SHAR_EOF > 'README'
email 1.0 Mail frontend for the "letter" icon.
I have seen many articles on the Unix PC net that have asked for a way
to use the "letter" icon to invoke a different mailer. This is to answer
that need. This is not a user interface so I am not going to write a
manual page for it.
Installation:
1. Change the MAILER, defined in the makefile, to your favorite mailer.
2. run make.
3. run make install.
4. The next time you get mail, use the "letter" icon to read your mail with
your favorite mailer.
SHAR_EOF
fi # end of overwriting check
if test -f 'email.c'
then
echo shar: will not over-write existing file "'email.c'"
else
cat << \SHAR_EOF > 'email.c'
#include <stdio.h>
#include <pwd.h>
main (argc,argv)
int argc;
char *argv[];
{
struct passwd *getpwnam();
struct passwd *pwd;
int c;
int eflg,aflg,errflg;
char *username;
char home[80];
extern int optind;
extern char *optarg;
while ((c = getopt(argc,argv,"iu:")) != EOF)
switch (c) {
case 'i':
aflg++;
break;
case 'u':
username=optarg;
break;
case '?':
eflg++;
break;
}
if (errflg) {
fprintf(stderr,"usage: email -i -u username\n");
sleep(30);
exit(2);
}
if ((pwd = getpwnam(username)) == NULL) {
fprintf(stderr,"email: unknown username %s\n",username);
sleep(30);
exit(3);
}
setgid(pwd->pw_gid);
setuid(pwd->pw_uid);
strcpy(home,"HOME=");
strcat(home,pwd->pw_dir);
putenv(home);
execl(MAILER,"mail",0);
}
SHAR_EOF
fi # end of overwriting check
if test -f 'makefile'
then
echo shar: will not over-write existing file "'makefile'"
else
cat << \SHAR_EOF > 'makefile'
include /usr/include/Makepre.h
CFLAGS= -DMAILER=\"/usr/local/bin/elm\"
LDFLAGS =
email: email.o
$(LD) $(LDFLAGS) $(SHAREDLIB) -o email email.o
strip email
install: email
cp email /usr/bin/email
clean:
rm -f *.o email
SHAR_EOF
fi # end of overwriting check
# End of shell archive
exit 0
--
Darryl Wagoner
UniSecure Systems, Inc.; dpw@unisec.usi.com
Newport, RI; (401)-849-0857
UUCP: {gatech|mirror|cbosgd|uiucdcs|ihnp4}!rayssd!unisec!dpw