siegel@hc.DSPO.GOV (josh Siegel) (07/23/88)
I am posting this since I have gotten several requests...
This pops up a little bubble on the screen whenever you get new
mail (for those mailaholics)...
you put something similer to:
<user>,|"<program> <machine> /<user> <socket>"
in your ".forward"
For example, this is my .forward:
siegel,|"/vc/siegel/games/mail/mail-forward sledge /siegel 2000"
also, put a : "/UserName /<user> def"
in your .NeWSrc or your local user.ps or whatever your individual
postscript initialization files are....
For example, mine contains: "/UserName /siegel def"
Send comments and suggestions back to me..
--Josh Siegel
----
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <stdio.h>
main (argc, argv)
int argc;
char *argv[];
{
char from[255],
subject[255],
cc[255],
to[255],
tmp[255],
buff[255];
int s,
n;
if (argc != 3 && argc != 4)
exit (0);
bzero (cc, sizeof (cc));
strcpy (from, "From: \\(null\\)\n");
strcpy (subject, "Subject: \\(null\\)\n");
strcpy (to, "To: \\(null\\)\n");
while (fgets (buff, 255, stdin) != NULL)
{
if (!strncmp (buff, "From:", 5))
strcpy (from, buff);
if (!strncmp (buff, "Cc:", 3))
strcpy (cc, buff);
if (!strncmp (buff, "To:", 3))
strcpy (to, buff);
if (!strncmp (buff, "Subject:", 8))
strcpy (subject, buff);
}
if (argc == 4)
s = phone (atoi (argv[3]), argv[1]);
else
s = phone (2000, argv[1]);
if (s < 0)
exit (0);
write (s, "UserName ==\n", 12);
read (s, buff, sizeof (buff));
if (strncmp (buff, argv[2], strlen (argv[2])))
exit (0);
srandom (time ((long *) 0));
if (cc[0])
sprintf (tmp, "(%s) (%s) (%s) (%s)", from, to, subject, cc);
else
sprintf (tmp, "(%s) (%s) (%s)", from, to, subject);
sprintf (buff, "%d %d [%s] popmsg pop\n", random () % 400, (random () % 700) + 100, tmp);
n = strlen (buff);
write (s, buff, n);
close (s);
exit (0);
}
phone (service, host)
int service;
char *host;
{
struct sockaddr_in sin;
struct hostent *hp;
int s;
bzero ((char *) &sin, sizeof (sin));
sin.sin_port = htons (service);
hp = gethostbyname (host);
if (hp == NULL)
return (-1);
bcopy (hp->h_addr, (char *) &sin.sin_addr, hp->h_length);
sin.sin_family = hp->h_addrtype;
s = socket (AF_INET, SOCK_STREAM, 0);
if (s < 0)
return (-1);
if (connect (s, &sin, sizeof (sin)) < 0)
return (-1);
return (s);
}
--
Josh Siegel (siegel@hc.dspo.gov)
I like using a C-47A "puff dragon" to go shooting beer cans with.