v06i041: xmail -- Mail front end for X11, Part01/06

Michael C. Wagnitz michael at parns.nsc.com
Thu Mar 22 17:51:17 AEST 1990


Submitted-by: michael at parns.nsc.com (Michael C. Wagnitz)
Posting-number: Volume 6, Issue 41
Archive-name: xmail/part01

   Introducing xmail, the X Window System interface to the mail program.

   Copyright 1990 by National Semiconductor Corporation
  
   Author:  Michael C. Wagnitz - National Semiconductor Corporation
  
   xmail is my attempt to provide an X11 alternative to the Sun mailtool
   application, both in the Sunview and XView implementations.  Its not
   as fancy in some ways as the newer XView version of mailtool, and it
   does not attempt to provide all of the capabilities of mailtool, but
   does have some features which I found to be practical.  For one, it
   provides built in help information on each of the xmail sub-windows.
   It also supports the user preferred editor when creating messages,
   utilizing the value in the user's process or mail EDITOR or VISUAL
   environment variable, if found.  The man page has additional details.

   A non-imake version of a make file is provided as make.file.  You may
   use this file to build xmail, or invoke M.I.T.'s imake facility to up-
   grade the Makefile provided.

   Following this introduction should be six shar files which comprise
   the xmail distribution.

   PLEASE report any bugs or enhancements to me at the address below, so
   that changes may be incorporated and official patches posted.  Enjoy.

   Michael Wagnitz M/S D3-677      uucp: {sun|hplabs|decwrl}!nsc!parns!michael
   National Semiconductor        Domain: michael at parns.nsc.com
   2900 Semiconductor Dr.         Phone: 408/721-3266
   Santa Clara, CA 95052-8090


#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of archive 1 (of 6)."
# Contents:  README MANIFEST COPYRIGHT HelpText.c Imakefile Mailwatch.c
#   Mailwatch.h MailwatchP.h Makefile XMail.ad make.file patchlevel.h
# Wrapped by michael at harley on Tue Mar 20 15:28:03 1990
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'README' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'README'\"
else
echo shar: Extracting \"'README'\" \(2539 characters\)
sed "s/^X//" >'README' <<'END_OF_FILE'
X
X   xmail - X Window System interface to the mail program
X
X   Copyright 1990 by National Semiconductor Corporation
X  
X   Permission to use, copy, modify, and distribute this software and its
X   documentation for any purpose is hereby granted without fee, provided that
X   the above copyright notice appear in all copies and that both that
X   copyright notice and this permission notice appear in supporting
X   documentation, and that the name of National Semiconductor Corporation not
X   be used in advertising or publicity pertaining to distribution of the
X   software without specific, written prior permission.
X  
X   NATIONAL SEMICONDUCTOR CORPORATION MAKES NO REPRESENTATIONS ABOUT THE
X   SUITABILITY OF THIS SOFTWARE FOR ANY PURPOSE.  IT IS PROVIDED "AS IS"
X   WITHOUT EXPRESS OR IMPLIED WARRANTY.  NATIONAL SEMICONDUCTOR CORPORATION
X   DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED
X   WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  IN NO
X   EVENT SHALL NATIONAL SEMICONDUCTOR CORPORATION BE LIABLE FOR ANY SPECIAL,
X   INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
X   LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
X   OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
X   PERFORMANCE OF THIS SOFTWARE.
X  
X   Author:  Michael C. Wagnitz - National Semiconductor Corporation
X  
X   xmail is my attempt to provide an X11 equivalent to the Sun mailtool
X   application, both in the Sunview and XView implementations.  Its not
X   as fancy in some ways as the newer XView version of mailtool, but it
X   does have some features which I found to be practical.  For one, it
X   provides built in help information on each of the xmail sub-windows.
X   It also supports the user preferred editor when creating messages,
X   utilizing the value in the user's EDITOR environment variable, if found.
X   Please see the man page for additional details.
X
X   A non-imake version of a make file is provided as make.file.  You may use
X   this file to build xmail, or invoke M.I.T.'s imake facility to upgrade the
X   Makefile provided.
X
X   PLEASE report any bugs or enhancements to me at the address below, so
X   that changes can be incorporated in my sources and official patches posted.
X
X   Enjoy.
X
X   Michael Wagnitz M/S D3-677      uucp: {sun|hplabs|decwrl}!nsc!parns!michael
X   National Semiconductor        Domain: michael at parns.nsc.com
X   2900 Semiconductor Dr.         Phone: 408/721-3266
X   Santa Clara, CA 95052-8090
END_OF_FILE
if test 2539 -ne `wc -c <'README'`; then
    echo shar: \"'README'\" unpacked with wrong size!
fi
# end of 'README'
fi
if test -f 'MANIFEST' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'MANIFEST'\"
else
echo shar: Extracting \"'MANIFEST'\" \(1922 characters\)
sed "s/^X//" >'MANIFEST' <<'END_OF_FILE'
X   File Name		Archive #	Description
X-----------------------------------------------------------
X README                     1	Introduction to xmail
X MANIFEST                   1	This shipping list
X COPYRIGHT                  1	Copyright notices for xmail
X HelpText.c                 1	Source of the help information
X Imakefile                  1	Source for creating a Makefile
X Mailwatch.c                1	Mailwatch widget source - from Dan Heller
X Mailwatch.h                1	Include file for the Mailwatch widget
X MailwatchP.h               1	Private include file for Mailwatch widget
X Makefile                   1	Production makefile from M.I.T. X11 tree
X XMail.ad                   1	Application default resources for xmail
X actions.c                  2	Source file for xmail
X callMail.c                 2	Source file for xmail
X callbacks.c                2	Source file for xmail
X defs.h                     3	Source file for xmail
X directory.c                3	Source file for xmail
X environs.c                 3	Source file for xmail
X global.h                   3	Source file for xmail
X handler.c                  3	Source file for xmail
X icon.mail                  2	Mailbox icon file for xmail
X icon.nomail                3	Mailbox icon file for xmail
X mail.c                     3	Source file for xmail
X make.file                  1	Makefile for non-M.I.T. installations
X national.bm                3	National Semiconductor Corporate logo
X parser.c                   4	Source file for xmail
X patchlevel.h               1	Source file for xmail
X regex.c                    5	Source file for xmail
X regex.h                    4	Source file for xmail
X utils.c                    4	Source file for xmail
X windows.c                  6	Source file for xmail
X xmail.c                    4	Source file for xmail
X xmail.man                  6	Man page source for xmail
X xmailregex.h               3	Source file for xmail
END_OF_FILE
if test 1922 -ne `wc -c <'MANIFEST'`; then
    echo shar: \"'MANIFEST'\" unpacked with wrong size!
fi
# end of 'MANIFEST'
fi
if test -f 'COPYRIGHT' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'COPYRIGHT'\"
else
echo shar: Extracting \"'COPYRIGHT'\" \(2025 characters\)
sed "s/^X//" >'COPYRIGHT' <<'END_OF_FILE'
X/*
X * xmail - X window system interface to the mail program
X *
X * Copyright 1989 The University of Texas at Austin
X *
X * Author:	Po Cheung
X * Date:	March 10, 1989
X *
X * Permission to use, copy, modify, and distribute this software and
X * its documentation for any purpose and without fee is hereby granted,
X * provided that the above copyright notice appear in all copies and that
X * both that copyright notice and this permission notice appear in
X * supporting documentation.  The University of Texas at Austin makes no 
X * representations about the suitability of this software for any purpose.  
X * It is provided "as is" without express or implied warranty.
X *
X * Copyright 1990 by National Semiconductor Corporation
X *
X * Permission to use, copy, modify, and distribute this software and its
X * documentation for any purpose is hereby granted without fee, provided that
X * the above copyright notice appear in all copies and that both that
X * copyright notice and this permission notice appear in supporting
X * documentation, and that the name of National Semiconductor Corporation not
X * be used in advertising or publicity pertaining to distribution of the
X * software without specific, written prior permission.
X *
X * NATIONAL SEMICONDUCTOR CORPORATION MAKES NO REPRESENTATIONS ABOUT THE
X * SUITABILITY OF THIS SOFTWARE FOR ANY PURPOSE.  IT IS PROVIDED "AS IS"
X * WITHOUT EXPRESS OR IMPLIED WARRANTY.  NATIONAL SEMICONDUCTOR CORPORATION
X * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED
X * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  IN NO
X * EVENT SHALL NATIONAL SEMICONDUCTOR CORPORATION BE LIABLE FOR ANY SPECIAL,
X * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
X * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
X * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
X * PERFORMANCE OF THIS SOFTWARE.
X *
X * Author:  Michael C. Wagnitz - National Semiconductor Corporation
X *
X */
X
END_OF_FILE
if test 2025 -ne `wc -c <'COPYRIGHT'`; then
    echo shar: \"'COPYRIGHT'\" unpacked with wrong size!
fi
# end of 'COPYRIGHT'
fi
if test -f 'HelpText.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'HelpText.c'\"
else
echo shar: Extracting \"'HelpText.c'\" \(10669 characters\)
sed "s/^X//" >'HelpText.c' <<'END_OF_FILE'
X/*
X * xmail - X window system interface to the mail program
X *
X * Copyright 1990 by National Semiconductor Corporation
X *
X * Permission to use, copy, modify, and distribute this software and its
X * documentation for any purpose is hereby granted without fee, provided that
X * the above copyright notice appear in all copies and that both that
X * copyright notice and this permission notice appear in supporting
X * documentation, and that the name of National Semiconductor Corporation not
X * be used in advertising or publicity pertaining to distribution of the
X * software without specific, written prior permission.
X *
X * NATIONAL SEMICONDUCTOR CORPORATION MAKES NO REPRESENTATIONS ABOUT THE
X * SUITABILITY OF THIS SOFTWARE FOR ANY PURPOSE.  IT IS PROVIDED "AS IS"
X * WITHOUT EXPRESS OR IMPLIED WARRANTY.  NATIONAL SEMICONDUCTOR CORPORATION
X * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED
X * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  IN NO
X * EVENT SHALL NATIONAL SEMICONDUCTOR CORPORATION BE LIABLE FOR ANY SPECIAL,
X * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
X * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
X * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
X * PERFORMANCE OF THIS SOFTWARE.
X *
X * Author:  Michael C. Wagnitz - National Semiconductor Corporation
X *
X */
X
X
X#include	"global.h"
X
XString	Cc_Help_Text = "\
XUse the Cc: window to specify carbon copy recipients for\n\
Xthis message.\n\n\
XPressing the right mouse button in this window displays a\n\
Xlist of your aliases.  Releasing the right mouse button\n\
Xwhile one of the alias names is highlighted copies that\n\
Xname into the window, preceeding it with a comma if needed.\n\n\
XPressing the backspace or delete key erases a previously\n\
Xentered character.  Control_W (^W) erases a previous word\n\
Xand Control_U (^U) the entire line.\n\n\
XSee also the Subject:, To:, Autograph, and Deliver helps.";
X
XString	Copy_Help_Text = "\
Xcopy - copies a message into the file or folder named in\n\
Xthe File: window, without deleting the original.\n\n\
XThe right button pops up a menu for both the copy and\n\
XCopy commands.\n\n\
XThe uppercase (Copy) command copies the message to a file\n\
Xwhose name is derived from the author of the message,\n\
Xrather than from any name currently in the File: window.\n\n\
XSee also the save command help information.";
X
XString	Delete_Help_Text = "\
Xdelete - removes a message from the folder, the message\n\
Xto be deleted indicated by selection highlight in the\n\
Xindex (top) window.\n\n\
XThe right button pops up a menu for both the delete and\n\
Xundelete commands.\n\n\
XUndelete restores the most recently deleted message,\n\
Xproviding changes have not already been committed.\n\
XUndelete may be pressed repeatedly to restore all deleted\n\
Xmessages.\n\n\
XSee also the hold, save, folder, Newmail, and quit helps.";
X
XString	Deliver_Help_Text = "\
XThe Deliver button will complete the currently composed\n\
Xmessage and ship it to the sendmail daemon for delivery.\n\n\
XThe right mouse button pops up a menu for both Delivery\n\
Xand Cancel commands.  Selecting Cancel aborts delivery\n\
Xand removes the temporary file, while the third selection\n\
Xsaves a copy of the message text in your dead letter file\n\
X(~/dead.letter by default).";
X
XString	File_Help_Text = "\
XThe File: window provides a mechanism for specifying a\n\
Xfile or folder name for use by other commands.\n\n\
XPressing the backspace or delete key erases a previously\n\
Xentered character.\n\n\
XControl_W (^W) erases the previous word and Control_U (^U)\n\
Xthe entire line.\n\n\
XSee also the folder and save commands.";
X
XString	Folder_Help_Text = "\
XThe left button changes the active folder to the one\n\
Xspecified in the File: window.  Changing folders COMMITs\n\
Xany modifications to the current folder.\n\n\
XThe right button brings up a list of folders from which to\n\
Xchoose.\n\n\
XClicking the left button on a directory (indicated by\n\
Xtrailing slash) while still holding down the right, expands\n\
Xthe directory, if it has files.\n\n\
XReleasing the right button copies the selected name to the\n\
XFile: window.";
X
XString	Hold_Help_Text = "\
XPressing the hold button marks the selected message for\n\
Xretention in the system mailbox, usually after having\n\
Xfirst saved it to another file or folder.\n\n\
XThe button is insensitive if not currently in your system\n\
Xmail folder.";
X
XString	Index_Help_Text = "\
XThe index window displays a list of mail messages\n\
Xavailable in the current folder.\n\n\
XPressing the left mouse button anywhere on the line marks\n\
Xthe message as selected (for other commands) but does not\n\
Xautomatically display the selected message.\n\n\
XPressing the right button selects and automatically\n\
Xdisplays the message.\n\n\
XSee also the read command help information.";
X
X#ifdef SUNOS_4
XString	NewMail_Help_Text = "\
XNewmail - causes user's system mail folder to become the\n\
Xactive folder (if mail exists) and includes any new mail\n\
Xthat may have been delivered since the program was started.\n\
XThis action commits any changes made to the current folder.\n\n\
XThe button will highlight whenever new mail is available.\n\n\
XThe right mouse button provides a choice between committing\n\
Xchanges, or just incorporating new messages without\n\
Xcommitting changes (but only if the system mailbox is your\n\
Xcurrent folder).";
X#else
XString	NewMail_Help_Text = "\
XNewmail - causes user's system mail folder to become the\n\
Xactive folder (if mail exists) and includes any new mail\n\
Xthat may have been delivered since the program was started.\n\
XThis action commits any changes made to the current folder.\n\n\
XThe button will highlight whenever new mail is available.\n\n\
XThe right mouse button is a copy of the Newmail command.";
X#endif
X
XString	Print_Help_Text = "\
XPrint - causes the selected message to be printed on the\n\
Xsystem printer.\n\n\
XA notice will be displayed in the status window indicating\n\
Xwhich message was printed, along with its size in bytes.\n\n\
XSee the index help for information on selecting a message.";
X
XString	Quit_Help_Text = "\
Xquit - terminates xmail, committing changes made to the\n\
Xcurrent folder.\n\n\
XThe right button pops up a menu for both the quit and exit\n\
Xcommands.\n\n\
XUse exit when you wish to leave xmail without committing\n\
Xfolder changes.\n\n\
XSee also the folder, Newmail, and delete commands.";
X
XString	Read_Help_Text = "\
Xread - displays the selected message in the text (bottom)\n\
Xwindow.\n\n\
XMessage selection is indicated by caret and highlight in\n\
Xthe index (top) window.\n\n\
XThe right button pops up a menu for reading the message,\n\
Xreading it with full header (overrides suppression of\n\
Xnormally ignored fields), or reading the next or previous\n\
Xmessage.\n\n\
XSee also the index window help information.";
X
XString	Reply_Help_Text = "\
Xreply - initiates the mechanism to create and send a mail\n\
Xmessage to the author of a current message.\n\n\
XThe right mouse button displays a menu for selecting\n\
X'reply', 'reply included', 'replyall' (which addresses all\n\
Xrecipients of the original mail), or 'replyall included'.\n\
XThe include options automatically copy the original message\n\
Xinto the new one.\n\n\
XSee also the send command.";
X
XString	Save_Help_Text = "\
Xsave - copies a message to the file or folder named in\n\
Xthe File: window, marking the original for deletion.\n\
XIf none is specified, the name in your environment MBOX\n\
Xis used ($HOME/mbox by default).\n\n\
XThe right button pops up a menu of related commands.\n\n\
XA written (vs. copied) message does not include mail\n\
Xheaders or trailing blank line.\n\n\
XUppercase commands create a file named from the author of\n\
Xthe message, rather than any name in the File: window.";
X
XString	Send_Help_Text = "\
Xsend - initiates the mechanism to create and send a\n\
Xmessage to the designated recipient(s).  The right mouse\n\
Xbutton displays a menu which provides the choice of\n\
X'send'ing, or 'forwarding a message'.  Forwarding includes\n\
Xthe text of the current message in the new one.\n\n\
XAs with the 'reply' command, a dialog box is provided to\n\
Xspecify the name of the recipient(s), subject, and who to\n\
Xsend copies of this message.  The user presses the\n\
X'Deliver' button to complete the operation.\n\n\
XSee also the reply command.";
X
XString	Sign_Help_Text = "\
XYou may insert you choice of the two autograph strings\n\
Xfound in your ~/.mailrc startup file (if they exists).\n\
XThis action duplicates the ~A or ~a mail command.\n\n\
XThe default action inserts the Sign autograph string.\n\n\
XSee Mail(1) man page documentation for more information on\n\
Xautograph strings and .mailrc files.";
X
XString	Status_Help_Text = "\
XThe Status window displays program error and status\n\
Xmessages.\n\n\
XThe terminal bell is usually also rung to attract the\n\
Xuser's attention.\n\n\
XThe BELL can be disabled, by either including the command\n\
Xline option -nb, or by specifying the '*bellRing' resource\n\
Xas False.";
X
XString	Subject_Help_Text = "\
XThe Subject: window provides a method for specifying the\n\
Xsubject for this mail message.\n\n\
XPressing the backspace or delete key erases a previously\n\
Xentered character.\n\n\
XControl_W (^W) erases the previous word and Control_U (^U)\n\
Xthe entire line.\n\n\
XSee also the To:, Cc:, Autograph, and Deliver help messages.";
X
XString	Text_Help_Text = "\
XThe text window displays the currently selected message.\n\n\
XThe scrollbar may be used to move the displayed text, as\n\
Xnecessary.\n\n\
XSee also the index window help on selecting messages.";
X
XString	Title_Help_Text = "\
XThe Title window displays the\n\n\
Xprogram name and version number, along with the\n\n\
Xname of the current mail folder and its message count(s).\n\n\
XUnder release 4 of X11, pressing the left mouse button on\n\
Xthe National Semiconductor Corporation logo in the top\n\
Xleft corner of the title bar issues a request to iconify\n\
Xthis application.";
X
XString	To_Help_Text = "\
XUse the To: window to specify the recipients for this mail\n\
Xmessage.\n\n\
XPressing the right mouse button in this window displays a\n\
Xlist of your alias names.  Releasing the right mouse button\n\
Xwhile one of the alias names is highlighted will copy that\n\
Xname into the window, prepending it with a comma if needed.\n\n\
XPressing the backspace or delete key erases a previously\n\
Xentered character.  Control_W (^W) erases the previous word\n\
Xand Control_U (^U) erases the entire line.\n\n\
XSee also the Subject:, Cc:, Autograph, and Deliver helps.";
X
X/* HelpText */
END_OF_FILE
if test 10669 -ne `wc -c <'HelpText.c'`; then
    echo shar: \"'HelpText.c'\" unpacked with wrong size!
fi
# end of 'HelpText.c'
fi
if test -f 'Imakefile' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Imakefile'\"
else
echo shar: Extracting \"'Imakefile'\" \(871 characters\)
sed "s/^X//" >'Imakefile' <<'END_OF_FILE'
X#
X# Imakefile for xmail 1.0
X#
X# Define SUNOS_4 if compiling under Sun OS 4.x - newer directory routines
X# Define X11R3 if compiling under X11 Release 3 - include file changes in R4
X# Define XAW_BC if compiling under X11 Release 4 - changes in Xt/Xaw names
X#
X#          DEFINES = -DSUNOS_4 -DX11R3
X          DEFINES = -DSUNOS_4 -DXAW_BC
X      CDEBUGFLAGS = -g
X     INSTPGMFLAGS = -s $(INSTBINFLAGS)
X
X  LOCAL_LIBRARIES = $(XAWLIB) $(XMULIB) $(XTOOLLIB) $(XLIB) -lm
X
X             SRCS = Mailwatch.c HelpText.c actions.c callMail.c callbacks.c \
X		    directory.c environs.c handler.c mail.c parser.c \
X		    regex.c utils.c windows.c xmail.c
X
X             OBJS = Mailwatch.o HelpText.o actions.o callMail.o callbacks.o \
X		    directory.o environs.o handler.o mail.o parser.o \
X		    regex.o utils.o windows.o xmail.o
X
XComplexProgramTarget(xmail)
X
XInstallAppDefaults(XMail)
END_OF_FILE
if test 871 -ne `wc -c <'Imakefile'`; then
    echo shar: \"'Imakefile'\" unpacked with wrong size!
fi
# end of 'Imakefile'
fi
if test -f 'Mailwatch.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Mailwatch.c'\"
else
echo shar: Extracting \"'Mailwatch.c'\" \(15926 characters\)
sed "s/^X//" >'Mailwatch.c' <<'END_OF_FILE'
X/*
X * @(#)Mailwatch.c - MODIFIED for use as an active icon in the xmail program.
X *
X * Author:  Dan Heller <island!argv at sun.com>
X * This code was stolen from Mailbox.c --the widget which supports "xbiff"
X * written by Jim Fulton which was apparently stolen from Clock.c, the widget
X * which supports "xclock."  Note, you are witnessing the big bang theory of
X * software development (everything is a subclass of universeWidgetClass).
X *
X * Major changes:
X * XtRemoveTimeOut() is called before calling XtAddTimeOut().  The original
X * xbiff would eventually timeout all the time rather than every 30 seconds
X * because the old timer was never removed.
X *
X * User can specify any icon he chooses for either the up flag or the down
X * flag.  Icons don't need to be the same size (defaults to flagup/flagdown).
X *
X * When new mail comes in, a user supplied callback function is invoked.
X *
X * The mailbox flag goes up when there is new mail _and_ the user hasn't
X * read it yet.  As soon as the user updates the access time on the mailbox,
X * the flag goes down.  This removes the incredibly annoying habit xbiff
X * had where you read some mail but not delete it from the mailbox and the
X * flag would remain up.
X *
X * Destroy() will now destroy the flagup and flagdown pixmaps.
X *
X * November 1989 - Michael C. Wagnitz - National Semiconductor Corporation
X * The following modifications were made for use in xmail.
X *
X * Removed button handler, custom cursor, and 'from()' reader functions.
X * Added reset_mailbox() function, my own icons (56x56 bits), and also
X * removed the background/foreground inversion for flag_up (down) pixmaps.
X * Added timer initialization to Initialize() routine (we might not ever be
X * Realized, if the user never iconifies my parent).  This also fixes a Sun4
X * bug for trying to remove an initial interval_id with a garbage address.
X * Also changed check_mailbox() to test access time vs. modified and zero size
X * of file, rather than trying to track our last access or increase in size.
X *
X * Copyright 1990 by National Semiconductor Corporation
X *
X * Permission to use, copy, modify, and distribute this software and its
X * documentation for any purpose is hereby granted without fee, provided that
X * the above copyright notice appear in all copies and that both that
X * copyright notice and this permission notice appear in supporting
X * documentation, and that the name of National Semiconductor Corporation not
X * be used in advertising or publicity pertaining to distribution of the
X * software without specific, written prior permission.
X *
X * NATIONAL SEMICONDUCTOR CORPORATION MAKES NO REPRESENTATIONS ABOUT THE
X * SUITABILITY OF THIS SOFTWARE FOR ANY PURPOSE.  IT IS PROVIDED "AS IS"
X * WITHOUT EXPRESS OR IMPLIED WARRANTY.  NATIONAL SEMICONDUCTOR CORPORATION
X * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED
X * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  IN NO
X * EVENT SHALL NATIONAL SEMICONDUCTOR CORPORATION BE LIABLE FOR ANY SPECIAL,
X * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
X * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
X * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
X * PERFORMANCE OF THIS SOFTWARE.
X *
X * The following software modules were created and are Copyrighted by National
X * Semiconductor Corporation:
X *
X * 1. reset_mailbox.
X *
X * Author:  Michael C. Wagnitz - National Semiconductor Corporation
X *
X */
X
X
X#include <X11/Xos.h>
X#include <X11/IntrinsicP.h>		/* for toolkit stuff */
X#include <X11/cursorfont.h>		/* for cursor constants */
X#include <X11/StringDefs.h>		/* for useful atom names */
X#include "MailwatchP.h"			/* for implementation mailbox stuff */
X#include <stdio.h>			/* for printing error messages */
X#include <sys/stat.h>			/* for stat() */
X#include <pwd.h>			/* for getting username */
X#include <errno.h>
X#include "icon.mail"			/* for flag up (mail present) bits */
X#include "icon.nomail"			/* for flag down (mail not here) */
X
X#define	flagup_bits	mail_bits	/* quick & dirty hack to avoid edits */
X#define	flagup_width	mail_width
X#define	flagup_height	mail_height
X#define	flagdown_bits	no_mail_bits
X#define	flagdown_width	no_mail_width
X#define	flagdown_height	no_mail_height
X
X#define REMOVE_TIMEOUT(id) if (!id) ; else XtRemoveTimeOut(id)
X#ifdef X11R2
X#define XtReleaseGC(w, gc) XtDestroyGC(gc)
X#endif /* X11R2 */
X
Xstatic int pix_up_w, pix_dn_w, pix_up_h, pix_dn_h;
Xstatic struct stat stbuf;
Xstatic Pixmap ReadBitmapFile();
Xstatic Boolean SetValues();
Xstatic GC GetNormalGC();
Xextern void
X    reset_mailbox();
Xstatic void
X    GetMailFile(), CloseDown(), check_mailbox(), redraw_mailbox(),
X    Initialize(), Realize(), Destroy(), Redisplay(), clock_tic();
X
X#define min(a,b) ((a) < (b) ? (a) : (b))
X#define max(a,b) ((a) > (b) ? (a) : (b))
X
X/* Initialization of defaults */
X#define offset(field) XtOffset(MailwatchWidget,mailbox.field)
X#define goffset(field) XtOffset(Widget,core.field)
X
Xstatic XtResource resources[] = {
X#ifndef X11R2
X    {XtNupdate, XtCInterval, XtRInt, sizeof(int),
X	offset(update), XtRImmediate, (caddr_t) 30 },
X    {XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel),
X	offset(foreground_pixel), XtRString, XtDefaultForeground },
X    {XtNbackground, XtCBackground, XtRPixel, sizeof(Pixel),
X	goffset(background_pixel), XtRString, XtDefaultBackground },
X    {XtNreverseVideo, XtCBoolean, XtRBoolean, sizeof(Boolean),
X	offset(reverseVideo), XtRImmediate, (caddr_t) False },
X    {XtNbell, XtCBoolean, XtRBoolean, sizeof(Boolean),
X	offset(bell), XtRImmediate, (caddr_t) True },
X#else /* X11R3 */
X    {XtNupdate, XtCInterval, XtRInt, sizeof(int),
X	offset(update), XtRString, "30"},
X    {XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel),
X	offset(foreground_pixel), XtRString, "black"},
X    {XtNbackground, XtCBackground, XtRPixel, sizeof(Pixel),
X	goffset(background_pixel), XtRString, "white"},
X    {XtNreverseVideo, XtCBoolean, XtRBoolean, sizeof(Boolean),
X	offset(reverseVideo), XtRString, "FALSE"},
X    {XtNbell, XtCBoolean, XtRBoolean, sizeof(Boolean),
X	offset(bell), XtRString, (caddr_t) "FALSE" },
X#endif /* ! X11R2 */
X    {XtNfile, XtCFile, XtRString, sizeof(String),
X	offset(filename), XtRString, NULL},
X    {XtNdown_flag, XtCFile, XtRString, sizeof(String),
X	offset(flagdown), XtRString, NULL},
X    {XtNup_flag, XtCFile, XtRString, sizeof(String),
X	offset(flagup), XtRString, NULL},
X    {XtNmail, XtCString, XtRString, sizeof(String),
X	offset(mail), XtRString, NULL},
X    {XtNcallback, XtCCallback, XtRCallback, sizeof(caddr_t),
X	offset(callback), XtRCallback, NULL},
X};
X
X#undef offset
X#undef goffset
X
XMailwatchClassRec mailwatchClassRec = {
X    {	/* core fields */
X	/* superclass		*/ &widgetClassRec,
X	/* class_name		*/ "Mailwatch",
X	/* widget_size		*/ sizeof(MailwatchRec),
X	/* class_initialize	*/ NULL,
X	/* class_part_initialize*/ NULL,
X	/* class_inited 	*/ FALSE,
X	/* initialize		*/ Initialize,
X	/* initialize_hook	*/ NULL,
X	/* realize		*/ Realize,
X	/* actions		*/ NULL,
X	/* num_actions		*/ 0,
X	/* resources		*/ resources,
X	/* resource_count	*/ XtNumber(resources),
X	/* xrm_class		*/ NULL,
X	/* compress_motion	*/ TRUE,
X	/* compress_exposure	*/ TRUE,
X	/* compress_enterleave	*/ TRUE,
X	/* visible_interest	*/ FALSE,
X	/* destroy		*/ Destroy,
X	/* resize		*/ NULL,
X	/* expose		*/ Redisplay,
X	/* set_values		*/ SetValues,
X	/* set_values_hook	*/ NULL,
X	/* set_values_almost	*/ XtInheritSetValuesAlmost,
X	/* get_values_hook	*/ NULL,
X	/* accept_focus		*/ NULL,
X	/* version		*/ XtVersion,
X	/* callback_private	*/ NULL,
X	/* tm_table		*/ NULL,
X	/* query_geometry	*/ NULL,
X    }
X};
X
XWidgetClass mailwatchWidgetClass = (WidgetClass) & mailwatchClassRec;
X
X/*
X * private procedures
X */
Xstatic void
XInitialize(request, new)
XWidget request, new;
X{
X    MailwatchWidget w = (MailwatchWidget) new;
X    register Display *dpy = XtDisplay(new);
X    int depth = DefaultDepth(dpy, DefaultScreen(dpy)), wid, hgt;
X
X    if (!w->mailbox.filename)
X	GetMailFile(w);
X
X    if (w->mailbox.reverseVideo) {
X	Pixel tmp;
X
X	tmp = w->mailbox.foreground_pixel;
X	w->mailbox.foreground_pixel = w->core.background_pixel;
X	w->core.background_pixel = tmp;
X    }
X
X    GetNormalGC(w);
X
X    /*
X     * build up the pixmaps that we'll put into the image
X     */
X    if (w->mailbox.flagup) {
X	Pixmap flag_up =
X	    ReadBitmapFile(dpy, RootWindow(dpy, DefaultScreen(dpy)),
X		w->mailbox.flagup, &pix_up_w, &pix_up_h);
X	w->mailbox.flagup_pixmap = XCreatePixmap(dpy,
X	    RootWindowOfScreen(XtScreen(w)), pix_up_w, pix_up_h, depth);
X	if (depth == 1)
X	    XCopyArea(dpy, flag_up, w->mailbox.flagup_pixmap,
X		w->mailbox.normal_GC, 0, 0, pix_up_w, pix_up_h, 0, 0);
X	else
X	    XCopyPlane(dpy, flag_up, w->mailbox.flagup_pixmap,
X		w->mailbox.normal_GC, 0, 0, pix_up_w, pix_up_h, 0, 0, 1);
X    } else
X	w->mailbox.flagup_pixmap =
X	    XCreatePixmapFromBitmapData(dpy, RootWindow(dpy,DefaultScreen(dpy)),
X		flagup_bits,
X		pix_up_w = flagup_width,
X		pix_up_h = flagup_height,
X		w->mailbox.foreground_pixel, w->core.background_pixel,
X		depth);
X
X    if (w->mailbox.flagdown) {
X	Pixmap flag_down =
X	    ReadBitmapFile(dpy, RootWindow(dpy, DefaultScreen(dpy)),
X		w->mailbox.flagdown, &pix_dn_w, &pix_dn_h);
X	w->mailbox.flagdown_pixmap = XCreatePixmap(dpy,
X	    RootWindowOfScreen(XtScreen(w)), pix_dn_w, pix_dn_h, depth);
X	if (depth == 1)
X	    XCopyArea(dpy, flag_down, w->mailbox.flagdown_pixmap,
X		w->mailbox.normal_GC, 0, 0, pix_dn_w, pix_dn_h, 0, 0);
X	else
X	    XCopyPlane(dpy, flag_down, w->mailbox.flagdown_pixmap,
X		w->mailbox.normal_GC, 0, 0, pix_dn_w, pix_dn_h, 0, 0, 1);
X    } else
X	w->mailbox.flagdown_pixmap =
X	    XCreatePixmapFromBitmapData(dpy, RootWindow(dpy,DefaultScreen(dpy)),
X		flagdown_bits,
X		pix_dn_w = flagdown_width,
X		pix_dn_h = flagdown_height,
X		w->mailbox.foreground_pixel, w->core.background_pixel,
X		depth);
X
X    /* the size of the icon should be the size of the larger icon. */
X    if (w->core.width == 0)
X	w->core.width = max(pix_up_w, pix_dn_w);
X    if (w->core.height == 0)
X	w->core.height = max(pix_up_h, pix_dn_h);
X
X    if (stat(w->mailbox.filename, &stbuf) == 0) {
X	w->mailbox.last_access = stbuf.st_mtime;
X
X    /* set timer */
X    w->mailbox.interval_id = XtAddTimeOut(w->mailbox.update * 1000,
X	clock_tic, (caddr_t) w);
X    }
X}
X
X
Xstatic void
Xclock_tic(client_data, id)
Xcaddr_t client_data;
XXtIntervalId *id;
X{
X    MailwatchWidget w = (MailwatchWidget) client_data;
X
X    check_mailbox(w, FALSE);
X}
X
Xstatic GC
XGetNormalGC(w)
XMailwatchWidget w;
X{
X    XtGCMask valuemask;
X    XGCValues xgcv;
X
X    valuemask = GCForeground | GCBackground | GCFunction | GCGraphicsExposures;
X    xgcv.foreground = w->mailbox.foreground_pixel;
X    xgcv.background = w->core.background_pixel;
X    xgcv.function = GXcopy;
X    xgcv.graphics_exposures = False;
X    w->mailbox.normal_GC = XtGetGC((Widget) w, valuemask, &xgcv);
X}
X
Xstatic Pixmap
XReadBitmapFile(dpy, root, file, width, height)
XDisplay *dpy;
XWindow root;
Xchar *file;
Xint *width, *height;
X{
X    Pixmap bitmap;
X    int status, foo, bar;
X
X    status = XReadBitmapFile(dpy, root, file, width, height, &bitmap,&foo,&bar);
X    if (status == BitmapSuccess)
X	return bitmap;
X    if (status == BitmapOpenFailed)
X	perror(file);
X    else if (status == BitmapFileInvalid)
X	fprintf(stderr, "%s: bad bitmap format file\n", file);
X    exit(1);
X}
X
Xstatic void
XRealize(gw, valuemaskp, attr)
XWidget gw;
XXtValueMask *valuemaskp;
XXSetWindowAttributes *attr;
X{
X    XtCreateWindow(gw, InputOutput, (Visual *) CopyFromParent,
X	*valuemaskp, attr);
X}
X
Xstatic void
XDestroy(gw)
XWidget gw;
X{
X    MailwatchWidget w = (MailwatchWidget) gw;
X
X    XtFree(w->mailbox.filename);
X    REMOVE_TIMEOUT(w->mailbox.interval_id);
X    XtReleaseGC(w, w->mailbox.normal_GC);
X    XFreePixmap(XtDisplay(w), w->mailbox.flagup_pixmap);
X    XFreePixmap(XtDisplay(w), w->mailbox.flagdown_pixmap);
X}
X
Xstatic void
XRedisplay(gw)
XWidget gw;
X{
X    MailwatchWidget w = (MailwatchWidget) gw;
X
X    REMOVE_TIMEOUT(w->mailbox.interval_id);
X    check_mailbox(w, TRUE);
X}
X
X
X/*
X** Modified to NOT update the mail file timestamp via utimes(), and to
X** ignore state change where mail adds a status record to the message.
X** The first elminates collisions with mail during delivery, and the
X** second elminates false triggers for new mail.
X*/
Xstatic void
Xcheck_mailbox(w, force_redraw)
XMailwatchWidget w;
XBoolean force_redraw;
X{
X int redraw = 0;
X struct timeval times[2];
X
X if (stat(w->mailbox.filename, &stbuf) < 0) {		/* no mail file */
X    if (w->mailbox.flag_up == TRUE) {
X       w->mailbox.flag_up = FALSE;
X       redraw = TRUE;
X       UnsetNewmail(w, NULL, NULL);
X      }
X   } else {
X    if (stbuf.st_atime >= stbuf.st_mtime &&
X        stbuf.st_atime >= w->mailbox.last_access) {	/* mail was seen */
X       w->mailbox.last_access = stbuf.st_atime;
X       if (w->mailbox.flag_up == TRUE) {
X          w->mailbox.flag_up = FALSE;
X          redraw = TRUE;
X          UnsetNewmail(w, NULL, NULL);
X         }
X      } else {
X       if (stbuf.st_size != 0 && 
X           stbuf.st_mtime > w->mailbox.last_access) {	/* got new mail */
X          w->mailbox.last_access = stbuf.st_mtime;
X          if (w->mailbox.bell)
X             XBell(XtDisplay(w), MAILBOX_VOLUME);
X          if (w->mailbox.flag_up == FALSE) {
X             w->mailbox.flag_up = TRUE;
X             redraw = TRUE;
X             XtCallCallbacks(w, XtNcallback, NULL);
X            }
X         }
X      }
X   }
X
X if (redraw || force_redraw)
X    redraw_mailbox(w);
X
X /* reset timer */
X w->mailbox.interval_id = XtAddTimeOut(w->mailbox.update * 1000,
X	clock_tic, (caddr_t) w);
X} /* check_mailbox */
X
X/*
X * get user name for building mailbox
X */
Xstatic void
XGetMailFile(w)
XMailwatchWidget w;
X{
X    char *getlogin();
X    char *username;
X    int len;
X
X    username = getlogin();
X    if (!username) {
X	struct passwd *pw = getpwuid(getuid());
X
X	if (!pw) {
X	    fprintf(stderr, "%s:  unable to find a username for you.\n",
X		"Mailbox widget");
X	    CloseDown(w, 1);
X	}
X	username = pw->pw_name;
X    }
X    if (!(w->mailbox.filename = (String) XtMalloc(strlen(MAILBOX_DIRECTORY)+1
X	  + strlen(username)+1))) {
X	fprintf(stderr, "can't allocate enough memory for widget.\n");
X	exit(1);
X    }
X    sprintf(w->mailbox.filename, "%s/%s", MAILBOX_DIRECTORY, username);
X}
X
Xstatic void
XCloseDown(w, status)
XMailwatchWidget w;
Xint status;
X{
X    Display *dpy = XtDisplay(w);
X
X    XtDestroyWidget(w);
X    XCloseDisplay(dpy);
X    exit(status);
X}
X
Xstatic Boolean
XSetValues(gcurrent, grequest, gnew)
XWidget gcurrent, grequest, gnew;
X{
X    MailwatchWidget current = (MailwatchWidget) gcurrent;
X    MailwatchWidget new = (MailwatchWidget) gnew;
X    Boolean redisplay = FALSE;
X
X    if (current->mailbox.update != new->mailbox.update) {
X	REMOVE_TIMEOUT(current->mailbox.interval_id);
X	new->mailbox.interval_id = XtAddTimeOut(new->mailbox.update * 1000,
X	    clock_tic,
X	    (caddr_t) gnew);
X    }
X    if (current->mailbox.foreground_pixel != new->mailbox.foreground_pixel ||
X	current->core.background_pixel != new->core.background_pixel) {
X	XtReleaseGC(current, current->mailbox.normal_GC);
X	GetNormalGC(new);
X	redisplay = TRUE;
X    }
X    return (redisplay);
X}
X
X/*
X * drawing code
X */
Xstatic void
Xredraw_mailbox(mw)
XMailwatchWidget mw;
X{
X    register Display *dpy = XtDisplay(mw);
X    register Window win = XtWindow(mw);
X    register int x, y, w, h;
X    Pixmap picture;
X
X
X    XClearWindow(dpy, win);
X    if (mw->mailbox.flag_up) {			/* paint the "up" position */
X	picture = mw->mailbox.flagup_pixmap;
X	w = pix_up_w, h = pix_up_h;
X    } else {					/* paint the "down" position */
X	picture = mw->mailbox.flagdown_pixmap;
X	w = pix_dn_w, h = pix_dn_h;
X    }
X
X    /* center the picture in the window */
X    x = (mw->core.width - w) / 2;
X    y = (mw->core.height - h) / 2;
X
X    XCopyArea(dpy, picture, win, mw->mailbox.normal_GC, 0, 0, w, h, x, y);
X}
X
X
Xvoid
Xreset_mailbox(gw)
XWidget	gw;
X{
X MailwatchWidget w = (MailwatchWidget) gw;
X
X w->mailbox.flag_up = FALSE;
X redraw_mailbox(w, NULL);
X} /* reset_mailbox */
X
END_OF_FILE
if test 15926 -ne `wc -c <'Mailwatch.c'`; then
    echo shar: \"'Mailwatch.c'\" unpacked with wrong size!
fi
# end of 'Mailwatch.c'
fi
if test -f 'Mailwatch.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Mailwatch.h'\"
else
echo shar: Extracting \"'Mailwatch.h'\" \(837 characters\)
sed "s/^X//" >'Mailwatch.h' <<'END_OF_FILE'
X/*
X * Author:  Dan heller
X */
X
X#ifndef _XtMailwatch_h
X#define _XtMailwatch_h
X
X/*
X * Mailwatch widget; looks a lot like the Mailbox widget, don't it...
X */
X
X#ifndef XtNupdate
X#define XtNupdate	"update"	/* Int: how often to check mail */
X#endif /* XtNupdate */
X#define XtNbell		"bell"		/* boolean to ring bell on new mail */
X#define XtNfile		"file"		/* String:  file name to check */
X#define XtNup_flag	"up_flag"	/* path to icon file */
X#define XtNdown_flag	"down_flag"	/* path to icon file */
X#define XtNmail		"mail"		/* For XtGetValues to get mail info */
X
X/* structures */
Xtypedef struct _MailwatchRec *MailwatchWidget;  /* see MailwatchP.h */
Xtypedef struct _MailwatchClassRec *MailwatchWidgetClass;  /* see MailwatchP.h */
X
Xextern WidgetClass mailwatchWidgetClass;
X
X#endif /* _XtMailwatch_h */
X/* DON'T ADD STUFF AFTER THIS #endif */
END_OF_FILE
if test 837 -ne `wc -c <'Mailwatch.h'`; then
    echo shar: \"'Mailwatch.h'\" unpacked with wrong size!
fi
# end of 'Mailwatch.h'
fi
if test -f 'MailwatchP.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'MailwatchP.h'\"
else
echo shar: Extracting \"'MailwatchP.h'\" \(1806 characters\)
sed "s/^X//" >'MailwatchP.h' <<'END_OF_FILE'
X/*
X * Author:  Dan Heller (see Mailwatch.c for detailed info)
X */
X#ifndef _XtMailwatchP_h
X#define _XtMailwatchP_h
X
X#include "Mailwatch.h"
X#include <X11/CoreP.h>
X
X#ifndef MAILBOX_DIRECTORY
X#define MAILBOX_DIRECTORY "/usr/spool/mail"
X#endif /* MAILBOX_DIRECTORY */
X#define MAILBOX_VOLUME 33		/* percentage */
X
Xtypedef struct {			/* new fields for mailwatch widget */
X    Pixel	foreground_pixel;	/* color index of normal state fg */
X    GC		normal_GC;		/* normal GC to use */
X    GC		invert_GC;		/* invert GC to use */
X    int		update;			/* seconds between updates */
X    String	filename;		/* filename to watch */
X    long	last_size;		/* size in bytes of mailboxname */
X    time_t	last_access;		/* last time user accessed mailbox */
X    Boolean	reverseVideo;		/* do reverse video? */
X    Boolean	flag_up;		/* is the flag up? */
X    Boolean	bell;			/* ring the bell on new mail? */
X    String	mail;			/* author/subject/date info to "get" */
X    String	flagup;			/* path to alternate icon to use */
X    String	flagdown;		/* path to alternate icon to use */
X    Pixmap	flagup_pixmap;		/* for when there is mail */
X    Pixmap	flagdown_pixmap;	/* for when there isn't mail */
X    XtCallbackList callback;		/* Call func(s) when mail arrives */
X    XtIntervalId interval_id;		/* time between checks */
X} MailwatchPart;
X
Xtypedef struct _MailwatchRec {		/* full instance record */
X    CorePart core;
X    MailwatchPart mailbox;
X} MailwatchRec;
X
Xtypedef struct {			/* new fields for mailwatch class */
X    int dummy;				/* stupid C compiler */
X} MailwatchClassPart;
X
Xtypedef struct _MailwatchClassRec {	/* full class record declaration */
X    CoreClassPart core_class;
X    MailwatchClassPart mailwatch_class;
X} MailwatchClassRec;
X
Xextern MailwatchClassRec mailwatchClassRec;	 /* class pointer */
X
X#endif _XtMailwatchP_h
END_OF_FILE
if test 1806 -ne `wc -c <'MailwatchP.h'`; then
    echo shar: \"'MailwatchP.h'\" unpacked with wrong size!
fi
# end of 'MailwatchP.h'
fi
if test -f 'Makefile' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Makefile'\"
else
echo shar: Extracting \"'Makefile'\" \(10055 characters\)
sed "s/^X//" >'Makefile' <<'END_OF_FILE'
X# Makefile generated by imake - do not edit!
X# $XConsortium: imake.c,v 1.51 89/12/12 12:37:30 jim Exp $
X#
X# The cpp used on this machine replaces all newlines and multiple tabs and
X# spaces in a macro expansion with a single space.  Imake tries to compensate
X# for this, but is not always successful.
X#
X
X###########################################################################
X# Makefile generated from "Imake.tmpl" and </tmp/IIf.a08346>
X# $XConsortium: Imake.tmpl,v 1.77 89/12/18 17:01:37 jim Exp $
X#
X# Platform-specific parameters may be set in the appropriate .cf
X# configuration files.  Site-wide parameters may be set in the file
X# site.def.  Full rebuilds are recommended if any parameters are changed.
X#
X# If your C preprocessor doesn't define any unique symbols, you'll need
X# to set BOOTSTRAPCFLAGS when rebuilding imake (usually when doing
X# "make Makefile", "make Makefiles", or "make World").
X#
X# If you absolutely can't get imake to work, you'll need to set the
X# variables at the top of each Makefile as well as the dependencies at the
X# bottom (makedepend will do this automatically).
X#
X
X###########################################################################
X# platform-specific configuration parameters - edit sun.cf to change
X
X# platform:  $XConsortium: sun.cf,v 1.38 89/12/23 16:10:10 jim Exp $
X# operating system:  SunOS 4.0.3
X
X###########################################################################
X# site-specific configuration parameters - edit site.def to change
X
X# site:  $XConsortium: site.def,v 1.21 89/12/06 11:46:50 jim Exp $
X
X            SHELL = /bin/sh
X
X              TOP = ../../../mit
X      CURRENT_DIR = ./clients/xmail
X
X               AR = ar cq
X  BOOTSTRAPCFLAGS =
X               CC = cc
X
X         COMPRESS = compress
X              CPP = /lib/cpp $(STD_CPP_DEFINES)
X    PREPROCESSCMD = cc -E $(STD_CPP_DEFINES)
X          INSTALL = install
X               LD = ld
X             LINT = lint
X      LINTLIBFLAG = -C
X         LINTOPTS = -axz
X               LN = ln -s
X             MAKE = make
X               MV = mv
X               CP = cp
X           RANLIB = ranlib
X  RANLIBINSTFLAGS =
X               RM = rm -f
X     STD_INCLUDES =
X  STD_CPP_DEFINES =
X      STD_DEFINES =
X EXTRA_LOAD_FLAGS =
X  EXTRA_LIBRARIES =
X             TAGS = ctags
X
X    SHAREDCODEDEF = -DSHAREDCODE
X         SHLIBDEF = -DSUNSHLIB
X
X    PROTO_DEFINES =
X
X     INSTPGMFLAGS =
X
X     INSTBINFLAGS = -m 0755
X     INSTUIDFLAGS = -m 4755
X     INSTLIBFLAGS = -m 0664
X     INSTINCFLAGS = -m 0444
X     INSTMANFLAGS = -m 0444
X     INSTDATFLAGS = -m 0444
X    INSTKMEMFLAGS = -m 4755
X
X          DESTDIR =
X
X     TOP_INCLUDES = -I$(TOP)
X
X      CDEBUGFLAGS = -O
X        CCOPTIONS =
X      COMPATFLAGS =
X
X      ALLINCLUDES = $(STD_INCLUDES) $(TOP_INCLUDES) $(INCLUDES) $(EXTRA_INCLUDES)
X       ALLDEFINES = $(ALLINCLUDES) $(STD_DEFINES) $(PROTO_DEFINES) $(DEFINES) $(COMPATFLAGS)
X           CFLAGS = $(CDEBUGFLAGS) $(CCOPTIONS) $(ALLDEFINES)
X        LINTFLAGS = $(LINTOPTS) -DLINT $(ALLDEFINES)
X           LDLIBS = $(SYS_LIBRARIES) $(EXTRA_LIBRARIES)
X        LDOPTIONS = $(CDEBUGFLAGS) $(CCOPTIONS)
X   LDCOMBINEFLAGS = -X -r
X
X        MACROFILE = sun.cf
X           RM_CMD = $(RM) *.CKP *.ln *.BAK *.bak *.o core errs ,* *~ *.a .emacs_* tags TAGS make.log MakeOut
X
X    IMAKE_DEFINES =
X
X         IRULESRC = $(CONFIGSRC)
X        IMAKE_CMD = $(NEWTOP)$(IMAKE) -I$(NEWTOP)$(IRULESRC) $(IMAKE_DEFINES)
X
X     ICONFIGFILES = $(IRULESRC)/Imake.tmpl $(IRULESRC)/Imake.rules \
X			$(IRULESRC)/Project.tmpl $(IRULESRC)/site.def \
X			$(IRULESRC)/$(MACROFILE) $(EXTRA_ICONFIGFILES)
X
X###########################################################################
X# X Window System Build Parameters
X# $XConsortium: Project.tmpl,v 1.63 89/12/18 16:46:44 jim Exp $
X
X###########################################################################
X# X Window System make variables; this need to be coordinated with rules
X# $XConsortium: Project.tmpl,v 1.63 89/12/18 16:46:44 jim Exp $
X
X          PATHSEP = /
X        USRLIBDIR = $(DESTDIR)/usr/lib
X           BINDIR = $(DESTDIR)/usr/bin/X11
X          INCROOT = $(DESTDIR)/usr/include
X     BUILDINCROOT = $(TOP)
X      BUILDINCDIR = $(BUILDINCROOT)/X11
X      BUILDINCTOP = ..
X           INCDIR = $(INCROOT)/X11
X           ADMDIR = $(DESTDIR)/usr/adm
X           LIBDIR = $(USRLIBDIR)/X11
X        CONFIGDIR = $(LIBDIR)/config
X       LINTLIBDIR = $(USRLIBDIR)/lint
X
X          FONTDIR = $(LIBDIR)/fonts
X         XINITDIR = $(LIBDIR)/xinit
X           XDMDIR = $(LIBDIR)/xdm
X           AWMDIR = $(LIBDIR)/awm
X           TWMDIR = $(LIBDIR)/twm
X           GWMDIR = $(LIBDIR)/gwm
X          MANPATH = $(DESTDIR)/usr/man
X    MANSOURCEPATH = $(MANPATH)/man
X           MANDIR = $(MANSOURCEPATH)n
X        LIBMANDIR = $(MANSOURCEPATH)3
X      XAPPLOADDIR = $(LIBDIR)/app-defaults
X
X        SOXLIBREV = 4.2
X          SOXTREV = 4.0
X         SOXAWREV = 4.0
X        SOOLDXREV = 4.0
X         SOXMUREV = 4.0
X        SOXEXTREV = 4.0
X
X       FONTCFLAGS = -t
X
X     INSTAPPFLAGS = $(INSTDATFLAGS)
X
X            IMAKE = $(IMAKESRC)/imake
X           DEPEND = $(DEPENDSRC)/makedepend
X              RGB = $(RGBSRC)/rgb
X            FONTC = $(BDFTOSNFSRC)/bdftosnf
X        MKFONTDIR = $(MKFONTDIRSRC)/mkfontdir
X        MKDIRHIER = /bin/sh $(SCRIPTSRC)/mkdirhier.sh
X
X        CONFIGSRC = $(TOP)/config
X        CLIENTSRC = $(TOP)/clients
X          DEMOSRC = $(TOP)/demos
X           LIBSRC = $(TOP)/lib
X          FONTSRC = $(TOP)/fonts
X       INCLUDESRC = $(TOP)/X11
X        SERVERSRC = $(TOP)/server
X          UTILSRC = $(TOP)/util
X        SCRIPTSRC = $(UTILSRC)/scripts
X       EXAMPLESRC = $(TOP)/examples
X       CONTRIBSRC = $(TOP)/../contrib
X           DOCSRC = $(TOP)/doc
X           RGBSRC = $(TOP)/rgb
X        DEPENDSRC = $(UTILSRC)/makedepend
X         IMAKESRC = $(CONFIGSRC)
X         XAUTHSRC = $(LIBSRC)/Xau
X          XLIBSRC = $(LIBSRC)/X
X           XMUSRC = $(LIBSRC)/Xmu
X       TOOLKITSRC = $(LIBSRC)/Xt
X       AWIDGETSRC = $(LIBSRC)/Xaw
X       OLDXLIBSRC = $(LIBSRC)/oldX
X      XDMCPLIBSRC = $(LIBSRC)/Xdmcp
X      BDFTOSNFSRC = $(FONTSRC)/bdftosnf
X     MKFONTDIRSRC = $(FONTSRC)/mkfontdir
X     EXTENSIONSRC = $(TOP)/extensions
X
X  DEPEXTENSIONLIB = $(EXTENSIONSRC)/lib/libXext.a
X     EXTENSIONLIB =   $(DEPEXTENSIONLIB)
X
X          DEPXLIB = $(DEPEXTENSIONLIB)
X             XLIB = $(EXTENSIONLIB) -L$(XLIBSRC) -lX11
X
X      DEPXAUTHLIB = $(XAUTHSRC)/libXau.a
X         XAUTHLIB =  $(DEPXAUTHLIB)
X
X        DEPXMULIB =
X           XMULIB = -L$(XMUSRC) -lXmu
X
X       DEPOLDXLIB =
X          OLDXLIB = -L$(OLDXLIBSRC) -loldX
X
X      DEPXTOOLLIB =
X         XTOOLLIB = -L$(TOOLKITSRC) -lXt
X
X        DEPXAWLIB =
X           XAWLIB = -L$(AWIDGETSRC) -lXaw
X
X LINTEXTENSIONLIB = $(EXTENSIONSRC)/lib/llib-lXext.ln
X         LINTXLIB = $(XLIBSRC)/llib-lX11.ln
X          LINTXMU = $(XMUSRC)/llib-lXmu.ln
X        LINTXTOOL = $(TOOLKITSRC)/llib-lXt.ln
X          LINTXAW = $(AWIDGETSRC)/llib-lXaw.ln
X
X          DEPLIBS = $(DEPXAWLIB) $(DEPXMULIB) $(DEPXTOOLLIB) $(DEPXLIB)
X
X         DEPLIBS1 = $(DEPLIBS)
X         DEPLIBS2 = $(DEPLIBS)
X         DEPLIBS3 = $(DEPLIBS)
X
X###########################################################################
X# Imake rules for building libraries, programs, scripts, and data files
X# rules:  $XConsortium: Imake.rules,v 1.67 89/12/18 17:14:15 jim Exp $
X
X###########################################################################
X# start of Imakefile
X
X#
X# Imakefile for xmail 1.0
X#
X# Define SUNOS_4 if compiling under Sun OS 4.x - newer directory routines
X# Define X11R3 if compiling under X11 Release 3 - include file changes in R4
X# Define XAW_BC if compiling under X11 Release 4 - changes in Xt/Xaw names
X#
X#          DEFINES = -DSUNOS_4 -DX11R3
X          DEFINES = -DSUNOS_4 -DXAW_BC
X      CDEBUGFLAGS = -g
X     INSTPGMFLAGS = -s $(INSTBINFLAGS)
X
X  LOCAL_LIBRARIES = $(XAWLIB) $(XMULIB) $(XTOOLLIB) $(XLIB)
X
X             SRCS = Mailwatch.c HelpText.c actions.c callMail.c callbacks.c \
X		    directory.c environs.c handler.c mail.c parser.c \
X		    regex.c utils.c windows.c xmail.c
X
X             OBJS = Mailwatch.o HelpText.o actions.o callMail.o callbacks.o \
X		    directory.o environs.o handler.o mail.o parser.o \
X		    regex.o utils.o windows.o xmail.o
X
X PROGRAM = xmail
X
Xall:: xmail
X
Xxmail: $(OBJS) $(DEPLIBS)
X	$(RM) $@
X	$(CC) -o $@ $(OBJS) $(LDOPTIONS) $(LOCAL_LIBRARIES) $(LDLIBS) $(EXTRA_LOAD_FLAGS)
X
Xinstall:: xmail
X	$(INSTALL) -c $(INSTPGMFLAGS)   xmail $(BINDIR)
X
Xinstall.man:: xmail.man
X	$(INSTALL) -c $(INSTMANFLAGS) xmail.man $(MANDIR)/xmail.n
X
Xdepend:: $(DEPEND)
X
X$(DEPEND):
X	@echo "checking $@ over in $(DEPENDSRC) first..."; \
X	cd $(DEPENDSRC); $(MAKE); \
X	echo "okay, continuing in $(CURRENT_DIR)"
X
Xdepend::
X	$(DEPEND) -s "# DO NOT DELETE" -- $(ALLDEFINES) -- $(SRCS)
X
Xlint:
X	$(LINT) $(LINTFLAGS) $(SRCS) $(LINTLIBS)
Xlint1:
X	$(LINT) $(LINTFLAGS) $(FILE) $(LINTLIBS)
X
Xclean::
X	$(RM) $(PROGRAM)
X
Xinstall:: XMail.ad
X	$(INSTALL) -c $(INSTAPPFLAGS) XMail.ad $(XAPPLOADDIR)/XMail
X
X###########################################################################
X# common rules for all Makefiles - do not edit
X
Xemptyrule::
X
Xclean::
X	$(RM_CMD) \#*
X
XMakefile:: $(IMAKE)
X
X$(IMAKE):
X	@(cd $(IMAKESRC); if [ -f Makefile ]; then \
X	echo "checking $@ in $(IMAKESRC) first..."; $(MAKE) all; else \
X	echo "bootstrapping $@ from Makefile.ini in $(IMAKESRC) first..."; \
X	$(MAKE) -f Makefile.ini BOOTSTRAPCFLAGS=$(BOOTSTRAPCFLAGS); fi; \
X	echo "okay, continuing in $(CURRENT_DIR)")
X
XMakefile::
X	- at if [ -f Makefile ]; then \
X	echo "	$(RM) Makefile.bak; $(MV) Makefile Makefile.bak"; \
X	$(RM) Makefile.bak; $(MV) Makefile Makefile.bak; \
X	else exit 0; fi
X	$(IMAKE_CMD) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT_DIR)
X
Xtags::
X	$(TAGS) -w *.[ch]
X	$(TAGS) -xw *.[ch] > TAGS
X
X###########################################################################
X# empty rules for directories that do not have SUBDIRS - do not edit
X
Xinstall::
X	@echo "install in $(CURRENT_DIR) done"
X
Xinstall.man::
X	@echo "install.man in $(CURRENT_DIR) done"
X
XMakefiles::
X
Xincludes::
X
X###########################################################################
X# dependencies generated by makedepend
X
END_OF_FILE
if test 10055 -ne `wc -c <'Makefile'`; then
    echo shar: \"'Makefile'\" unpacked with wrong size!
fi
# end of 'Makefile'
fi
if test -f 'XMail.ad' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'XMail.ad'\"
else
echo shar: Extracting \"'XMail.ad'\" \(1529 characters\)
sed "s/^X//" >'XMail.ad' <<'END_OF_FILE'
X#
X# xmail resource default definitions
X#
X# Do not use full wildcard (*) on the Geometry specification, or it will
X# force all popups to initially anchor with those same coordinates.
X#
X*Autograph.background:		cyan
X*background:			yellow
X*borderColor:			brown
X*Cancel.background:		white
X*Cancel.foreground:		red
X*Cancel.borderColor:		red
X*Cancel,.background:		white
X*Cancel,.foreground:		magenta
X*Cancel,.borderColor:		magenta
X*Cc*background:			cyan
X*Copy.foreground:		blue
X*commandPanel.background:	goldenrod
X*copy.background:		cyan
X*Deliver.background:		green
X*Deliver.foreground:		brown
X*Deliver.borderColor:		brown
X*delete.foreground:		red
X*delete.background:		white
X*exit.foreground:		blue
X*fileWindow*background:		cyan
X*Folder.background:		cyan
X*foreground:			brown
X*forward.foreground:		green3
X*full.foreground:		red
X*icon*background:		gold
X*icon*foreground:		brown
X*inc.background:		cyan
X*indexWindow*background:	LightGoldenrod
X*list.background:		tan
X*logo.background:		blue
X*logo.foreground:		white
X*menu.background:		tan
X*Newmail.foreground:		blue
X*next.foreground:		green3
X*previous.foreground:		blue
X*quit.foreground:		red
X*quit.background:		white
X*replyall.background:		green
X*Save.foreground:		blue
X*save.background:		cyan
X*statusWindow.background:	brown
X*statusWindow.foreground:	yellow
X*Subject*background:		cyan
X*To*background:			cyan
X*textWindow*background:		LightGoldenrod
X*titleBar.background:		brown
X*titleBar.foreground:		yellow
X*undelete.foreground:		green3
X*write.foreground:		green3
X*Write.foreground:		red
END_OF_FILE
if test 1529 -ne `wc -c <'XMail.ad'`; then
    echo shar: \"'XMail.ad'\" unpacked with wrong size!
fi
# end of 'XMail.ad'
fi
if test -f 'make.file' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'make.file'\"
else
echo shar: Extracting \"'make.file'\" \(2277 characters\)
sed "s/^X//" >'make.file' <<'END_OF_FILE'
X#
X# makefile for xmail 1.01
X#
X      BINDIR = /usr/bin/X11
X      APPDIR = /usr/lib/X11/app-defaults
X      MANDIR = /usr/man/mann
X	  CC = cc
X	  LD = ld
X     INSTALL = install
XINSTBINFLAGS = -s -m 0755
XINSTAPPFLAGS = -m 0644
XINSTMANFLAGS = -m 0644
X	  RM = rm -f
X        LINK = ln -s
X      RANLIB = ranlib
X        MAKE = make
X       SHELL = /bin/sh
X#
X# Define SUNOS_4 if compiling under Sun OS 4.x - newer directory routines
X# Define X11R3 if compiling under X11 Release 3 - include file changes in R4
X# Define XAW_BC if compiling under X11 Release 4 - changes in Xt/Xaw names
X#
X#    DEFINES = -DSUNOS_4 -DX11R3
X    DEFINES = -DSUNOS_4 -DXAW_BC
XCDEBUGFLAGS = -g
X     CFLAGS = $(CDEBUGFLAGS) $(DEFINES)
X#
X# Define -Bstatic if loading against Release 3 (static) X11 libraries
X#
X#    LDFLAGS = $(CDEBUGFLAGS) -Bstatic
X    LDFLAGS = $(CDEBUGFLAGS)
X#
X# Add -lXext if compiling under X11 Release 4 or later
X#
X#  LIBRARIES = -lXaw -lXmu -lXt -lX11 -lm
X  LIBRARIES = -lXaw -lXmu -lXt -lXext -lX11 -lm
X    PROGRAM = xmail
X       SRCS = \
X		Mailwatch.c \
X		HelpText.c \
X		actions.c \
X		callMail.c \
X		callbacks.c \
X		directory.c \
X		environs.c \
X		handler.c \
X		mail.c \
X		parser.c \
X		regex.c \
X		utils.c \
X		windows.c \
X		xmail.c
X       OBJS = \
X		Mailwatch.o \
X		HelpText.o \
X		actions.o \
X		callMail.o \
X		callbacks.o \
X		directory.o \
X		environs.o \
X		handler.o \
X		mail.o \
X		parser.o \
X		regex.o \
X		utils.o \
X		windows.o \
X		xmail.o
X#
X
Xxmail:	$(OBJS)
X	@$(RM) $@
X	$(CC) -o $@ $(OBJS) $(LDFLAGS) $(LIBRARIES)
X
Xinstall::	xmail
X	$(INSTALL) -c $(INSTBINFLAGS) $? $(BINDIR)
X
Xinstall::	XMail.ad
X	$(INSTALL) -c $(INSTAPPFLAGS) $? $(APPDIR)/XMail
X
Xinstall::
X	@echo done
X
Xinstall.man::	xmail.man
X	$(INSTALL) -c $(INSTMANFLAGS) $? $(MANDIR)/xmail.n
X
Xinstall.man::
X	@echo install man done
X
Xclean:
X	@$(RM) *.o
X#
X# ########### DEPENDENCIES GO HERE ########################
X#
XHelpText.o:	defs.h global.h
Xactions.o:	defs.h global.h
XcallMail.o:	defs.h global.h
Xcallbacks.o:	defs.h global.h
Xdirectory.o:	defs.h global.h
Xenvirons.o:	defs.h global.h
Xhandler.o:	defs.h global.h xmailregex.h
Xmail.o:		defs.h global.h
Xparser.o:	defs.h global.h xmailregex.h
Xutils.o:	defs.h global.h
Xwindows.o:	defs.h global.h Mailwatch.h national.bm
Xxmail.o:	defs.h global.h MailwatchP.h
XMailwatch.o:	icon.mail icon.nomail
END_OF_FILE
if test 2277 -ne `wc -c <'make.file'`; then
    echo shar: \"'make.file'\" unpacked with wrong size!
fi
# end of 'make.file'
fi
if test -f 'patchlevel.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'patchlevel.h'\"
else
echo shar: Extracting \"'patchlevel.h'\" \(21 characters\)
sed "s/^X//" >'patchlevel.h' <<'END_OF_FILE'
X#define PATCHLEVEL 0
END_OF_FILE
if test 21 -ne `wc -c <'patchlevel.h'`; then
    echo shar: \"'patchlevel.h'\" unpacked with wrong size!
fi
# end of 'patchlevel.h'
fi
echo shar: End of archive 1 \(of 6\).
cp /dev/null ark1isdone
MISSING=""
for I in 1 2 3 4 5 6 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked all 6 archives.
    rm -f ark[1-9]isdone
else
    echo You still need to unpack the following archives:
    echo "        " ${MISSING}
fi
##  End of shell archive.
exit 0

dan
-----------------------------------------------------------
		    O'Reilly && Associates
		argv at sun.com / argv at ora.com
	   632 Petaluma Ave, Sebastopol, CA 95472 
     800-338-NUTS, in CA: 800-533-NUTS, FAX 707-829-0104
    Opinions expressed reflect those of the author only.



More information about the Comp.sources.x mailing list