[comp.sources.misc] v03i083: faces - a visual mail and print monitor for Suns. Part 2 of 2.

richb@sunaus.oz.AU (Rich Burridge) (07/18/88)

comp.sources.misc: Volume 3, Issue 83
Submitted-by: Rich Burridge <richb@sunaus.oz.AU>
Archive-Name: faces


------CUT HERE------CUT HERE------
#! /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 to create the files:
#	extern.h
#	faces.h
#	patchlevel.h
#	bounced.icon
#	noface.icon
#	nomail.icon
#	noprint.icon
#	faces.1
#	Makefile
#	README
# This archive created: Thu Jul 14 13:58:14 EST 1988
#
#
export PATH; PATH=/bin:$PATH
#
if [ -f extern.h ]
then
echo shar: will not over-write existing file extern.h
else
echo shar: extracting 'extern.h',     2422 characters
cat > extern.h <<'Funky_Stuff'

/*  extern.h
 *
 *  Contains the external variable definitions used by faces.
 *
 *  Copyright (c) Rich Burridge - July 1988.
 *                Sun Microsystems, Australia - All rights reserved.
 *
 *  Permission is given to distribute these sources, as long as the
 *  copyright messages are not removed, and no monies are exchanged. 
 *
 *  Version 1.1.
 *
 *  No responsibility is taken for any errors or inaccuracies inherent
 *  either to the comments or the code of this program, but if
 *  reported to me then an attempt will be made to fix them.
 */

extern char *get_field(), *getname() ;
extern int do_check() ;
struct recinfo *rec_exists() ;

extern struct recinfo *recs ;    /* Mail messages being monitored. */
extern struct recinfo *last ;    /* End of the chain of mail records. */
extern struct stat buf ;         /* Buffer for stat call for file existence. */
extern long lastsize ;           /* Last known size of the mail folder. */
extern enum mon_type mtype ;     /* What type of monitoring we should do. */

extern char bounced_ts[] ;    /* Time stamp for bounced messages. */
extern char defhost[] ;       /* Default host for mail with no hostname. */
extern char facedir[] ;       /* Directory containing face images. */
extern char iconname[] ;      /* Name of the icon file for this person. */
extern char nextline[] ;      /* Next line from users mail spool file. */
extern char printer[] ;       /* Printer name to monitor. */
extern char progname[] ;      /* Name of this program. */
extern char spoolfile[] ;     /* Full pathname of users current mail. */
extern char unknown_ts[] ;    /* Time stamp for "no face" messages. */

extern int bounced ;       /* Number of bounced MAILER-DAEMONS. */
extern int column ;        /* Column number for next icon. */
extern int dontshowno ;    /* Set if number of messages is to be shown. */
extern int dontshowtime ;  /* Set if timestamp for new mail is to be shown. */
extern int height ;        /* Height in pixels of faces display. */
extern int interval ;      /* Interval in seconds for checking new mail. */
extern int noicons ;       /* Number of faces this time around. */
extern int row ;           /* Row number for next icon. */
extern int total ;         /* Total number of new messages. */
extern int unknown ;       /* Count of number of mail messages with no face. */
extern int width ;         /* Width in pixels of faces display. */
Funky_Stuff
len=`wc -c < extern.h`
if [ $len !=     2422 ] ; then
echo error: extern.h was $len bytes long, should have been     2422
fi
fi # end of overwriting check
if [ -f faces.h ]
then
echo shar: will not over-write existing file faces.h
else
echo shar: extracting 'faces.h',     2808 characters
cat > faces.h <<'Funky_Stuff'

/*  faces.h
 *
 *  Contains all the global definitions used by faces.
 *
 *  Copyright (c) Rich Burridge - Sun Microsystems Australia.
 *                                All rights reserved.
 *
 *  Permission is given to distribute these sources, as long as the
 *  copyright messages are not removed, and no monies are exchanged. 
 *
 *  Version 1.1 - July 1988.
 *
 *  No responsibility is taken for any errors or inaccuracies inherent
 *  either to the comments or the code of this program, but if
 *  reported to me then an attempt will be made to fix them.
 */

#include <stdio.h>
#include <sys/types.h>
#include <sys/file.h>
#include <sys/stat.h>
#include <pwd.h>
#include <strings.h>

#define  FCLOSE      (void) fclose      /* To make lint happy. */
#define  FGETS       (void) fgets
#define  FPRINTF     (void) fprintf
#define  FSEEK       (void) fseek
#define  PRINTF      (void) printf
#define  SSCANF      (void) sscanf
#define  SPRINTF     (void) sprintf
#define  STAT        (void) stat
#define  STRCAT      (void) strcat
#define  STRCPY      (void) strcpy
#define  STRNCAT     (void) strncat
#define  UNLINK      (void) unlink

/* The types of display. */
enum disp_type { BOTH, ICON, WINDOW } ;

/* Field extraction options. */
enum field_type { HOSTNAME, TIMESTAMP, USERNAME } ;

/* Different types of possible face images. */
enum icon_type { MAILERD, NOFACE, NOMAIL, NOPRINT, ORDINARY } ;

/* Text justification within face display. */
enum just_type { TOPLEFT, TOPRIGHT, BOTTOMLEFT, BOTTOMRIGHT } ;

/* Different types of file monitoring performed by this program. */
enum mon_type { MONALL, MONNEW, MONPRINTER } ;

#define  ADJUST          if (++column == NO_PER_ROW) \
                           { column = 0 ; row++ ; }
#define  DEC             { argc++ ; argv-- ; }
#define  EQUAL(str,val)  !strncmp(str,val,strlen(val))
#define  ICONHEIGHT      64   /* Height of individual face icons. */
#define  ICONWIDTH       64   /* Width of individual face icons. */
#define  INC             { argc-- ; argv++ ; }
#define  MAXLINE         80   /* Maximum length for character strings. */
#define  NO_PER_ROW      10   /* Number of faces per row. */
#define  MAXROWS         10   /* Maximum number of rows of faces. */

char *malloc(), *sprintf() ;

struct recinfo                /* Mail/print information record. */
  {
    char *hostname ;          /* Host name for this person. */
    char *iconname ;          /* Name of iconfile for this person. */
    char *username ;          /* User name for this person. */
    int total ;               /* Total number of messages/print jobs. */
    int size ;                /* Total size in bytes of print job. */
    char ts[6] ;              /* Latest timestamp for this user. */
    struct recinfo *next ;    /* Pointer to next record. */
  } ;
Funky_Stuff
len=`wc -c < faces.h`
if [ $len !=     2808 ] ; then
echo error: faces.h was $len bytes long, should have been     2808
fi
fi # end of overwriting check
if [ -f patchlevel.h ]
then
echo shar: will not over-write existing file patchlevel.h
else
echo shar: extracting 'patchlevel.h',      575 characters
cat > patchlevel.h <<'Funky_Stuff'
 
/*  patchlevel.h
 *
 *  This is the current patch level for this version of faces.
 *
 *  Copyright (c) Rich Burridge - July 1988.
 *		Sun Microsystems, Australia - All rights reserved.
 *
 *  Permission is given to distribute these sources, as long as the
 *  copyright messages are not removed, and no monies are exchanged. 
 *
 *  Version 1.1.
 *
 *  No responsibility is taken for any errors or inaccuracies inherent
 *  either to the comments or the code of this program, but if
 *  reported to me then an attempt will be made to fix them.
 */

#define  PATCHLEVEL  2
Funky_Stuff
len=`wc -c < patchlevel.h`
if [ $len !=      575 ] ; then
echo error: patchlevel.h was $len bytes long, should have been      575
fi
fi # end of overwriting check
if [ -f bounced.icon ]
then
echo shar: will not over-write existing file bounced.icon
else
echo shar: extracting 'bounced.icon',     1934 characters
cat > bounced.icon <<'Funky_Stuff'
/* Format_version=1, Width=64, Height=64, Depth=1, Valid_bits_per_item=16
 */
	0x0001,0xffff,0xffc0,0x0000,0x0002,0xb000,0x0030,0x0000,
	0x0003,0x5800,0x0008,0x0000,0x0006,0xadff,0xffc8,0x0000,
	0x0005,0x54ff,0xffe4,0x0000,0x000a,0xaaf7,0xfdf2,0x0000,
	0x020d,0x5673,0xf9f2,0x0000,0x060a,0xaa61,0xf0fa,0x0000,
	0x0e0d,0x5568,0xe8f9,0x0000,0x1e0a,0xab71,0xf1f9,0x0000,
	0x0e0d,0x557f,0xfff9,0x0000,0x0a0a,0xab3f,0xfff1,0x0000,
	0x080d,0x5500,0x0001,0x0000,0x080a,0xab00,0x0001,0x0000,
	0x080d,0x5500,0x9e01,0x0000,0x0dea,0xab03,0x9f81,0x0000,
	0x073d,0x5507,0x83c1,0x0000,0x001a,0xab0f,0x81e1,0x0000,
	0x001d,0x551f,0x80f1,0x0000,0x000a,0xab1f,0x80f1,0x0000,
	0x000d,0x553f,0x80f9,0x0000,0x000a,0xab3f,0x80f9,0x0000,
	0x000d,0x553f,0x80f9,0x0000,0x000a,0xab3f,0x80f9,0x0000,
	0x0ffd,0x553f,0x81f9,0x0000,0x3ffa,0xab3f,0x83f9,0x0000,
	0x7ffd,0x553f,0x9ff9,0x0000,0xfffa,0xab3f,0x9ff9,0x0000,
	0xfffd,0x551f,0x9ff1,0x0000,0xfffa,0xab1f,0x9ff1,0x0000,
	0xfffd,0x550f,0x9fe1,0x0000,0xfffa,0xab07,0x9fc1,0x0000,
	0xfffd,0xd503,0x9f81,0x0000,0x7ffb,0xeb00,0x9e01,0x0000,
	0x3ffd,0xf500,0x0001,0x0000,0x1ffb,0xfb00,0x0001,0x0000,
	0x0ffd,0xfd0f,0xffe1,0x0000,0x07fb,0xfb1f,0xffd1,0x0000,
	0x01fd,0xfd3f,0xf7c9,0x0000,0x00ff,0xff7f,0xf8c5,0x0000,
	0x003f,0xfd7f,0xfc45,0x0000,0x001f,0xff7f,0xfe05,0x0000,
	0x0007,0xf540,0x3f85,0x0000,0x0003,0xf740,0x0fc5,0x0000,
	0x0000,0xfd40,0x01f5,0x0000,0x0000,0x3f40,0x007d,0x0000,
	0x0000,0x0740,0x003d,0x0000,0x0000,0x01c0,0x000f,0x0000,
	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
Funky_Stuff
len=`wc -c < bounced.icon`
if [ $len !=     1934 ] ; then
echo error: bounced.icon was $len bytes long, should have been     1934
fi
fi # end of overwriting check
if [ -f noface.icon ]
then
echo shar: will not over-write existing file noface.icon
else
echo shar: extracting 'noface.icon',     1933 characters
cat > noface.icon <<'Funky_Stuff'
/* Format_version=1, Width=64, Height=64, Depth=1, Valid_bits_per_item=16
 */
	0x0000,0x01FF,0xC000,0x0000,0x7C00,0x1FFF,0xE000,0x0000,
	0x8200,0xFFFF,0xE000,0x0000,0x8207,0xFFFF,0xF000,0x0000,
	0x620F,0xFFFF,0xFF80,0x0000,0x040F,0xFFFF,0xFFE0,0x0000,
	0x080F,0xFFFF,0xFFF0,0x0000,0x100F,0xFFFF,0xF7F0,0x0000,
	0x2007,0xFFFF,0xF7F0,0x0000,0x0007,0xFFFF,0x8FE0,0x0000,
	0x2007,0xFFFE,0x7F80,0x0000,0x2007,0xFFF9,0xFE00,0x0000,
	0x000D,0xFFE7,0xFE00,0x0000,0x103E,0x7F9F,0xFE00,0x0000,
	0x007F,0x807F,0xFE00,0x0000,0x20FF,0xFFFF,0xFE00,0x0000,
	0x81FF,0xFFFF,0xFE00,0x0000,0x01FF,0xFFFB,0x8E00,0x0000,
	0x81FF,0xFFE1,0xF600,0x0000,0x21FF,0xFFE7,0xF600,0x0000,
	0x09FF,0xFFFF,0x0600,0x0000,0x00FF,0xFFFC,0x7F80,0x0000,
	0x0877,0xF7F0,0x3FC0,0x0000,0x2007,0xF7E0,0x1FC0,0x0000,
	0x0003,0xE7E0,0x7FC0,0x0000,0x4001,0xC3C3,0xFFC0,0x0000,
	0x1000,0x800F,0xFF80,0x0000,0x0407,0x803F,0xFF80,0x0000,
	0x0007,0x83FF,0xFF80,0x0000,0x00BF,0xFBFF,0xFF80,0x0000,
	0x00A0,0x1FFF,0xFF80,0x0000,0x00BF,0xFFFF,0xFF80,0x0000,
	0x0001,0xFFFF,0xFF80,0x0000,0x0001,0xF7FF,0xF180,0x0000,
	0x001F,0xFFFF,0xCFC0,0x0000,0x007E,0xFFFC,0x3FE0,0x0000,
	0x01FF,0x3FC3,0xFFF8,0x0000,0x07FF,0xDF3F,0xFFFE,0x0000,
	0x0FFF,0xF0FF,0xFFFF,0x0000,0x1FFF,0xCFFF,0xFFFF,0xC000,
	0x3FFF,0xDFFF,0xFFFF,0xE000,0x3FFF,0xD9FF,0xFFFF,0xE000,
	0x7FFF,0xD9FF,0xFFFF,0xE000,0x7FFF,0xDFFF,0xFFFF,0xF000,
	0xFFFF,0xBFC0,0x07FF,0xF000,0xFFFF,0xBFDF,0xF7FF,0xF800,
	0xFFFF,0xBFDF,0xF7FF,0xF800,0xFFFF,0xBFDF,0xF7FF,0xFC00,
	0xFFFF,0xBFDF,0xF7FF,0xFC00,0xFFFF,0x7FFF,0xFFFF,0xFE00,
	0xFFFF,0x7FFF,0xFFFF,0xFE00,0xFFFF,0x7FFF,0xFFFF,0xFE00,
	0xFFFF,0x7FFF,0xFFFF,0xFF00,0xFFFF,0x7FFF,0xFFFF,0xFF00,
	0xFFFF,0x4FFF,0xFFFF,0xFF00,0xFFFF,0x4FFF,0xFFFF,0xFF00,
	0xFFFF,0x7FFF,0xFFFF,0xFF00,0xFFFF,0x7FFF,0xFFFF,0xFF00,
	0xFFFE,0x7FFF,0xFFFF,0xFF00,0xFFFE,0xFFFF,0xFFFF,0xFF00,
	0xFFFE,0xFFFF,0xFFFF,0xFF00,0xFFFE,0xFFFF,0xFFFF,0xFF00,
	0xFFFE,0xFFFF,0xFFFF,0xFF00,0xFFFE,0xFFFF,0xFFFF,0xFF00
Funky_Stuff
len=`wc -c < noface.icon`
if [ $len !=     1933 ] ; then
echo error: noface.icon was $len bytes long, should have been     1933
fi
fi # end of overwriting check
if [ -f nomail.icon ]
then
echo shar: will not over-write existing file nomail.icon
else
echo shar: extracting 'nomail.icon',     1933 characters
cat > nomail.icon <<'Funky_Stuff'
/* Format_version=1, Width=64, Height=64, Depth=1, Valid_bits_per_item=16
 */
	0x8889,0xFFFF,0xFFC8,0x8888,0x888A,0xB000,0x0038,0x8888,
	0x2223,0x5800,0x000A,0x2222,0x2226,0xADFF,0xFFCA,0x2222,
	0x8885,0x54FF,0xFFE4,0x8888,0x888A,0xAAFF,0xFFF2,0x8888,
	0x222D,0x567F,0xFFF2,0x2222,0x222A,0xAA7F,0xFFFA,0x2222,
	0x888D,0x557F,0xFFF9,0x8888,0x888A,0xAB7F,0xFFF9,0x8888,
	0x222D,0x557F,0xFFF9,0x2222,0x222A,0xAB3F,0xFFF1,0x2222,
	0x888D,0x5500,0x0001,0x8888,0x888A,0xAB00,0x0001,0x8888,
	0x222D,0x5500,0xFE01,0x2222,0x222A,0xAB03,0xFF81,0x2222,
	0x888D,0x5507,0xFFC1,0x8888,0x888A,0xAB0F,0xFFE1,0x8888,
	0x222D,0x551F,0xFFF1,0x2222,0x222A,0xAB1F,0xFFF1,0x2222,
	0x888D,0x553F,0xFFF9,0x8888,0x888A,0xAB3F,0xFFF9,0x8888,
	0x222D,0x553F,0xFFF9,0x2222,0x222A,0xAB3F,0xFFF9,0x2222,
	0x8FFD,0x553F,0xFFF9,0x8888,0xBFFA,0xAB3F,0xFFF9,0x8888,
	0x7FFD,0x553F,0xFFF9,0x2222,0xFFFA,0xAB3F,0xFFF9,0x2222,
	0xFFFD,0x551F,0xFFF1,0x8888,0xFFFA,0xAB1F,0xFFF1,0x8888,
	0xFFFD,0x550F,0xFFE1,0x2222,0xFFFA,0xAB07,0xFFC1,0x2222,
	0xFFFD,0xD503,0xFF81,0x8888,0xFFFB,0xEB00,0xFE01,0x8888,
	0x3FFD,0xF500,0x0001,0x2222,0x3FFB,0xFB00,0x0001,0x2222,
	0x8FFD,0xFD0F,0xFFE1,0x8888,0x8FFB,0xFB1F,0xFFD1,0x8888,
	0x23FD,0xFD3F,0xF7E9,0x2222,0x22FF,0xFF7F,0xFAE5,0x2222,
	0x88BF,0xFD7F,0xFCCD,0x8888,0x889F,0xFF7F,0xFE8D,0x8888,
	0x2227,0xF562,0x3FA5,0x2222,0x2223,0xF762,0x2FE5,0x2222,
	0x8888,0xFD48,0x89F5,0x8888,0x8888,0xBF48,0x88FD,0x8888,
	0x2222,0x2762,0x223D,0x2222,0x2222,0x23E2,0x222F,0x2222,
	0x8888,0x8888,0x8888,0x8888,0x88FF,0xFFFF,0xFFFF,0xFF88,
	0x22FF,0xFFFF,0xFFFF,0xFFA2,0x22BB,0xFFFF,0xFFFD,0xF1A2,
	0x889B,0xFFFF,0xFFFF,0xFD88,0x889B,0x8FFC,0xBC71,0xFD88,
	0x22AB,0x77FD,0x5BBD,0xFDA2,0x22AB,0x77FD,0x5FBD,0xFDA2,
	0x88B3,0x77FD,0x5C3D,0xFD88,0x88B3,0x77FD,0x5BBD,0xFD88,
	0x22BB,0x77FD,0x5BBD,0xFDA2,0x22BB,0x8FFD,0x5C3D,0xFDA2,
	0x88FF,0xFFFF,0xFFFF,0xFF88,0x88FF,0xFFFF,0xFFFF,0xFF88,
	0x22FF,0xFFFF,0xFFFF,0xFFA2,0x2222,0x2222,0x2222,0x2222
Funky_Stuff
len=`wc -c < nomail.icon`
if [ $len !=     1933 ] ; then
echo error: nomail.icon was $len bytes long, should have been     1933
fi
fi # end of overwriting check
if [ -f noprint.icon ]
then
echo shar: will not over-write existing file noprint.icon
else
echo shar: extracting 'noprint.icon',     1933 characters
cat > noprint.icon <<'Funky_Stuff'
/* Format_version=1, Width=64, Height=64, Depth=1, Valid_bits_per_item=16
 */
	0x8888,0x8888,0x8888,0x8888,0x88FF,0xFFFF,0xFFFF,0xFFE8,
	0x2280,0x0000,0x0000,0x0012,0x2280,0x0000,0x0000,0x0012,
	0x8880,0x0000,0x0000,0x0018,0x8880,0x0000,0x0000,0x0018,
	0x2280,0x0000,0x0000,0x0012,0x2280,0x0000,0x0000,0x0012,
	0x8880,0x0000,0x0000,0x0018,0x8880,0x0000,0x0000,0x0018,
	0x22FF,0xFFFF,0xFFFF,0xFFF2,0x2290,0x0400,0x0000,0x8012,
	0x8891,0xE400,0x0000,0x8018,0x8892,0x1400,0x1FF8,0x8018,
	0x2292,0x1400,0x1008,0x8012,0x2292,0x1400,0x1008,0x8012,
	0x8893,0xF400,0x1FF8,0x8018,0x8892,0xD400,0x1008,0x8018,
	0x2292,0x1400,0x1FF8,0x8012,0x2291,0xE400,0x0000,0x8022,
	0x8890,0x0400,0x0000,0x8048,0x88FF,0xFFFF,0xFFFF,0xC088,
	0xFFFF,0xFFFF,0xFFFF,0xE122,0xF880,0x0000,0x0000,0x7E22,
	0xF880,0x0000,0x0000,0x1FFF,0xF880,0x0000,0x0000,0x1FFF,
	0xFF80,0x0FEF,0xEFCF,0xE140,0x2280,0x0000,0x0000,0x01FF,
	0x8880,0x0FEF,0xEFCF,0xE188,0x8F80,0x0000,0x0000,0x0188,
	0x2880,0x0FEF,0xEFCF,0xE122,0x2F80,0x0000,0x0000,0x0122,
	0x8880,0x0000,0x0000,0x0188,0x88FF,0xFFFF,0xFFFF,0xFF88,
	0x2240,0x0000,0x0000,0x0222,0x2240,0x0000,0x0000,0x0222,
	0x88BF,0xFFFF,0xFFFF,0xFC88,0x889C,0x8888,0x8889,0xC888,
	0x2222,0x2222,0x2222,0x2222,0x2222,0x2222,0x2222,0x2222,
	0x8888,0x8888,0x8888,0x8888,0x8888,0x8888,0x8888,0x8888,
	0x2222,0x2222,0x2222,0x2222,0x2222,0x2222,0x2222,0x2222,
	0x8888,0x8888,0x8888,0x8888,0x8888,0x8888,0x8888,0x8888,
	0x2222,0x2222,0x2222,0x2222,0x2222,0x2222,0x2222,0x2222,
	0x8888,0x8888,0x8888,0x8888,0x88FF,0xFFFF,0xFFFF,0xFF88,
	0x22FF,0xFFFF,0xFFFF,0xFFA2,0x22FF,0xFFFF,0xBFF7,0xFFA2,
	0x88FF,0xFFFF,0xFFF7,0xFF88,0x88A7,0x8FFE,0x3C74,0xF188,
	0x229B,0x77FF,0xBBB3,0x6EA2,0x22BB,0x77FF,0xBBB7,0x6FA2,
	0x88BB,0x77FF,0xBBB7,0x7188,0x88BB,0x77FF,0xBBB7,0x7E88,
	0x22BB,0x77FF,0xBBB3,0x6EA2,0x22BB,0x8FFF,0xBC74,0xF1A2,
	0x88FF,0xFFFF,0xBFFF,0xFF88,0x88FF,0xFFFD,0xBFFF,0xFF88,
	0x22FF,0xFFFE,0x7FFF,0xFFA2,0x22FF,0xFFFF,0xFFFF,0xFFA2
Funky_Stuff
len=`wc -c < noprint.icon`
if [ $len !=     1933 ] ; then
echo error: noprint.icon was $len bytes long, should have been     1933
fi
fi # end of overwriting check
if [ -f faces.1 ]
then
echo shar: will not over-write existing file faces.1
else
echo shar: extracting 'faces.1',     4606 characters
cat > faces.1 <<'Funky_Stuff'
.\" %Z%%M% %I% %E% SMI
.TH FACES 1L "2 July 1988"
.SH NAME
faces \- visual mail and print face server for the Sun workstation
.SH SYNOPSIS
.B "faces
[
.B \-P
.I printer
]
[
.B \-a
]
[
.B \-f
.I facedir
]
[
.B \-h
.I defhost
]
[
.B \-i
.I interval
]
[
.B \-n
]
[
.B \-s
.I spoolfile
]
[
.B \-t
]
[
.B \-v
]
[
.B \-?
]
.SH DESCRIPTION
.B faces
is a window based tool for monitoring mail or print queues. It has three
different modes of operation:
.LP
The default will monitor for new mail. In its iconic form, a single face
image of the last new message will be shown. The timestamp of the last
messages will be displayed at the bottom of the icon, and opening the
window will display upto the last ten new messages. The username of the
sender is also given.
.LP
The second choice is to monitor the whole of a mail file. The icon and open
window display the appropriate faces, and dynamically change size as a new
check is made and the mail file alters. In the iconic form, a timestamp of
the last message plus the number of mail messages from this person are
optional display parameters.
.LP
The final option allows this program to monitor a given print queue. By
default the printer is called 'lp', but can be overridden as a command line
option. This will generate a single face icon showing the job at the top of
the print queue, and a text message will display the number of messages to
be printed. Opening the window will show all the jobs in the queue with the
owners' name and the size of the job in bytes.

There are special displays for no mail, no print jobs, mail from the
unknown mailer, and also for MAILER-DAEMONS.
.LP
When monitoring print jobs, it again displays a face for each user
where possible, but will also give the total size of that job in bytes.
.LP
.B faces
is based on the AT&T v8 program
.B vismon
which partially achieves the same purpose. This program is not derived from
.B vismon
source.
.LP
The faces are stored in Sun icon format with 64 x 64 x 1 dimensions. There
is a special face directory, and the faces are stored by username in
sub-directories which are by hostname.
.LP
The closed and open window displays are just big enough for the number of
faces to be displayed. The display will enlarge or contract as the mail spool
folder size or the number of print jobs changes.
.LP
Note that you still need to use
.I mailtool
or some other mail reading utility to actually read the mail that this program
monitors;
.I faces
simply displays who the mail is from.
.SH OPTIONS
.TP
.BI \-P " printer"
Printer name to monitor. If this and a mail spool file are given with the -s
option,
.B faces
will monitor the print queue.
.TP
.B \-a
Monitor the whole of the specified mail file. The icon and open window display
the appropriate faces, and dynamically change size as a new check is made and
the mail file alters.
.TP
.BI \-f " facedir"
Use an alternate name for the faces directory. The default is
.BR /usr/local/faces .
.TP
.BI \-h " defhost"
The default hostname to look under when mail arrives without a hostname.
The default is
.BR sun .
.TP
.BI \-i " interval"
The interval period in seconds before the mail spool file is scanned again
for new mail. The default is 60 seconds.
.TP
.B \-n
Do not display the number of messages from this person. The default is to
display, and a count is shown at the bottom right corner of the face for
this person.
.TP
.BI \-s " spoolfile"
Use an alternate mail spool file to monitor. The default is
.BI /var/spool/mail/ username
where
.I username
is the name of the user currently logged in.
.TP
.B \-t
Do not display a timestamp of the last message from this person. The
default is to display, and a timestamp is shown at the bottom left
corner of the face for this person.
.TP
.B \-v
Print the version number of this release of the
.B faces
program.
.TP
.B \-?
Print the usage line for this program. Note that the
.B ?
character should be escaped if running from
.BR csh (1).
.SH FILES
.TP
.B /var/spool/mail
directory for system mailboxes
.TP
.B /usr/local/faces
main directory containing the face icons.
.SH BUGS
.B Faces
now accesses the mail spool file which will prevent the flag coming up on
the
.B mailtool
icon.
.B Faces
should flash or beep to show that new mail has arrived. This information
should be extracted from the users
.B .mailrc
file.
.SH AUTHOR
Rich Burridge, Sun Microsystems, Unit 2, 49-53 Hotham Pde, Artarmon, N.S.W.
2164, AUSTRALIA.  PHONE: +61 2 436 4699
.nf
JANET: richb%sunaus.oz@uk.ac.ucl.cs
ACSnet:  richb@sunaus.oz
UUCP: {uunet,hplabs,mcvax,ukc}!munnari!sunaus.oz!richb
ARPAnet: rburridge@Sun.COM
.fi

Funky_Stuff
len=`wc -c < faces.1`
if [ $len !=     4606 ] ; then
echo error: faces.1 was $len bytes long, should have been     4606
fi
fi # end of overwriting check
if [ -f Makefile ]
then
echo shar: will not over-write existing file Makefile
else
echo shar: extracting 'Makefile',     3063 characters
cat > Makefile <<'Funky_Stuff'
#
#  Makefile for faces, an icon face mail server, plus associated software.
#
#  Copyright (c) Rich Burridge - June 1988.
#                Sun Microsystems, Australia - All rights reserved.
#
#  Permission is given to distribute these sources, as long as the
#  copyright messages are not removed, and no monies are exchanged. 
#
#  Version 1.1.
#
#  No responsibility is taken for any errors inherent either
#  to the comments or the code of this program, but if reported
#  to me then an attempt will be made to fix them.
#
#------------------------------------------------------------------
#  There are various command line options with the faces program.
#  They can also be defined at compile time. If they are not present
#  here, then sensible default values are used. The values given
#  below are the defaults, except for the spoolfile name where the
#  default is obtained from the users' passwd entry.
#
#
#  Monitor type (0 = monitor all, 1 = monitor new, 2 = monitor printer).
#
FMONTYPE         = -DFMONTYPE=1
#
#  Name of printer queue to monitor,
#
PRINTMON         = -DPRINTMON=\"lp\"
#
#  Different directory for face icons,
#
FACEDIR          = -DFACEDIR=\"/usr/local/faces\"
#
#  Default hostname for mail with no hostname,
#
DEFHOST          = -DDEFHOST=\"LOCAL\"
#
#  Interval in seconds for checking for new mail or print jobs,
#
INTERVAL         = -DINTERVAL=60
#
#  If nonzero, do not show number of messages on the face icon,
#
DONTSHOWNO       = -DDONTSHOWNO=0
#
#  Alternative spoolfile to monitor,
#  eg:     SPOOLFILE  = -DSPOOLFILE=\"/usr/richb/Mail/pending\"
#
#SPOOLFILE       =
#
#  If nonzero, do not show timestamp on the face icon.
#
DONTSHOWTIME     = -DDONTSHOWTIME=0
#-------------------------------------------------------------------

VARIABLES       = $(MONTYPE) $(PRINTMON) $(FACEDIR) $(DEFHOST) \
                  $(INTERVAL) $(DONTSHOWNO) $(SPOOLFILE) $(DONTSHOWTIME)
BINARIES        = faces
BINDIR          = /usr/local/bin
MANDIR          = /usr/man/man$(MANSECT)
MANSECT         = l
CFLAGS          = -g $(VARIABLES)
HDRS            = extern.h faces.h patchlevel.h
IMAGES          = bounced.icon noface.icon nomail.icon noprint.icon

LIBS            = -lsuntool -lsunwindow -lpixrect
OBJS            = get.o main.o mon.o rec.o sunview.o
SRCS            = get.c main.c mon.c rec.c sunview.c

OTHERS          = faces.1 Makefile README

all:            $(BINARIES)

faces:          $(OBJS)
		cc -o faces $(CFLAGS) $(OBJS) $(LIBS)

install:        $(BINARIES)
		install -s -m 751 faces $(BINDIR)
		install -c -m 644 faces.1 $(MANDIR)/faces.$(MANSECT)

backup:;	cp $(SRCS) $(HDRS) $(IMAGES) $(OTHERS) backdir

clean:;         rm -f *.o $(BINARIES) faces core

lint:;          lint $(SRCS) $(LIBS)

shar:;          shar.script $(SRCS) > archive.1
		shar.script $(HDRS) $(IMAGES) $(OTHERS) > archive.2

get.o:          get.c faces.h extern.h patchlevel.h
main.o:         main.c faces.h Makefile
mon.o:          mon.c faces.h extern.h
rec.o:          rec.c faces.h extern.h
sunview.o:      sunview.c extern.h $(IMAGES)
Funky_Stuff
len=`wc -c < Makefile`
if [ $len !=     3063 ] ; then
echo error: Makefile was $len bytes long, should have been     3063
fi
fi # end of overwriting check
if [ -f README ]
then
echo shar: will not over-write existing file README
else
echo shar: extracting 'README',     3278 characters
cat > README <<'Funky_Stuff'

README for faces, the visual mail and print monitor.

Version 1.1 July 1988.

Permission is given to distribute these sources, as long as the
copyright messages are not removed, and no monies are exchanged. 

This is the first general release of a "faces" server for monitoring mail
or print jobs. Note that faces is distributed at patchlevel 2.

Faces has three different modes of operation:

The default will monitor for new mail. In its iconic form, a single face
image of the last new message will be shown. The timestamp of the last
messages will be displayed at the bottom of the icon, and opening the
window will display upto the last ten new messages. The username of the
sender is also given.

The second choice is to monitor the whole of a mail file. The icon and open
window display the appropriate faces, and dynamically change size as a new
check is made and the mail file alters. In the iconic form, a timestamp of
the last message plus the number of mail messages from this person are
optional display parameters.

The final option allows this program to monitor a given print queue. By
default the printer is called 'lp', but can be overridden as a command line
option. This will generate a single face icon showing the job at the top of
the print queue, and a text message will display the number of messages to
be printed. Opening the window will show all the jobs in the queue with the
owners' name and the size of the job in bytes.

This is based on the AT&T v8 face server called vismon, but is not derived
from vismon sources.

The faces are stored in Sun icon format with 64x64x1 dimensions. There is a
face directory, and under that are directories which are hostnames. Faces are
stored as usernames under that.

By default, after every sixty seconds, faces will recheck the mail file or
the print queue, and produce a chain of records for which it has face icons.
These records keep all the details needed for display.

After extracting this information, the window is resized to exactly fit the
new information, the faces are placed into the appropriate places in
the graphical pixrects, the addition information is appended, and the icon
and window canvas are redisplayed.

Records with zero count are removed from the chain. This mail has been read,
or this print job has finished.

There are a few special icons; if there is no mail at all then a "no mail"
icon is displayed. If there is mail from people with no associated face, then
the "no face" or spy icon is displayed. If there are MAILER-DAEMONS, then the
demon mailbox is shown. When monitor the printer queue and there is currently
no entries, a "no jobs" icon is shown.

When no hostname is provided on the "From " line of the mail message, then the
users' face is searched for in the default face directory. This is set to
"LOCAL", but can be overwritten on the command line. It is also possible to
monitor other mail files as well as the users spool file.

I welcome bug reports and suggestions for improvements.

    Rich.

Rich Burridge,           JANET richb%sunaus.oz@uk.ac.ucl.cs
ACSnet  richb@sunaus.oz  UUCP {uunet,mcvax,ukc}!munnari!sunaus.oz!richb
PHONE: +61 2 436 4699    ARPAnet rburridge@Sun.COM
Sun Microsystems, Unit 2, 49-53 Hotham Pde, Artarmon, N.S.W. 2164, AUSTRALIA.
Funky_Stuff
len=`wc -c < README`
if [ $len !=     3278 ] ; then
echo error: README was $len bytes long, should have been     3278
fi
fi # end of overwriting check