v07i082: xmail -- Mail front end for X11, Patch1, Part02/06

news news at sun.Eng.Sun.COM
Fri Jun 1 13:40:35 AEST 1990


Submitted-by: parns.nsc.com!michael (Michael C. Wagnitz)
Posting-number: Volume 7, Issue 82
Archive-name: xmail/patch1.02
Patch-To: xmail: Volume 6, Issue 41-46

#! /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 2 (of 5)."
# Contents:  Patch.01a
# Wrapped by michael at harley on Tue May 29 10:33:50 1990
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'Patch.01a' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Patch.01a'\"
else
echo shar: Extracting \"'Patch.01a'\" \(48483 characters\)
sed "s/^X//" >'Patch.01a' <<'END_OF_FILE'
XPrereq: 0
X
X*** ../v1.0/patchlevel.h	Sun May 27 21:05:41 1990
X--- patchlevel.h	Sun May 27 21:49:23 1990
X***************
X*** 1 ****
X! #define PATCHLEVEL 0
X--- 1 ----
X! #define PATCHLEVEL 1
X*** ../v1.0/README	Sun May 27 21:05:34 1990
X--- README	Sun May 27 21:16:33 1990
X***************
X*** 30,36 ****
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--- 30,36 ----
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 VISUAL 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*** ../v1.0/HelpText.c	Sun May 27 21:05:36 1990
X--- HelpText.c	Sun May 27 21:09:53 1990
X***************
X*** 29,34 ****
X--- 29,47 ----
X  
X  #include	"global.h"
X  
X+ String	Bcc_Help_Text = "\
X+ Use the Bcc: window to specify blind carbon copy\n\
X+ recipients for this message.  Blind carbon recipient\n\
X+ names are removed from the message prior to delivery.\n\n\
X+ Pressing the right mouse button in this window displays\n\
X+ a list of your aliases.  Releasing the right mouse\n\
X+ button while one of the alias names is highlighted\n\
X+ copies that name into the window, preceeding it with a\n\
X+ comma if needed.\n\n\
X+ Pressing the backspace or delete key erases a previously\n\
X+ entered character.  Control_W (^W) erases a previous\n\
X+ word, Control_U (^U) the entire line.";
X+ 
X  String	Cc_Help_Text = "\
X  Use the Cc: window to specify carbon copy recipients for\n\
X  this message.\n\n\
X***************
X*** 35,67 ****
X  Pressing the right mouse button in this window displays a\n\
X  list of your aliases.  Releasing the right mouse button\n\
X  while one of the alias names is highlighted copies that\n\
X! name into the window, preceeding it with a comma if needed.\n\n\
X  Pressing the backspace or delete key erases a previously\n\
X! entered character.  Control_W (^W) erases a previous word\n\
X! and Control_U (^U) the entire line.\n\n\
X! See also the Subject:, To:, Autograph, and Deliver helps.";
X  
X  String	Copy_Help_Text = "\
X! copy - copies a message into the file or folder named in\n\
X! the File: window, without deleting the original.\n\n\
X! The right button pops up a menu for both the copy and\n\
X! Copy commands.\n\n\
X  The uppercase (Copy) command copies the message to a file\n\
X  whose name is derived from the author of the message,\n\
X  rather than from any name currently in the File: window.\n\n\
X! See also the save command help information.";
X  
X  String	Delete_Help_Text = "\
X! delete - removes a message from the folder, the message\n\
X! to be deleted indicated by selection highlight in the\n\
X! index (top) window.\n\n\
X! The right button pops up a menu for both the delete and\n\
X! undelete commands.\n\n\
X! Undelete restores the most recently deleted message,\n\
X! providing changes have not already been committed.\n\
X! Undelete may be pressed repeatedly to restore all deleted\n\
X! messages.\n\n\
X! See also the hold, save, folder, Newmail, and quit helps.";
X  
X  String	Deliver_Help_Text = "\
X  The Deliver button will complete the currently composed\n\
X--- 48,80 ----
X  Pressing the right mouse button in this window displays a\n\
X  list of your aliases.  Releasing the right mouse button\n\
X  while one of the alias names is highlighted copies that\n\
X! name into the window, preceeded with a comma if needed.\n\n\
X  Pressing the backspace or delete key erases a previously\n\
X! entered character.  Control_W (^W) erases a previous\n\
X! word and Control_U (^U) the entire line.";
X  
X  String	Copy_Help_Text = "\
X! Pressing this button copies the current message to the\n\
X! file or folder named in the File: window, without marking\n\
X! the original for removal.\n\n\
X! The right mouse button pops up a menu for both the copy\n\
X! and Copy commands.\n\n\
X  The uppercase (Copy) command copies the message to a file\n\
X  whose name is derived from the author of the message,\n\
X  rather than from any name currently in the File: window.\n\n\
X! See also the save command for additional information.";
X  
X  String	Delete_Help_Text = "\
X! Pressing this button removes the selected message from the\n\
X! current folder.\n\n\
X! The right mouse button pops up a menu for both the delete\n\
X! and undelete commands.\n\n\
X! Undelete restores the selected message (if it has been\n\
X! marked 'D'eleted), otherwise the deleted message with the\n\
X! smallest message number is restored.\n\n\
X! Undelete may be used repeatedly to restore all deleted\n\
X! messages if changes have not yet been committed.\n\n\
X! See also preserve, save, folder, Newmail, and quit.";
X  
X  String	Deliver_Help_Text = "\
X  The Deliver button will complete the currently composed\n\
X***************
X*** 79,155 ****
X  entered character.\n\n\
X  Control_W (^W) erases the previous word and Control_U (^U)\n\
X  the entire line.\n\n\
X! See also the folder and save commands.";
X  
X  String	Folder_Help_Text = "\
X  The left button changes the active folder to the one\n\
X  specified in the File: window.  Changing folders COMMITs\n\
X  any modifications to the current folder.\n\n\
X! The right button brings up a list of folders from which to\n\
X! choose.\n\n\
X  Clicking the left button on a directory (indicated by\n\
X! trailing slash) while still holding down the right, expands\n\
X! the directory, if it has files.\n\n\
X! Releasing the right button copies the selected name to the\n\
X! File: window.";
X  
X  String	Hold_Help_Text = "\
X! Pressing the hold button marks the selected message for\n\
X! retention in the system mailbox, usually after having\n\
X! first saved it to another file or folder.\n\n\
X! The button is insensitive if not currently in your system\n\
X! mail folder.";
X  
X  String	Index_Help_Text = "\
X! The index window displays a list of mail messages\n\
X! available in the current folder.\n\n\
X  Pressing the left mouse button anywhere on the line marks\n\
X! the message as selected (for other commands) but does not\n\
X! automatically display the selected message.\n\n\
X! Pressing the right button selects and automatically\n\
X  displays the message.\n\n\
X! See also the read command help information.";
X  
X  #ifdef SUNOS_4
X  String	NewMail_Help_Text = "\
X! Newmail - causes user's system mail folder to become the\n\
X! active folder (if mail exists) and includes any new mail\n\
X! that may have been delivered since the program was started.\n\
X! This action commits any changes made to the current folder.\n\n\
X! The button will highlight whenever new mail is available.\n\n\
X! The right mouse button provides a choice between committing\n\
X! changes, or just incorporating new messages without\n\
X! committing changes (but only if the system mailbox is your\n\
X! current folder).";
X  #else
X  String	NewMail_Help_Text = "\
X! Newmail - causes user's system mail folder to become the\n\
X! active folder (if mail exists) and includes any new mail\n\
X! that may have been delivered since the program was started.\n\
X! This action commits any changes made to the current folder.\n\n\
X! The button will highlight whenever new mail is available.\n\n\
X! The right mouse button is a copy of the Newmail command.";
X  #endif
X  
X  String	Print_Help_Text = "\
X! Print - causes the selected message to be printed on the\n\
X! system printer.\n\n\
X! A notice will be displayed in the status window indicating\n\
X! which message was printed, along with its size in bytes.\n\n\
X! See the index help for information on selecting a message.";
X  
X  String	Quit_Help_Text = "\
X  quit - terminates xmail, committing changes made to the\n\
X  current folder.\n\n\
X! The right button pops up a menu for both the quit and exit\n\
X! commands.\n\n\
X  Use exit when you wish to leave xmail without committing\n\
X! folder changes.\n\n\
X  See also the folder, Newmail, and delete commands.";
X  
X  String	Read_Help_Text = "\
X! read - displays the selected message in the text (bottom)\n\
X! window.\n\n\
X  Message selection is indicated by caret and highlight in\n\
X  the index (top) window.\n\n\
X  The right button pops up a menu for reading the message,\n\
X--- 92,179 ----
X  entered character.\n\n\
X  Control_W (^W) erases the previous word and Control_U (^U)\n\
X  the entire line.\n\n\
X! See folder and save commands for additional information.";
X  
X  String	Folder_Help_Text = "\
X  The left button changes the active folder to the one\n\
X  specified in the File: window.  Changing folders COMMITs\n\
X  any modifications to the current folder.\n\n\
X! The right button brings up a list of folders from which\n\
X! to choose.\n\n\
X  Clicking the left button on a directory (indicated by\n\
X! trailing slash) while still holding down the right,\n\
X! expands the directory, if it has files.\n\n\
X! Releasing the right button copies the selected name to\n\
X! the File: window.";
X  
X  String	Hold_Help_Text = "\
X! This command marks the selected message for preservation\n\
X! in the system mailbox.  Although the \"hold\" variable is\n\
X! normally set by xmail (if not explicitly unset by a user)\n\
X! it is now changeable within xmail.  If hold is not set,\n\
X! preserve is used after having saved a message to another\n\
X! file or folder when you still wish to preserve the mail\n\
X! message in your system folder.  (See the mail man page.)\n\n\
X! The right mouse button presents a menu of three mail\n\
X! environment variables that may be altered while in xmail.\n\
X! Commands listed denote what state each variable will be\n\
X! changed to if the appropriate label is highlighted as the\n\
X! mouse button is released.";
X  
X  String	Index_Help_Text = "\
X! The index window displays a list of mail messages in the\n\
X! current folder, as well as the currently selected message.\n\n\
X  Pressing the left mouse button anywhere on the line marks\n\
X! a message as selected (for other commands) but does not\n\
X! automatically display the message in the text window.\n\n\
X! Pressing the right button selects and also automatically\n\
X  displays the message.\n\n\
X! See also the read command for additional help information.";
X  
X  #ifdef SUNOS_4
X  String	NewMail_Help_Text = "\
X! Pressing this button causes your system mail folder to\n\
X! become the current folder (if mail exists) and includes\n\
X! any new mail delivered since the last time your system\n\
X! folder was accessed.  This action COMMITS any changes to\n\
X! the current folder.\n\n\
X! The Newmail button will highlight whenever new mail has\n\
X! been delivered.  The right mouse button provides a\n\
X! choice between committing changes, or just incorporating\n\
X! new messages without committing changes (only if your\n\
X! system mailbox is already your current folder).";
X  #else
X  String	NewMail_Help_Text = "\
X! Pressing this button causes your system mail folder to\n\
X! become the current folder (if mail exists) and includes\n\
X! any new mail delivered since the last time your system\n\
X! folder was accessed.  This action COMMITS any changes to\n\
X! the current folder.\n\n\
X! The Newmail button will highlight whenever new mail has\n\
X! been delivered.  The right mouse button is a duplicate\n\
X! of the Newmail command.";
X  #endif
X  
X  String	Print_Help_Text = "\
X! Pressing this button causes the selected message to be\n\
X! printed on the system printer.\n\n\
X! A message will be displayed in the status window\n\
X! indicating which message was printed, along with its\n\
X! size in bytes.\n\n\
X! See also the index window for help on selecting a message.";
X  
X  String	Quit_Help_Text = "\
X  quit - terminates xmail, committing changes made to the\n\
X  current folder.\n\n\
X! The right mouse button pops up a menu for the quit and\n\
X! exit commands.\n\n\
X  Use exit when you wish to leave xmail without committing\n\
X! the current folder's changes.\n\n\
X  See also the folder, Newmail, and delete commands.";
X  
X  String	Read_Help_Text = "\
X! Pressing this button causes the selected message to be\n\
X! displayed in the text (bottom) window.\n\n\
X  Message selection is indicated by caret and highlight in\n\
X  the index (top) window.\n\n\
X  The right button pops up a menu for reading the message,\n\
X***************
X*** 164,172 ****
X  The right mouse button displays a menu for selecting\n\
X  'reply', 'reply included', 'replyall' (which addresses all\n\
X  recipients of the original mail), or 'replyall included'.\n\
X! The include options automatically copy the original message\n\
X! into the new one.\n\n\
X! See also the send command.";
X  
X  String	Save_Help_Text = "\
X  save - copies a message to the file or folder named in\n\
X--- 188,195 ----
X  The right mouse button displays a menu for selecting\n\
X  'reply', 'reply included', 'replyall' (which addresses all\n\
X  recipients of the original mail), or 'replyall included'.\n\
X! The include options automatically copy the original\n\
X! message into the new one.\n\n\See also the send command.";
X  
X  String	Save_Help_Text = "\
X  save - copies a message to the file or folder named in\n\
X***************
X*** 186,195 ****
X  'send'ing, or 'forwarding a message'.  Forwarding includes\n\
X  the text of the current message in the new one.\n\n\
X  As with the 'reply' command, a dialog box is provided to\n\
X! specify the name of the recipient(s), subject, and who to\n\
X! send copies of this message.  The user presses the\n\
X! 'Deliver' button to complete the operation.\n\n\
X! See also the reply command.";
X  
X  String	Sign_Help_Text = "\
X  You may insert you choice of the two autograph strings\n\
X--- 209,218 ----
X  'send'ing, or 'forwarding a message'.  Forwarding includes\n\
X  the text of the current message in the new one.\n\n\
X  As with the 'reply' command, a dialog box is provided to\n\
X! specify the name of the recipient(s), subject, and to whom\n\
X! to send copies of this message.  Pressing the 'Deliver'\n\
X! button completes the operation.\n\n\
X! See also the reply command for additional information.";
X  
X  String	Sign_Help_Text = "\
X  You may insert you choice of the two autograph strings\n\
X***************
X*** 214,233 ****
X  Pressing the backspace or delete key erases a previously\n\
X  entered character.\n\n\
X  Control_W (^W) erases the previous word and Control_U (^U)\n\
X! the entire line.\n\n\
X! See also the To:, Cc:, Autograph, and Deliver help messages.";
X  
X  String	Text_Help_Text = "\
X  The text window displays the currently selected message.\n\n\
X  The scrollbar may be used to move the displayed text, as\n\
X  necessary.\n\n\
X! See also the index window help on selecting messages.";
X  
X  String	Title_Help_Text = "\
X  The Title window displays the\n\n\
X  program name and version number, along with the\n\n\
X  name of the current mail folder and its message count(s).\n\n\
X! Under release 4 of X11, pressing the left mouse button on\n\
X  the National Semiconductor Corporation logo in the top\n\
X  left corner of the title bar issues a request to iconify\n\
X  this application.";
X--- 237,255 ----
X  Pressing the backspace or delete key erases a previously\n\
X  entered character.\n\n\
X  Control_W (^W) erases the previous word and Control_U (^U)\n\
X! the entire line.";
X  
X  String	Text_Help_Text = "\
X  The text window displays the currently selected message.\n\n\
X  The scrollbar may be used to move the displayed text, as\n\
X  necessary.\n\n\
X! See also the index window for help on selecting a message.";
X  
X  String	Title_Help_Text = "\
X  The Title window displays the\n\n\
X  program name and version number, along with the\n\n\
X  name of the current mail folder and its message count(s).\n\n\
X! Under Release 4 of X11, pressing the left mouse button on\n\
X  the National Semiconductor Corporation logo in the top\n\
X  left corner of the title bar issues a request to iconify\n\
X  this application.";
X***************
X*** 236,247 ****
X  Use the To: window to specify the recipients for this mail\n\
X  message.\n\n\
X  Pressing the right mouse button in this window displays a\n\
X! list of your alias names.  Releasing the right mouse button\n\
X! while one of the alias names is highlighted will copy that\n\
X! name into the window, prepending it with a comma if needed.\n\n\
X  Pressing the backspace or delete key erases a previously\n\
X! entered character.  Control_W (^W) erases the previous word\n\
X! and Control_U (^U) erases the entire line.\n\n\
X! See also the Subject:, Cc:, Autograph, and Deliver helps.";
X  
X  /* HelpText */
X--- 258,269 ----
X  Use the To: window to specify the recipients for this mail\n\
X  message.\n\n\
X  Pressing the right mouse button in this window displays a\n\
X! list of your alias names.  Releasing the right mouse\n\
X! button while one of the names is highlighted will copy\n\
X! that name into the window, prepended with a comma if\n\
X! needed.\n\n\
X  Pressing the backspace or delete key erases a previously\n\
X! entered character.  Control_W (^W) erases the previous\n\
X! word and Control_U (^U) erases the entire line.";
X  
X  /* HelpText */
X*** ../v1.0/Imakefile	Sun May 27 21:05:36 1990
X--- Imakefile	Sun May 27 21:11:33 1990
X***************
X*** 1,16 ****
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--- 1,21 ----
X  #
X! # Imakefile for xmail 1.1
X  #
X! # SUNOS_4 is defined if compiling under Sun OS 4.x - newer directory routines
X  #
X! #if SunOSPlatform && OSMajorVersion >= 4
X!            SUNOS_4 = -DSUNOS_4
X! #endif
X! #
X! # XAW_BC is defined if compiling with X11 Release 4 - changes in Xt/Xaw names
X! #
X! #if ProjectX > 3
X!            XAW_BC = -DXAW_BC
X! #endif
X! #
X!           DEFINES = $(XAW_BC) $(SUNOS_4)
X!           DEPLIBS = $(DEPXAWLIB) $(DEPXMULIB) $(DEPXTOOLLIB) $(DEPXLIB)
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*** ../v1.0/Mailwatch.c	Sun May 27 21:05:37 1990
X--- Mailwatch.c	Sun May 27 21:11:33 1990
X***************
X*** 87,92 ****
X--- 87,94 ----
X  #define	flagdown_width	no_mail_width
X  #define	flagdown_height	no_mail_height
X  
X+ #define between(x, i, y)	((i) < (x) ? (x) : (i) > (y) ? (y) : (i))
X+ 
X  #define REMOVE_TIMEOUT(id) if (!id) ; else XtRemoveTimeOut(id)
X  #ifdef X11R2
X  #define XtReleaseGC(w, gc) XtDestroyGC(gc)
X***************
X*** 261,273 ****
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  
X--- 263,276 ----
X      if (w->core.height == 0)
X  	w->core.height = max(pix_up_h, pix_dn_h);
X  
X!     w->mailbox.flag_up = FALSE;		/* because it hasn't been shown yet */
X  
X!     w->mailbox.last_access = (stat(w->mailbox.filename, &stbuf) == 0) ?
X!                              stbuf.st_atime : 0 ;	/* last accessed */
X! 
X!     /* set status check timer */
X      w->mailbox.interval_id = XtAddTimeOut(w->mailbox.update * 1000,
X! 	                                        clock_tic, (caddr_t) w);
X  }
X  
X  
X***************
X*** 301,307 ****
X  Display *dpy;
X  Window root;
X  char *file;
X! int *width, *height;
X  {
X      Pixmap bitmap;
X      int status, foo, bar;
X--- 304,310 ----
X  Display *dpy;
X  Window root;
X  char *file;
X! unsigned int *width, *height;
X  {
X      Pixmap bitmap;
X      int status, foo, bar;
X***************
X*** 354,360 ****
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  */
X  static void
X  check_mailbox(w, force_redraw)
X--- 357,365 ----
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.  The number of times
X! ** the terminal bell is rung is controlled by the same .mailrc resource
X! ** (bell) used by Sunview's mailtool.
X  */
X  static void
X  check_mailbox(w, force_redraw)
X***************
X*** 361,391 ****
X  MailwatchWidget w;
X  Boolean 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--- 366,401 ----
X  MailwatchWidget w;
X  Boolean force_redraw;
X  {
X!  int		i, redraw = 0;
X!  char		*p = NULL;
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!        force_redraw = 0;
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!           force_redraw = 0;
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.flag_up == FALSE) {
X+              if (w->mailbox.bell) {
X+                 i = 1;
X+                 if (p = (char *)GetMailrc("bell"))
X+                    sscanf(p, "%d", &i);
X+                 i = between(1, i, 5);
X+                 for (; i > 0; i--)
X+                     XBell(XtDisplay(w), MAILBOX_VOLUME);
X+                }
X               w->mailbox.flag_up = TRUE;
X               redraw = TRUE;
X               XtCallCallbacks(w, XtNcallback, NULL);
X***************
X*** 504,509 ****
X   MailwatchWidget w = (MailwatchWidget) gw;
X  
X   w->mailbox.flag_up = FALSE;
X!  redraw_mailbox(w, NULL);
X  } /* reset_mailbox */
X  
X--- 514,519 ----
X   MailwatchWidget w = (MailwatchWidget) gw;
X  
X   w->mailbox.flag_up = FALSE;
X!  redraw_mailbox(w);
X  } /* reset_mailbox */
X  
X*** ../v1.0/Mailwatch.h	Sun May 27 21:05:38 1990
X--- Mailwatch.h	Sun May 27 21:09:54 1990
X***************
X*** 12,19 ****
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--- 12,21 ----
X  #ifndef XtNupdate
X  #define XtNupdate	"update"	/* Int: how often to check mail */
X  #endif /* XtNupdate */
X! #ifndef XtNfile
X  #define XtNfile		"file"		/* String:  file name to check */
X+ #endif /* Xtfile */
X+ #define XtNbell		"bell"		/* boolean to ring bell on new mail */
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*** ../v1.0/actions.c	Sun May 27 21:05:42 1990
X--- actions.c	Sun May 27 21:11:34 1990
X***************
X*** 38,62 ****
X   * The following software modules were created and are Copyrighted by National
X   * Semiconductor Corporation:
X   *
X!  *  1. DoAutograph:
X!  *  2. DoCmd:
X!  *  3. DoDone:
X!  *  4. DoNothing:
X!  *  5. DoReply:
X!  *  6. DoSave:
X!  *  7. DoSelected:
X!  *  8. Folder:
X!  *  9. Iconify:
X!  * 10. MyNotify:
X!  * 11. NextField:
X!  * 12. PrintMsg:
X!  * 13. SetAliases:
X!  * 14. SetCursor:
X!  * 15. SetDirectory:
X!  * 16. SetFolders:
X!  * 17. SetHelp:
X!  * 18. SetPopup: and
X!  * 19. SetSelect.
X   *
X   * Author:  Michael C. Wagnitz - National Semiconductor Corporation
X   *
X--- 38,66 ----
X   * The following software modules were created and are Copyrighted by National
X   * Semiconductor Corporation:
X   *
X!  *  1. CheckInsert
X!  *  2. DeleteChar
X!  *  3. EraseIt:
X!  *  4. DoAutograph:
X!  *  5. DoCmd:
X!  *  6. DoDone:
X!  *  7. DoNothing:
X!  *  8. DoReply:
X!  *  9. DoSave:
X!  * 10. DoSelected:
X!  * 11. Folder:
X!  * 12. Iconify:
X!  * 13. MyNotify:
X!  * 14. NextField:
X!  * 15. PrintMsg:
X!  * 16. SetAliases:
X!  * 17. SetCursor:
X!  * 18. SetDirectory:
X!  * 19. SetFolders:
X!  * 20. SetHelp:
X!  * 21. SetMenu:
X!  * 22. SetPopup: and
X!  * 23. SetSelect.
X   *
X   * Author:  Michael C. Wagnitz - National Semiconductor Corporation
X   *
X***************
X*** 74,102 ****
X  
X  
X  /*
X! ** @(#)DeleteLine() - Deletes the entire current line from the fileWindow.
X! **                    Simulates the action of the KILL character (ctrl-U).
X  */
X  /* ARGSUSED */
X  XtActionProc
X! DeleteLine(w, event, params, num_params)
X  Widget w;
X  XEvent *event;
X  String *params;
X  Cardinal *num_params;
X  {
X!  XtTextBlock    	textblock;
X!  XtTextPosition 	lastPos;
X!  Cardinal	 	i;
X  
X!  lastPos = TextGetLastPos(w);
X   textblock.firstPos = 0;
X   textblock.length   = 0;
X   textblock.ptr      = "";
X  
X!  for (i = lastPos; i > StartPos && FileBuf[i - 1] != '\n'; i--);
X!  XtTextReplace(w, i, lastPos, &textblock);
X!  Normalize(w);
X  } /* DeleteLine */
X  
X  
X--- 78,174 ----
X  
X  
X  /*
X! ** @(#)CheckInsert() - prevents the user from munging up the File: prompt.
X! ** If the current insertion point is less than the minimum StartPos, move
X! ** the insertion point to the StartPos.
X  */
X  /* ARGSUSED */
X  XtActionProc
X! CheckInsert(w, event, params, num_params)
X  Widget w;
X  XEvent *event;
X  String *params;
X  Cardinal *num_params;
X  {
X!  if (XtTextGetInsertionPoint(w) < StartPos)
X!      XtTextSetInsertionPoint(w, StartPos);
X! } /* CheckInsert */
X  
X! 
X! /*
X! ** @(#)EraseIt() - Delete the specified portion of text and force remaining
X! ** text to be visible.  The second step is a hack for beginning-of-line(),
X! ** end-of-line() actions in the text widget, because we want to ensure the
X! ** insertion pointer stays where we wanted it.
X! */
X! void
X! EraseIt(w, i, pos)
X! Widget	w;
X! XtTextPosition	i, pos;
X! {
X!  XtTextBlock    textblock;
X! 
X   textblock.firstPos = 0;
X   textblock.length   = 0;
X   textblock.ptr      = "";
X  
X!  XtTextReplace(w, i, pos, &textblock);
X! 
X!  if (i > StartPos + 40) {			/* ensure text is visible */
X!     pos = i - 10;
X!     XtTextSetInsertionPoint(w, pos);
X!     XtTextSetInsertionPoint(w, TextGetLastPos(w));
X!    }
X! 
X!  XtTextSetInsertionPoint(w, i);
X! } /* EraseIt */
X! 
X! 
X! /*
X! ** @(#)DeleteChar() - prevents the user from deleting past the File: prompt.
X! ** If the current insertion point is greater than the minimum StartPos, then
X! ** delete the previous character.
X! */
X! /* ARGSUSED */
X! XtActionProc
X! DeleteChar(w, event, params, num_params)
X! Widget w;
X! XEvent *event;
X! String *params;
X! Cardinal *num_params;
X! {
X!  XtTextBlock    textblock;
X!  XtTextPosition pos, i;
X! 
X!  pos = XtTextGetInsertionPoint(w);
X!  if (pos > StartPos) {
X!     i = pos - 1;
X!     EraseIt(w, i, pos);
X!    }
X! } /* DeleteChar */
X! 
X! 
X! /*
X! ** @(#)DeleteLine() - Deletes the entire current line from the file window.
X! **                    Simulates the action of the KILL character (ctrl-U).
X! */
X! /* ARGSUSED */
X! XtActionProc
X! DeleteLine(w, event, params, num_params)
X! Widget w;
X! XEvent *event;
X! String *params;
X! Cardinal *num_params;
X! {
X!  XtTextPosition pos, i;
X! 
X! 
X!  pos = XtTextGetInsertionPoint(w);
X!  if (pos > StartPos) {
X!     for (i = pos; i > StartPos && FileBuf[i - 1] != '\n'; i--);
X! 
X!     EraseIt(w, i, pos);
X!    }
X  } /* DeleteLine */
X  
X  
X***************
X*** 112,130 ****
X  String *params;
X  Cardinal *num_params;
X  {
X!  XtTextBlock    	textblock;
X!  XtTextPosition	lastPos;
X!  Cardinal	 	i, j;
X  
X!  textblock.firstPos = 0;
X!  textblock.length   = 0;
X!  textblock.ptr      = "";
X  
X!  lastPos = TextGetLastPos(w); 
X!  for (i = lastPos; i > StartPos && FileBuf[i - 1] == ' '; i--);
X!  for (j = i; i > StartPos && FileBuf[i - 1] != ' '; i--);
X!  XtTextReplace(w, i, lastPos, &textblock);
X!  Normalize(w);
X  } /* DeleteWord */
X  
X  
X--- 184,198 ----
X  String *params;
X  Cardinal *num_params;
X  {
X!  XtTextPosition	pos, i;
X  
X!  pos = XtTextGetInsertionPoint(w);
X!  if (pos > StartPos) {
X!     for (i = pos; i > StartPos && FileBuf[i - 1] == ' '; i--);
X!     for (; i > StartPos && FileBuf[i - 1] != ' '; i--);
X  
X!     EraseIt(w, i, pos);
X!    }
X  } /* DeleteWord */
X  
X  
X***************
X*** 170,182 ****
X   else if (strcmp(Command, "file %\n") != 0)
X           Bell("No mail\n");		/* If not 'new mail', complain */
X        else {
X!          for (n = 0; n < mailargc; n++) {
X!              if (strcmp(mailargv[n], "-f") == 0) {
X!                 for (i = n + 2; i <= mailargc;) mailargv[n++] = mailargv[i++];
X!                 mailargc -= 2;		/* throw away an folder argument */
X!                 n -= 2;			/* re-examine new mailargv value */
X!                }
X!             }
X           callMail(mailargc, mailargv);	/* restart the mail connections */
X           strcpy(Command, "Start");	/* Let em know we've re-started */
X           UnsetNewmail(w, NULL, NULL);
X--- 238,247 ----
X   else if (strcmp(Command, "file %\n") != 0)
X           Bell("No mail\n");		/* If not 'new mail', complain */
X        else {
X!          if (strcmp(mailargv[mailargc - 2], "-f") == 0) {
X!             mailargc -= 2;		/* throw away any folder argument */
X!             mailargv[mailargc] = NULL;	/* and NULL end of argument list */
X!            }
X           callMail(mailargc, mailargv);	/* restart the mail connections */
X           strcpy(Command, "Start");	/* Let em know we've re-started */
X           UnsetNewmail(w, NULL, NULL);
X***************
X*** 195,201 ****
X  String		*params;
X  Cardinal	*num_params;
X  {
X!  Done(w, *params, *params);
X  } /* DoDone */
X  
X  
X--- 260,266 ----
X  String		*params;
X  Cardinal	*num_params;
X  {
X!  Done(w, *params, NULL);
X  } /* DoDone */
X  
X  
X***************
X*** 225,235 ****
X  String *params;
X  Cardinal *num_params;
X  {
X!  caddr_t	client_data;
X!  caddr_t	call_data;
X! 
X!  client_data = params[0];
X!  Reply(w, client_data, call_data);
X  } /* DoReply */
X  
X  
X--- 290,296 ----
X  String *params;
X  Cardinal *num_params;
X  {
X!  Reply(w, *params, NULL);
X  } /* DoReply */
X  
X  
X***************
X*** 244,254 ****
X  String		*params;
X  Cardinal	*num_params;
X  {
X!  caddr_t	client_data;
X!  caddr_t	call_data;
X! 
X!  client_data = params[0];
X!  Save(w, client_data, call_data);
X  } /* DoSave */
X  
X  
X--- 305,311 ----
X  String		*params;
X  Cardinal	*num_params;
X  {
X!  Save(w, *params, NULL);
X  } /* DoSave */
X  
X  
X***************
X*** 264,270 ****
X  Cardinal *num_params;
X  {
X   XtTextPosition	pos;
X!  int		num;
X  
X  
X   if (! mailpid)
X--- 321,328 ----
X  Cardinal *num_params;
X  {
X   XtTextPosition	pos;
X!  Widget		iw = WidgetOf(WidgetOf(toplevel, "topBox"), "indexWindow");
X!  int		num = 0;
X  
X  
X   if (! mailpid)
X***************
X*** 271,281 ****
X      Bell("No mail\n");
X   else {
X      if (num_params) {
X!        pos = XtTextGetInsertionPoint(WidgetOf(WidgetOf(toplevel, "vpane"), "indexWindow"));
X!        num = PositionToMsgNumber(pos);	/* no current message returns zero */
X!        if (num &&
X!            *params[0] != 'n' && *params[0] != '-' && *params[0] != 'u')
X!           sprintf(Command, "%s %d\n", params[0], num);
X         else sprintf(Command, "%s\n", params[0]);
X         writeMail(Command);
X        }
X--- 329,340 ----
X      Bell("No mail\n");
X   else {
X      if (num_params) {
X!        if (*params[0] != 'n' && *params[0] != '-') {
X!           pos = XtTextGetInsertionPoint(iw);
X!           num = PositionToMsgNumber(pos);	/* no current msg equals zero */
X!           if (num && *params[0] == 'u' && IndexBuf[pos + 1] != 'D') num = 0;
X!          }
X!        if (num) sprintf(Command, "%s %d\n", params[0], num);
X         else sprintf(Command, "%s\n", params[0]);
X         writeMail(Command);
X        }
X***************
X*** 298,304 ****
X   char		*p;
X   Cardinal	n;
X  
X!  pos = TextGetLastPos(WidgetOf(WidgetOf(WidgetOf(toplevel, "vpane"), "commandPanel"), "fileWindow"));
X   if ((n = pos - StartPos) <= 0)
X      Bell("Specify a folder name (in the [File: ] box) first\n");
X   else {
X--- 357,363 ----
X   char		*p;
X   Cardinal	n;
X  
X!  pos = TextGetLastPos(WidgetOf(WidgetOf(WidgetOf(toplevel, "topBox"), "commandPanel"), "fileWindow"));
X   if ((n = pos - StartPos) <= 0)
X      Bell("Specify a folder name (in the [File: ] box) first\n");
X   else {
X***************
X*** 313,326 ****
X  ** This time, we indicate a specific mail folder to process.
X  */
X         XMail.MFileName = XtNewString(p);
X!        for (n = 0; n < mailargc; n++)
X!            if (strcmp(mailargv[n], "-f") == 0) {
X!               mailargv[++n] = XMail.MFileName;
X!               break;
X!              }
X!        if (n == mailargc) {		/* if not previously specified */
X            mailargv[mailargc++] = "-f";
X            mailargv[mailargc++] = XMail.MFileName;
X           }
X         callMail(mailargc, mailargv);
X         strcpy(Command, "Start");	/* Let em know we've re-started */
X--- 372,383 ----
X  ** This time, we indicate a specific mail folder to process.
X  */
X         XMail.MFileName = XtNewString(p);
X!        if (strcmp(mailargv[mailargc - 2], "-f") == 0) {
X!           mailargv[mailargc - 1] = XMail.MFileName;
X!          } else {
X            mailargv[mailargc++] = "-f";
X            mailargv[mailargc++] = XMail.MFileName;
X+           mailargv[mailargc] = NULL;	/* list MUST be NULL terminated */
X           }
X         callMail(mailargc, mailargv);
X         strcpy(Command, "Start");	/* Let em know we've re-started */
X***************
X*** 329,362 ****
X  } /* Folder */
X  
X  
X- /*
X- ** @(#)InsertSpace() - prevents user from deleting past the File: prompt.
X- ** It checks the last position of text, and if it matches StartPos, inserts
X- ** a space so that delete-previous-character() can only delete the space.
X- */
X  /* ARGSUSED */
X- XtActionProc
X- InsertSpace(w, event, params, num_params)
X- Widget w;
X- XEvent *event;
X- String *params;
X- Cardinal *num_params;
X- {
X-  XtTextBlock    textblock;
X-  XtTextPosition lastPos;
X- 
X-  lastPos = TextGetLastPos(w);
X-  XtTextSetInsertionPoint(w, lastPos);
X-  if (lastPos == StartPos) {
X-     textblock.firstPos = 0;
X-     textblock.length   = 1;
X-     textblock.ptr      = " ";
X-     XtTextReplace(w, lastPos, lastPos, &textblock);
X-    }
X- } /* InsertSpace */
X- 
X- 
X- /* ARGSUSED */
X  /*
X  ** @(#)Iconify() - request window iconification
X  */
X--- 386,392 ----
X***************
X*** 367,373 ****
X  String *params;
X  Cardinal *num_params;
X  {
X! #ifndef X11R3
X   Display		*disp;
X  
X   disp = XtDisplay(toplevel);
X--- 397,403 ----
X  String *params;
X  Cardinal *num_params;
X  {
X! #if XtSpecificationRelease >= 4
X   Display		*disp;
X  
X   disp = XtDisplay(toplevel);
X***************
X*** 410,415 ****
X--- 440,447 ----
X  
X  
X   if (strcmp(w->core.name, "Cc") == 0)
X+     name = "Bcc"; else
X+  if (strcmp(w->core.name, "Bcc") == 0)
X      name = "To"; else
X   if (strcmp(w->core.name, "To") == 0)
X      name = "Subject"; else
X***************
X*** 433,451 ****
X  Cardinal *num_params;
X  {
X   XtTextPosition	pos;
X   int		num;
X  
X   if (! mailpid)
X      Bell("No mail\n");
X   else {
X!     pos = XtTextGetInsertionPoint(WidgetOf(WidgetOf(toplevel, "vpane"), "indexWindow"));
X      num = PositionToMsgNumber(pos);	/* no current message returns zero */
X      if (! num) Bell("No messages to print.\n");
X      else {
X!        sprintf(Command, "| %d \"lpr -p\"\n", num);
X!     writeMail(Command);
X     }
X-    }
X  } /* PrintMsg */
X  
X  
X--- 465,490 ----
X  Cardinal *num_params;
X  {
X   XtTextPosition	pos;
X+  char		*cp;
X   int		num;
X  
X   if (! mailpid)
X      Bell("No mail\n");
X   else {
X!     pos = XtTextGetInsertionPoint(WidgetOf(WidgetOf(toplevel, "topBox"), "indexWindow"));
X      num = PositionToMsgNumber(pos);	/* no current message returns zero */
X      if (! num) Bell("No messages to print.\n");
X      else {
X!        cp = GetMailEnv("printmail");
X!        if (! cp) {
X!           sprintf(Command, "| %d \"lpr -p\"\n", num);
X!          } else {
X!           sprintf(Command, "| %d \"%s\"\n", num, cp);
X!           XtFree(cp);
X!          }
X!        writeMail(Command);
X!       }
X     }
X  } /* PrintMsg */
X  
X  
X***************
X*** 460,467 ****
X  String		*params;
X  Cardinal	*num_params;
X  {
X!  Arg		args[MAXARGS];
X!  Cardinal	i, j, k, n, x, y;
X   Display        *ad;
X   Widget		bw, lw, popup, hold, left;
X   Window         aw, dumy, root;
X--- 499,507 ----
X  String		*params;
X  Cardinal	*num_params;
X  {
X!  Arg		args[8];
X!  Cardinal	i, j, k;
X!  int		n, x, y;
X   Display        *ad;
X   Widget		bw, lw, popup, hold, left;
X   Window         aw, dumy, root;
X***************
X*** 505,511 ****
X  ** Make equal width command buttons which contain the alias names
X  */
X         XtSetArg(args[0], XtNdefaultDistance, 1);
X!        lw = XtCreateManagedWidget("list", formWidgetClass, popup, args, ONE);
X  
X         bw = left = NULL;
X         XtSetArg(args[0], XtNwidth, XTextWidth(TextFontStr, aliases[i]->name, j) + 14);
X--- 545,551 ----
X  ** Make equal width command buttons which contain the alias names
X  */
X         XtSetArg(args[0], XtNdefaultDistance, 1);
X!        lw = XtCreateManagedWidget("table", formWidgetClass, popup, args, ONE);
X  
X         bw = left = NULL;
X         XtSetArg(args[0], XtNwidth, XTextWidth(TextFontStr, aliases[i]->name, j) + 14);
X***************
X*** 515,526 ****
X  
X         i = j = 0;
X         if (n > 10) {			/* If more than ten aliases try to */
X!           j = (int) sqrt((double)n);	/* make list approximately square. */
X!           i = (int) n / j;
X!           if (i * j < n) i++;
X!           if (j > 3) i++;
X!           if (j > 4) i++;
X!           if (j > 5) i = 21;		/* try to keep box inside main shell */
X           }
X  
X         for (n = 0; aliases[n]; n++) {
X--- 555,568 ----
X  
X         i = j = 0;
X         if (n > 10) {			/* If more than ten aliases try to */
X!           j = n / 4;			/* make list approximately square. */
X!           while (j * j < n) j++;	/* (int. hack to replace sqrt usage) */
X!           i = n / --j;
X!           while (i * j < n) i++;
X!           while (j > 3 && i < 25) {	/* try to keep box inside main shell */
X!                 i++;
X!                 j--;
X!                }
X           }
X  
X         for (n = 0; aliases[n]; n++) {
X***************
X*** 527,533 ****
X             XtSetArg(args[4], XtNlabel, aliases[n]->name);
X             XtSetArg(args[5], XtNfromHoriz, left);
X             XtSetArg(args[6], XtNfromVert, bw);
X!            bw = XtCreateManagedWidget("button",commandWidgetClass,lw,args,7);
X  
X             if (i) {			/* post names in a rectangular list */
X                if (n % i == 0) hold = bw;
X--- 569,575 ----
X             XtSetArg(args[4], XtNlabel, aliases[n]->name);
X             XtSetArg(args[5], XtNfromHoriz, left);
X             XtSetArg(args[6], XtNfromVert, bw);
X!            bw = XtCreateManagedWidget("entry", commandWidgetClass, lw, args, 7);
X  
X             if (i) {			/* post names in a rectangular list */
X                if (n % i == 0) hold = bw;
X***************
X*** 578,584 ****
X  
X   XDefineCursor(XtDisplay(w), XtWindow(w), tmpC);
X  
X!  if (*num_params == 1)			/* flush output if only one parameter */
X      XFlush(XtDisplay(toplevel));
X  } /* SetCursor */
X  
X--- 620,626 ----
X  
X   XDefineCursor(XtDisplay(w), XtWindow(w), tmpC);
X  
X!  if (*num_params)			/* flush output if parameterized */
X      XFlush(XtDisplay(toplevel));
X  } /* SetCursor */
X  
X***************
X*** 594,608 ****
X  String		*params;
X  Cardinal	*num_params;
X  {
X!  Arg		args[MAXARGS];
X   Display        *ad;
X   Window         aw, dumy, root;
X   Widget		lw, above, this_one, to_left, popup;
X!  Cardinal	x, y, n;
X   char		trans[BUFSIZ], tmp[BUFSIZ], *p, *List = NULL;
X   char		foldir[BUFSIZ], *GetMailEnv(), *getenv();
X   int		foldlen, List_size, newline = 0;
X!  DIR		*dirp;
X  
X  #ifdef SUNOS_4
X   struct dirent	*dp;
X--- 636,650 ----
X  String		*params;
X  Cardinal	*num_params;
X  {
X!  Arg		args[8];
X   Display        *ad;
X   Window         aw, dumy, root;
X   Widget		lw, above, this_one, to_left, popup;
X!  int		x, y, n;
X   char		trans[BUFSIZ], tmp[BUFSIZ], *p, *List = NULL;
X   char		foldir[BUFSIZ], *GetMailEnv(), *getenv();
X   int		foldlen, List_size, newline = 0;
X!  DIR		*dirp = NULL;
X  
X  #ifdef SUNOS_4
X   struct dirent	*dp;
X***************
X*** 629,686 ****
X   popup = XtNameToWidget(w, "popupList");
X  
X   if (! popup || popup->core.being_destroyed) {
X!     p = GetMailEnv("folder");
X      if (p && strlen(p)) {
X         sprintf(foldir, "%s/%s/", getenv("HOME"), p);
X!        XtFree(p);
X!       } else sprintf(foldir, "%s/", getenv("HOME"));
X      foldlen = strlen(foldir);
X  
X      XtSetArg(args[0], XtNtranslations, XtParseTranslationTable(l_Trans));
X      popup = XtCreatePopupShell("popupList",overrideShellWidgetClass,w,args,1);
X  
X!     if (mailpid)
X!        List = QueryMail("folders");
X!     else {
X!        if ((dirp = opendir(foldir)) == NULL)
X!           XtError("SetFolder: Can't access mail folder directory");
X! /*
X! ** allocate one block to 'List' to begin with
X! */
X!        List_size = BUFSIZ;
X!        List = XtMalloc(List_size);
X!        strcpy(List, "");
X!        x = 0;
X!        for (dp = readdir(dirp); dp != NULL; dp = readdir(dirp))
X!            if (strcmp(dp->d_name, ".") && strcmp(dp->d_name, "..")) {
X!               if (strlen(List) + strlen(dp->d_name) + 2 > List_size) {
X!                  List_size += BUFSIZ;
X!                  List = XtRealloc(List, List_size);
X!                 }
X!               strcat(List, " ");
X!               strcat(List, dp->d_name);
X!               if (++x % 6 == 0) {
X!                  x = 0;
X!                  strcat(List, "\n");
X!                 }
X!              }
X!        List = XtRealloc(List, strlen(List) + 1);
X!        closedir(dirp);
X!       }
X  /*
X  ** determine proper label width by finding longest word length
X  */
X      strcpy(trans, "");
X!     for (x = 0, p = List; *p; p++) {
X!         if (*p == ' ' || *p == '\n' || *p == '\t') {
X!            if (x) {
X!               tmp[x] = '\0';
X!               x = 0;
X!               if (strlen(trans) < strlen(tmp))
X!                  strcpy(trans, tmp);
X!              }
X!           } else tmp[x++] = *p;
X!        }
X  
X      if (x) {
X         tmp[x] = '\0';
X--- 671,730 ----
X   popup = XtNameToWidget(w, "popupList");
X  
X   if (! popup || popup->core.being_destroyed) {
X!     p = GetMailEnv("folder");			/* returns NULL if none */
X      if (p && strlen(p)) {
X         sprintf(foldir, "%s/%s/", getenv("HOME"), p);
X!        XtFree((char *)p);			/* p still has an address */
X!       } else
X!        strcpy(foldir, "");	/* If no folder variable, then no folders */
X      foldlen = strlen(foldir);
X  
X      XtSetArg(args[0], XtNtranslations, XtParseTranslationTable(l_Trans));
X      popup = XtCreatePopupShell("popupList",overrideShellWidgetClass,w,args,1);
X  
X!     if (*foldir) {				/* if folder variable exists */
X!        if (mailpid)
X!           List = QueryMail("folders");
X!        else {
X!           if (dirp = opendir(foldir)) {		/* and folder is readable... */
X!              List_size = BUFSIZ;
X!              List = XtMalloc(List_size);	/* start with a BUFSIZ block */
X!              strcpy(List, "");
X!              x = 0;
X!              for (dp = readdir(dirp); dp != NULL; dp = readdir(dirp))
X!                  if (strcmp(dp->d_name, ".") && strcmp(dp->d_name, "..")) {
X!                     if (strlen(List) + strlen(dp->d_name) + 2 > List_size) {
X!                        List_size += BUFSIZ;
X!                        List = XtRealloc(List, List_size);
X!                       }
X!                     strcat(List, " ");
X!                     strcat(List, dp->d_name);
X!                     if (++x % 6 == 0) {
X!                        x = 0;
X!                        strcat(List, "\n");
X!                       }
X!                    }
X!              List = XtRealloc(List, strlen(List) + 1);
X!              closedir(dirp);
X!             } /* end - if folder directory is readable */
X!          } /* end - if mail process is running */
X!       } /* end - if a folder value exists */
X  /*
X  ** determine proper label width by finding longest word length
X  */
X      strcpy(trans, "");
X!     x = 0;
X!     if (p)				/* if folders exist and are readable */
X!        for (p = List; *p; p++) {
X!            if (*p == ' ' || *p == '\n' || *p == '\t') {
X!               if (x) {
X!                  tmp[x] = '\0';
X!                  x = 0;
X!                  if (strlen(trans) < strlen(tmp))
X!                     strcpy(trans, tmp);
X!                 }
X!              } else tmp[x++] = *p;
X!           }
X  
X      if (x) {
X         tmp[x] = '\0';
X***************
X*** 688,698 ****
X            strcpy(trans, tmp);
X        }
X  
X!     if ((n = strlen(trans)) == 0) {	/* if there are no mail folders */
X!        n = 0;					/* set a dummy width and */
X!        XtSetArg(args[n], XtNwidth, 1); n++;	/* height so MenuPopup() */
X!        XtSetArg(args[n], XtNheight, 1); n++;	/* won't complain about */
X!        XtSetValues(popup, (ArgList) args, n);	/* zero width or height */
X  
X         XtDestroyWidget(popup);	/* it would be nice if MenuPopup() cared */
X        } else {
X--- 732,741 ----
X            strcpy(trans, tmp);
X        }
X  
X!     if ((n = strlen(trans)) == 0) {	/* if no folders set dummy width and */
X!        XtSetArg(args[0], XtNwidth, 1);		/* height so MenuPopup() */
X!        XtSetArg(args[1], XtNheight, 1);		/* won't complain about */
X!        XtSetValues(popup, (ArgList) args, 2);	/* zero width or height */
X  
X         XtDestroyWidget(popup);	/* it would be nice if MenuPopup() cared */
X        } else {
X***************
X*** 723,731 ****
X                      tmp[x++] = '/';
X                      tmp[x] = '\0';
X                     }
X!                  n = 4;
X!                  XtSetArg(args[n], XtNlabel, tmp);			n++;
X!                  XtSetArg(args[n], XtNfromHoriz, to_left);		n++;
X                   if (! to_left) XtSetArg(args[n], XtNfromVert, above);	n++;
X     
X                   this_one = XtCreateManagedWidget("listbutton", commandWidgetClass,
X--- 766,773 ----
X                      tmp[x++] = '/';
X                      tmp[x] = '\0';
X                     }
X!                  XtSetArg(args[4], XtNlabel, tmp);
X!                  XtSetArg(args[5], XtNfromHoriz, to_left);		n = 6;
X                   if (! to_left) XtSetArg(args[n], XtNfromVert, above);	n++;
X     
X                   this_one = XtCreateManagedWidget("listbutton", commandWidgetClass,
X***************
X*** 749,785 ****
X               } else {
X                 if (x == 0) tmp[x++] = '+';	/* start folder names with a 'plus' */
X                 tmp[x++] = *p;
X            }
X-        }
X  
X!     if (x) {
END_OF_FILE
if test 48483 -ne `wc -c <'Patch.01a'`; then
    echo shar: \"'Patch.01a'\" unpacked with wrong size!
fi
# end of 'Patch.01a'
fi
echo shar: End of archive 2 \(of 5\).
cp /dev/null ark2isdone
MISSING=""
for I in 1 2 3 4 5 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked all 5 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
Opinions expressed reflect those of the author only.



More information about the Comp.sources.x mailing list