home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-04-27 | 56.7 KB | 1,306 lines |
- Newsgroups: comp.sources.x
- From: markham@cadence.com (Jeff Markham)
- Subject: v19i026: xmail - X Window System interface to the mail program, Part01/10
- Message-ID: <csx-v19i026=xmail.142358@sparky.IMD.Sterling.COM>
- X-Md4-Signature: e74dbcf810afb81cf9552d18e33e2658
- Date: Wed, 10 Mar 1993 20:24:25 GMT
- Approved: chris@sparky.imd.sterling.com
-
- Submitted-by: markham@cadence.com (Jeff Markham)
- Posting-number: Volume 19, Issue 26
- Archive-name: xmail/part01
- Environment: X11
- Supersedes: xmail: Volume 15, Issue 18-26
-
- #!/bin/sh
- #! /bin/sh
- # This is a shell archive. Remove anything before this line, then feed it
- # into a shell via "sh file" or similar. To overwrite existing files,
- # type "sh file -c".
- # Contents: README CHANGES confirm.c
- # Wrapped by chris@sparky on Wed Mar 10 14:17:43 1993
- PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin ; export PATH
- echo If this archive is complete, you will see the following message:
- echo ' "shar: End of archive 1 (of 10)."'
- if test -f 'README' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'README'\"
- else
- echo shar: Extracting \"'README'\" \(3728 characters\)
- sed "s/^X//" >'README' <<'END_OF_FILE'
- X
- X xmail - X Window System interface to the mail program
- X
- X Copyright 1990,1991,1992 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 Support: See Below
- X
- X IN-MEMORIUM
- X Michael C. Wagnitz passed away recently. Michael had a deep love
- X and appreciation for the X Windows community and the spirit of
- X sharing and cooperation it embodies.
- X
- X DESCRIPTION
- X xmail is an X-based interface to the Berkeley mail program. This is
- X version 1.5 of xmail. This version of xmail depends heavily upon the
- X installation of the application default resources file for the proper
- X declaration of features and enhancements documented in the man pages.
- X If the defaults file or the resource declarations are not installed or
- X in some manner made accessable to the X11 resource database manager,
- X xmail will operate in only a minimal fashion. Please see the man page
- X for additional details.
- X
- X This version of xmail includes support for decompressing and displaying
- X the content of an X-Face mail header, if such a header exists in the
- X message being read. This feature is a compile time option, and requires
- X the existence of the compface library routines, which are NOT supplied
- X with the xmail sources. X-Face headers are compressed bitmap images,
- X typically of the face of the person owning such a header. The compressed
- X header contains only printable characters, which allows it to be included
- X in a mail message. The USENIX FaceSaver project is typically the source
- X for these bitmaps, which are compressed into X-Face header format using
- X the compface software tools written and distributed by James Ashton
- X <jaa@cs.su.oz.au>. The compface library is also provided with the distri-
- X bution of the faces software, written by Rich Burridge, and is available
- X by email from his archive server <rb-archive-server@Aus.Sun.COM>.
- X
- X A non-imake version of a make file is provided as make.file. You may
- X use this file to build xmail, or invoke M.I.T.'s imake facility to
- X generate a Makefile. If you use the make.file instead, you must ensure
- X that the proper environment is defined for your particular architecture
- X and operating system.
- X
- X
- X SUPPORT
- X
- X PLEASE report any bugs or enhancements to me at the address below, so
- X changes can be incorporated in the sources and official patches posted.
- X
- X Jeff Markham
- X Cadence Design Systems Domain: markham@cadence.com
- X 555 River Oaks Parkway Bldg. 4 Phone: 408/944-7679
- X San Jose, Ca 95134
- END_OF_FILE
- if test 3728 -ne `wc -c <'README'`; then
- echo shar: \"'README'\" unpacked with wrong size!
- fi
- # end of 'README'
- fi
- if test -f 'CHANGES' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'CHANGES'\"
- else
- echo shar: Extracting \"'CHANGES'\" \(43942 characters\)
- sed "s/^X//" >'CHANGES' <<'END_OF_FILE'
- X
- X February, 1992
- X
- X The following changes have been effected for Patchlevel 5 of xmail.
- X
- X ALL known segmentation violations and related mysterious crashes HAVE BEEN
- XELIMINATED, largely in thanks to the wonderful software tool 'purify' by the
- XPure Software Corporation, of Los Altos, CA. If you haven't yet seen this
- Xexcellent diagnostic tool, rush right out and get yourself a copy. It IS the
- Xcats meow!
- X
- XAs part of the effort at eliminating problems with segmentation violations,
- Xseveral casts for XtMalloc() and XtFree() calls have been added, and I no
- Xlonger free the mail connection read buffer each time it is used. Instead I
- Xsimply allow it to grow to the maximum size of a read ever performed on the
- Xmail pipe.
- X
- XLike previous versions of xmail, version 1.5 depends HEAVILY on the proper
- Xinstallation of the application defaults file in the appropriate directory.
- XIf you fail to install the new application defaults file, xmail will run, but
- Xonly in a restricted fashion, and many of the documented features will not be
- Xpresent.
- X
- XHelpText.c - More changes to the formatting of text in the popup window.
- X
- XImakefile - ADDED definitions for SIGACTION, for those systems which do
- X not support the BSD sigvec function. ADDED the option to use
- X REGEXP if your system supplies regexp.h. The default will be
- X to use re_comp() and re_exec() instead. Also added a define
- X to use BSD_SIGNALS, for SGI and similar machines with that
- X requirement.
- X
- XMailwatch.c - Added support for the 'q' keypress in the icon window to
- X cause xmail to terminate. Made necessary modifications to
- X support the final released version of XPM 3.0 which is being
- X provided with the X11R5 Contrib tape distribution.
- X
- Xactions.c - Added a function to extract the folder variable value once
- X only, in place of making multiple calls to GetMailEnv().
- X
- XMessage delivery can now be effected directly from the keyboard, by use of
- X<Meta>-key translations in the applications default file.
- X
- XHelp for most windows can now be
- Xcalled up using only the middle mouse button, although text windows which would
- Xotherwise accept text pasting still require the addition of the <Shift> key as
- Xwell.
- X
- X---------------------- end of changes for patchlevel 5 -----------------------
- X
- X September, 1991
- X
- X The following changes have been effected for Patchlevel 4 of xmail.
- X
- X Many more bugs have been fixed, and the overall size of the resident image
- Xmade even smaller, with the removal of the dependency on alloca and regex.c.
- XI have also made changes necessary to effect operation under X11 Release 5,
- Xand linted the sources to remove as many lint complaints as is practical.
- X
- XI believe with this version I have eliminated the various and sundry program
- Xcrashes at unexpected times and in wierd places. The culprit was (of course)
- Xme, and violation of the rule: Don't feed your children dynamically allocated
- Xdata with a fork, as it can often cause you to choke and die.
- X
- XI have made extensive changes to the way in which the editor is invoked during
- Xmessage composition and the manner in which the message is delivered to the
- Xsendmail daemon. Users may now begin a message composition, and immediately
- Xcontinue processing available messages. Message composition will no longer
- Xchew up cpu cycles and message delivery will no longer leave a defunct (i.e.
- Xzombie) process hanging around to consume available process slots.
- X
- XLike the previous version (1.3) of xmail, this version depends heavily on the
- Xinstallation of the application defaults file in the appropriate directory.
- XThe declaration of SetAlias() actions for To:,Cc:, and Bcc: translations no
- Xlonger require the inclusion of the call to MenuPopup(). This means any 1.3
- Xversion of the application defaults file MUST be replaced with the new copy.
- X
- XIf you fail to install the new application defaults file, xmail will run, but
- Xonly in a restricted fashion, and many of the documented features will not be
- Xpresent. This is because many of the resource declarations have been moved
- Xfrom the source code into the defaults file. Also with this version, the
- Xspecification of colors and fonts are left to the choice of the user. Some
- Xexample declarations are included in the defaults file, but they are commented
- Xout, so as not to effect the choices made by the user. This means if you fail
- Xto specify color requirements on a color system, xmail will come up in black
- Xand white (except for the National Semiconductor logo in the title bar %^).
- X
- XHelpText.c - Made several small changes to better format the text in the
- X help window popup. Also added corrections for the latest
- X set of enhancements and bug fixes.
- X
- XImakefile - Removed the definition for NO_WAIT3 as no longer necessary.
- X Added several compiler options, to aid xmail specification.
- X Define USE_DIRENT if readdir() uses <dirent.h> instead of
- X <sys/dir.h>. Define X_FACE and COMPFACE if you have the
- X compface library installed and you want xmail to auto-
- X matically display the X-Face: header, if found in a message.
- X Define XPM if you have the Xpm version 3 library and want
- X support for multi-colored icons. Define LPT if you require
- X att environment support for pseudo ports. Define
- X MAILBOX_DIRECTORY if your mail spool is located in other than
- X the default /usr/spool/mail location. (If not specified, the
- X default will be used.) Define DEFAULT_VISUAL if your copy of
- X vi lies in some place other than /usr/ucb. (If not specified,
- X /usr/ucb/vi will be the default editor.) Define
- X DEFAULT_MAILER if your mail program is not the standard
- X /usr/ucb/Mail. CAUTION - Operation is NOT guaranteed with
- X other mailers.
- X
- X Dependencies have been included for those files which need
- X to know if a particular compile option has been specified or
- X not. The dependencies have been COMMENTED OUT, because the
- X imake Makefile rule would force a rebuild of the Makefile
- X unless you add an Imakefile dependency to the Makefile rule.
- X If you want the source file dependencies enabled, you need to
- X edit the created Makefile, and add Imakefile as the dependency
- X to the Makefile target, to prevent rebuilding the Makefile.
- X
- XMailwatch.c - The mailhost variable was incorrectly referenced in tests for
- X a NULL value.
- X
- X Added the definition for MAXHOSTNAMELEN if it is not defined.
- X
- X Replaced the attempt to determine the mail host name using
- X sendmail with just the name of the current host. This routine
- X was bogus at best, and the change eliminates complaints from
- X non-sendmail daemons that some sites are using.
- X
- X Added optional support for XPM formatted icons, if the user
- X has libXpm.a (and desires multi-colored icons %^). Thanks
- X go to Herve Soulard <soulard@sor.inria.fr> for the suggestion
- X and assistance.
- X
- XXMail.ad - I have now commented out the color specifications in the
- X application defaults file, in order to not enforce default
- X colors on users who wish to use their own generic definitions.
- X This means that if you 1) don't uncomment these definitions
- X when you install the file, or 2) specify colors in your
- X personal default resources file, xmail will execute in black
- X and white on a color monitor. I have also eliminated the
- X definitions of buttonFont and helpFont in this file, but have
- X included a definition for *Font:. The definition for the
- X editorCommand resource has also been commented out, which
- X allows the program to utilize the default VISUAL definition
- X in the user's .mailrc file, unless they add a specification
- X for editorCommand to replace the default action.
- X
- X Added definitions for search forward and backward to the
- X index window translations, to allow searching for multiple
- X messages by author or subject.
- X
- X Removed declarations for MenuPopup action in the translations
- X for To:, Cc:, and Bcc: windows when executing SetAliases().
- X
- Xactions.c - Change access to the "command_pattern" and "output_pattern"
- X variables, in keeping with the correction of the global
- X definitions of same.
- X
- X I found that I was mislead in my beliefs that the pipe (|)
- X command was universal in Berkeley mail. Instead, it is
- X a unique feature of Sun's version of mail. This version of
- X xmail has an alternative method of printing a message, for
- X those systems that are not Sun compatible.
- X
- X The main folder list is now sorted into alphabetical order.
- X In the loop which checks each folder file for directory-ness,
- X I changed the diropen() calls to use stat() instead.
- X
- X Aliases (which are also now sorted) are now placed in order
- X from left to right, top to bottom.
- X
- X Both SetAliases and SetFolders now call XtPopupSpringLoaded,
- X instead of having the MenuPopup call in their translation
- X tables. Menus are now only created if the list information
- X truely exists.
- X
- X Added support for X11 Release 5.
- X
- X Folder button is now made insensitive while extracting the
- X initial folders list, to show busy state, since the InputOnly
- X busy cursor window does not map while the mouse button is
- X depressed.
- X
- XcallMail.c - SYSV ioctl calls incorrectly reference an undefined variable
- X "tty", which should have been "slave".
- X
- X Some systems did not like the test for return value from the
- X ioctl calls. The test(s) have been eliminated.
- X
- X Removed the duplicate inclusion of the <sgtty.h> file.
- X
- X Added the inclusion of signal.h, for those systems which do
- X not already include it as part of the inclusion of param.h.
- X
- X Loop on the attempt to establish master/slave connections in
- X case the first attempt(s) fail but more possibilities exist.
- X
- X Changed call arguments to callMail to eliminate mailargc as
- X unnecessary.
- X
- Xcallbacks.c - Changed the access to "command_pattern" and "output_pattern"
- X variables, in keeping with the correction of the global
- X definitions of same.
- X
- X Changed the way I handled message delivery. Instead of
- X forking a process to perform the delivery, I now access the
- X sendmail daemon directly. I also prepend a greater than (>)
- X symbol to any line of text which begins with the mail keyword
- X ``From '', to prevent mail from believing it is the start of
- X a new message. Also fixed the case of Forwarding to include
- X the greater than symbol on the first line of the forwarded
- X message, which also begins with the word 'From '.
- X
- X Fixed the routine which strips the actual addresses from the
- X list of addressees (which might include full names as well)
- X so that the sendmail command line is as brief as possible. I
- X have tested this with a wide variety of examples and line
- X lengths, and no longer suffer from any core dumps. This
- X should resolve the problem some users have had with parsing
- X aliases which included full name specifications.
- X
- X Also finding that the "~[a|A]" commands are only available
- X in Sun's version of mail, I have implemented a mechanism to
- X use a .[Ss]ignature file, if no signature can be found in the
- X user's .mailrc file and a .[Ss]ignature file exists in their
- X home directory. This method allows a user to have both a
- X lower case .signature as well as an uppercase .Signature file
- X if they so desire.
- X
- X Removed the wait3() call for the mail child when terminating
- X xmail.
- X
- X Removed the duplicate inclusion of the <sys/time.h> file.
- X
- X Removed the pointer declaration for the clock variable.
- X
- X Added support for tilde referenced record files.
- X
- X Changed the assumptions about .face file contents to include
- X not adding the information if the user is also using the
- X faces.sendmail script (as noted by its name in the environment
- X definition for sendmail), and to insert the X-Face: header
- X if the user's .face file does not contain it.
- X
- X Fixed a bug in the Reply routine which caused a segmentation
- X violation if the Return-Path: header did not contain chevrons.
- X
- X Consolidated the functions which deliver the composition mail
- X message to eliminate the need for global definitions of the
- X header strings and the occasional crash caused by the delivery
- X child having copies of those variables.
- X
- X Added code to ensure that all included or forwarded messages
- X with mail keyword 'From ' at the beginning of a line have a
- X preceeding greater-than symbol to eliminate false triggers.
- X
- Xdefs.h - Added support for R5 portability issues.
- X
- Xdirectory.c - Sub-directory folder lists are now sorted alphabetically.
- X
- X In the loop which checked each folder file for directory-ness,
- X I replaced the diropen() calls with stat() calls instead.
- X
- X To avoid problems later on with XtNameToWidget, folder names
- X of directories which contain either a period or an asterisk
- X do not cause generation a sub-menu.
- X
- Xenvirons.c - In building the aliases list, I had not taken into account
- X the fact that GetMailrc() returns a NULL if no aliases were
- X defined.
- X Added expansion routines to mail variable requests to
- X the inclusion of process environment definitions.
- X
- X Fixed a major bug in the alias parsing routines which could
- X not handle an alias the decoded to a full name and address
- X syntax as permitted by the RFC822 specifications.
- X
- X Added a call to qsort the alias list.
- X
- X Source'ing of files in the .mailrc file now received expanded
- X environment variable definitions in filenames.
- X
- Xglobal.h - Added the declaration for the endEdits() signal handler.
- X Also removed global declarations for message header variables
- X which no longer require global definition, and eliminated the
- X declarations for waitC and xtermC cursors.
- X
- Xhandler.c - Fixed a bug which caused non-expert users with deleted
- X messages in a folder to have to complete a Confirmation
- X response when terminating xmail from the iconic position.
- X (The question was moot, as being iconic made it already
- X too late to ask for confirmation of the deletes.)
- X
- X Eliminated the static buffer for examining the contents of
- X the title bar, when trying to determine if In_System_Folder.
- X
- Xmail.c - Changed the way in which I control the message composition.
- X The previous (1.3) method was horribly wasteful of cpu cycles,
- X and didn't allow the user to continue reading other mail
- X messages until after the editing session concluded. The new
- X method ensures only one message composition at a time occurs,
- X and allows immediate continuation of other xmail functions.
- X
- X Added an event handler to correct bug for warping of cursor
- X to To: window when popping up the headers window transient.
- X Users whose window manager decorates transients will now see
- X the cursor in the To: window, instead of in the decoration.
- X
- X Eliminated the call to wait3(). It is no longer needed.
- X
- X Eliminated the full path xterm specification in the default
- X edit command. This because some users choose to install X11
- X in a non-standard (/usr/bin/X11) location.
- X
- X Changed the way I handled fork failures, now reporting the
- X cause of the failure when trying to start an edit session.
- X
- Xparser.c - Added code to eliminate bogus messages from the mail child,
- X and to turn off a possible ``cmd'' definition in the .mailrc
- X file, so as to be able to detect the inability to pipe a
- X command to the printer.
- X
- X Added an additional error message parse when trying to copy,
- X write, or save a file to a bogus address which returns the
- X message "Not a directory".
- X
- X Added notation of file saved when using the write command.
- X
- X Moved the function which marks a 'P'reserved message to the
- X parser routine, in case the user is not in their system
- X folder.
- X
- X Changed the way I determine the mail prompt string from a
- X static examination at first startup, to take what mail is
- X actually giving me when the connection is established. This
- X eliminates the bug where some users declare a prompt string
- X which translates differently than as declared (such as prompts
- X with embedded quoted strings which do not include the quotes
- X when mail echos the prompt).
- X
- X I now clear the In_Bogus_Mail_File flag if restarting the
- X mail connection, so the title bar will be properly updated.
- X
- Xregex.c - This file has been eliminated, in favor of using the regexp
- X routines. You may safely delete this file from your sources.
- X
- Xutils.c - Modified writeTo() to not include X-Face header strings in
- X the displayed message text, if the user sets the *No_X_Hdr
- X resource to True or uses the -nx command line option, and an
- X X-Face header is included in the incoming message.
- X
- X Replaced the previous mechanism for setting a wait cursor in
- X the various windows with the FAQ'd example of creating an
- X InputOnly window to prevent unwanted events while the program
- X is busy. Also fixed the problem of having the Cursor window
- X Enter/LeaveNotify events force overwrite of the status info.
- X
- Xwindows.c - Added a definition for Control_J to remove the extra text
- X help window, for those workstation keyboards without a line-
- X feed key.
- X
- Xxmail.c - Eliminated internally defined default fonts, allowing the
- X user to specify the fonts in their personal resource file.
- X
- X Also added the command line/resource declaration for textFont
- X in keeping with the definitions for buttonFont and helpFont.
- X All three font specifications can now be obtained from the
- X single generic declaration of *Font: in the resource file,
- X or by using the command line option ``-fn'' or ``-font''.
- X
- X I now parse command line arguments in an effort to eliminate
- X bogus borderwidth specifications (negative or beyond practical
- X limits) in an effort to keep the application from becoming
- X non-functional due to incorrect sizing operations.
- X
- X Increased size of mailargv vector by one to correct bug of
- X not specifying mail program name as argv[0]. This fixes
- X startup processing to not include header information because
- X the '-N' flag was not being recognized.
- X
- Xxmailregex.h - This file is no longer required, as part of the replacement
- X of regex routines with regexp functionality.
- X
- Xxmailregexp.h - This file replaces both xmailregex.h and regex.c as the means
- X for parsing both command line and output messages.
- X
- Xxmail.man - Made several changes to reflect improvements for xmail 1.4.
- X
- X
- XI'd like to thank all of the users who responded with bug fixes and suggestions
- Xfor the previous (1.3) version of xmail. The list below identifies those
- Xindividuals who were first on their block to point out a failing of xmail 1.3.
- X
- XJohn Amanatides <amana@allegra.att.com>
- X Requested support for tilde defined record variables, and that aliases
- X be presented in sorted order.
- X
- XJames Carlson <carlson@mrx.webo.dg.com>
- X Noted that the use of alloca calls in regex.c were highly unportable,
- X and that signal.h needed to be included in callMail.c for SIGKILL,
- X (for those sites that don't include signal.h as part of param.h).
- X
- XA. G. "Tony" Cohn <agc@dcs.leeds.ac.uk>
- X Encouraged me to add a sort of the folder lists, especially for the
- X sub-levels.
- X
- XDonna Converse <converse@expo.lcs.mit.edu>
- X Pointed to the correct method of utilizing XtCallActionProc to replace
- X the translation table declarations for MenuPopup actions.
- X
- XPierre Corriveau <piec%bnrmtl.UUCP@Larry.McRCIM.McGill.EDU>
- X Pointed out the lack of proper handling of message text lines that
- X began with the keyword ``From ''.
- X
- XChris Crampton <cmc@ecrc.de>
- X Suggested that path dependencies be removed from the xterm invocation
- X of the default visual editor.
- X
- XRichard Griffiths <richard@xanth.b11.ingr.com>
- X Suggested several corrections to the SYSV compilation as a result of
- X his efforts at porting xmail to the Intergraph (Clipper) workstation.
- X
- XNick Holloway <alfie@cs.warwick.ac.uk>
- X Helped identify a major failure in the aliases routines that could not
- X handle an alias which decoded into the full name and address of the
- X recipient.
- X
- XThierry Leconte <Thierry.Leconte@irisa.fr>
- X Suggested a change to remove the X-Face header strings from the message
- X text prior to displaying the message in the text window.
- X
- XCasey Leedom <casey@gauss.llnl.gov>
- X Suggested additional changes in the resource declarations to allow
- X user preferences more latitude in specifying fonts and colors.
- X He also noted some sites might not have a MAXHOSTNAMELEN definition,
- X as well as the duplicate inclusion of the time.h file. Casey was also
- X the first person to provide me with the changes needed for R5.
- X
- XDj Walker-Morgan <dj@micromuse.co.uk>
- X Noted that environs.c aliases() could receive a NULL pointer when
- X asking for the alias list.
- X
- XJohn Nelson <jpn@genrad.com>
- X Was the first to identify the inconsistent declarations for
- X command_pattern and output_pattern global variables.
- X
- XIan Nixon <nixon@asic.nsc.com>
- X Was the first user to point out the gross waste of cpu cycles
- X during the editor phase of the message composition process.
- X
- XGerry Roston <gerry@cs.cmu.edu>
- X Requested that support be included for .signature files, for those
- X sites that aren't using Sun mail.
- X
- XArvind Sabharwal <arvind@gmr.com>
- X Noted the bug about the print command only working in Sun environments.
- X
- XBrian V. Smith <envbvs@epb2.lbl.gov>
- X Was first to note that some environments didn't like my test of the
- X ioctl return status.
- X
- XHerve Soulard <soulard@sor.inria.fr>
- X Provided code examples and the suggestion that the mailbox icons would
- X look better if presented in XPixmap format.
- X
- XMarkus Stumpf <stumpf@dssystem1.informatik.tu-muenchen.de>
- X Encouraged me to remove the bogus ``sendmail -bv'' attempt to determine
- X the mail host identity.
- X
- X---------------------- end of changes for patchlevel 4 -----------------------
- X
- X April, 1991
- X
- X The following changes have been effected for Patchlevel 3 of xmail.
- X
- X Many, many bugs have been fixed, and the overall size of the resident image
- Xhas been cut almost in half. I also believe I have correct all memory leaks.
- X
- X Support is now provided for displaying the content of an X-Face: header, as
- Xa compile time option. If you currently have the compface library routines
- Xprovided by James Ashton, see the Imakefile and change the flags accordingly.
- XThe compface library routines are available from the Rich Burridge Archive
- XServer, at <rb-archive-server@Aus.Sun.COM>. Send the one word subject "Help"
- Xif you have never used this archive-server before. These routines are
- Xalso included as part of Rich Burridge's faces program, also available from
- Xthat same address.
- X
- X
- XImakefile: Eliminated R3 support and changed number and type of defines
- X
- XHelpText.c: Modified some text and added information messages for commands
- X
- XMailwatch.c: Added support to display either user or mail host name in icon
- X Changing the icon tag also changes the application title for
- X window managers, for those cases when more than one copy of the
- X program being run. Removed support for X11R[23].
- X
- Xactions.c: Removed support for X11R3. Changed ``Send'' completion popup
- X to use callbacks instead of action routines. Eliminated need
- X for DoAutograph() and DoDone() action routines. Changed routine
- X SelectionNumber() to use greater-than mark as reference instead
- X of current insertion pointer, because forward/backward-page
- X et.al. messed with current insertion pointer location. Added
- X support for WM_DELETE_WINDOW protocol requests to DoQuit().
- X Added information messages for each command button. Message
- X content is triggered by enter/leave notify events, ala xrn.
- X Cleaned up error messages to use XtError(). Consolidated
- X various popup positioning routines into SetXY(). Changed
- X SetCursor() from XtActionProc to void and moved it to utils.c
- X
- XcallMail.c: Added (UNTESTED) support for non-BSD style communications.
- X The additional code was taken from the X11R4 sources for xterm.
- X Non-BSD routines are untested by the author, as I do not have
- X access to a System-V environment. Eliminated hanging of the
- X parent (for approximately 15 seconds) on close of the slave
- X connection due to child terminated for lack of mail before
- X the parent could issue it's close statement. Fixed the bug for
- X not displaying tabs in messages.
- X
- Xcallbacks.c: Call the alias() extraction routine recursively, to accommodate
- X nested user aliases. Also pass the recipient list to sendmail
- X on the command line, in lieu of the ``-t'' option, to eliminate
- X a bug which sometimes caused sendmail to think the author of
- X the message was actually one of the recipients. Add the USENIX
- X X-Face: header to outgoing messages, if a ``.face'' file exists
- X in the user's home directory. Corrected a bug because System-V
- X sprintf() does not return a pointer to the buffer. Corrected
- X redundant usage of XtNameToWidget() calls. Changed occurrences
- X for all of index() to strchr() to eliminate bug under SunOS_4+.
- X Changed search for author in incoming messages to use ``From:'',
- X ``Return-Path:'', and finally ``From '' header fields. Changed
- X control loop for confirms and ``Send'' completion popups so
- X that they will be displayed even if the parent is obscured.
- X Changed ``outfolder'' to work as documented in Mail man page.
- X Fixed Done routine to not create header files when aborting a
- X message composition.
- X
- Xdefs.h: Eliminated some global variables and support for X11R3. Added
- X declaration for editorCommand resource, and support for those
- X environments which do not include a wait3() system call.
- X
- Xdirectory.c: Changed define declaration to USE_DIRENT, because structure
- X dependency is not SUN_OS dependent.
- X
- Xenvirons.c: Changed occurrences of index() to strchr(). Added support for
- X braced and quoted environment variables. Added recursive
- X parsing of the .mailrc file for ``source''d files. Added
- X recursive parsing of the aliases for addresses, carbon, and
- X blind copies. Merged the extraction of aliases and set options
- X from the mailrc file into one routine. This routine now also
- X supports continuation lines, and returns the LAST occurrence of
- X the targeted set option. This last point fixes a bug where the
- X user declared a prompt string more than once in the mailrc
- X file. Mail would use the second one, while previous version of
- X xmail were looking for the first and hanging indefinitely.
- X
- Xhandler.c: Added info_handler() to write command button window explanation
- X messages in the status window on enter/leave-notify events.
- X Fixed bug in placing marker for current message. Changed all
- X occurrences of index() to strchr(). Fixed bug in index_handler
- X when the current message index went to zero due to a loss of
- X sync with the incoming text from Mail. This would occur if the
- X user pressed the read next/previous message keys too rapidly.
- X
- Xmail.c: Added support for the editorCommand resource, ala xrn. This
- X resource allows the user to specify an ``sprintf''-able string
- X which defines the editor to use when composing messages. Users
- X must supply two ``%s'' entry points, one for the name of the
- X X display connection and one for the name of the edited file.
- X Fallback to the previous VISUAL methodology, if editorCommand
- X specification does not meet requirements. Corrected a bug
- X which prevented the ``Send'' popup from appearing if the parent
- X shell was partially or totally obscured. Made the ``Send''
- X popup reusable, instead of destroying and recreating it each
- X time. Accommodated people who insist on setting a wide border.
- X
- Xnational.bm: Resized the logo to a larger format, to better fit the titleBar.
- X
- Xparser.c: Corrected a bug for those cases when the mail process would
- X disappear unexpectedly. Loss of connection no longer causes
- X a runaway condition. Fixed a bug in the START process which
- X chewed up CPU seconds when started iconic. Restored function-
- X ality for the no-autoprint option, which also fixed a bug of
- X occasionally seeing titlebar or status info in the text window
- X when issuing read previous/next commands in rapid fashion.
- X
- Xrevtable.h: Used in un-compressing X-Face headers.
- X
- Xutils.c: Added support for proportionally spaced fonts, using routine
- X figureWidth(). Added support for X-Face headers on in-coming
- X messages. If found, the X-Face will be displayed in the upper
- X right-hand corner of the text window. Modified Bell() routine
- X to not replace message text in status window if previous text
- X was for an error.
- X
- Xwindows.c: Moved a majority of the action translation tables to the XMail
- X class resource file, to allow the user more flexibility.
- X
- Xxmail.c: Changed the startup procedure to not start in the system folder
- X if starting iconic, to prevent ``newmail'' flag from being reset
- X before the user has opened the icon for the first time. Added
- X separate font declarations for help, text, and button fonts.
- X Added resources and command line options for disabling the new
- X info feature and for specifying the editorCommand format string.
- X Fixed calculations for overall shell size if user has specified
- X a proportional font or wide borders, to keep xmail shell within
- X root window boundaries.
- X
- XThe following persons have sent in suggestions, complaints, and/or patches
- Xwhich have contributed to the development of this patchlevel. In most cases,
- XI was able to respond directly to the submitter using the address indicated.
- XIn some cases, mail would bounce and I could not reach them with a thank-you.
- XIn any case, I wish to express my deepest gratitude to all for their interest
- Xand assistance. If I have inadvertently managed to leave someone's name off
- Xof this list, please forgive me (and thanks again).
- X
- XAlan M. Baum <abaum@amb.cs.gmr.com>
- X requested the ability to recursively parse an alias during ``Send''
- X
- XDana A. Chee <dana@thumper.bellcore.com>
- X one of many to request resources be moved to the application defaults
- X
- XDamian Chu <dac@doc.imperial.ac.uk>
- X forced me (%^) to add WM_DELETE_WINDOW protocol support (thanks)
- X
- XNed Danieley <ndd@sunbar.mc.duke.edu>
- XFrank Peters <fwp1@cc.msstate.edu> and
- XThomas Oeser <thomas%apgraph%ap542@ztivax.siemens.com>
- X identified problems (non-RFC822 compliance) with address parsing
- X
- XNorm Jacobs <jacobs@mot.com>
- X provided suggested code patches for System-V socket connections
- X
- XCasey Leedom <casey@gauss.llnl.gov>
- X identified bugs in the translation tables and suggested the addition
- X of the editorCommand resource specification
- X
- XSteve Losen <scl@virginia.edu>
- X identified bugs in the translation and regular expressions tables
- X
- XAndrew McRae <andrew@megadata.mega.oz.au> and
- XPeter Morreale <morreale@bierstadt.scd.ucar.edu>
- X identified the existence of memory leaks in patchlevel 2
- X
- XFrans Meulenbroeks <meulenbr@cst.philips.nl>
- X suggested the need to use the ``source'' command in .mailrc
- X
- XMarc H. Scholl <scholl@inf.ethz.ch>
- X suggested changes in the ``outfolder'' variable interpretation
- X
- XBrian V. Smith <envbvs@epb2.lbl.gov>
- X noted that the ``Send'' popup would not appear if the xmail parent
- X window (or icon) was obscured
- X
- X
- X---------------------- end of changes for patchlevel 3 -----------------------
- X
- X August, 1990
- X
- X The following changes have been effected for Patchlevel 2 of xmail.
- X
- X
- XImakefile: Reordered R3 and R4 dependencies to allow for R4 make depend.
- X
- XHelpText.c: Corrected some text and added help for text window key actions.
- X
- XMailwatch.c: Added option to start icon in reverse video. Also added
- X option to display the username in the icon window, for those
- X times when xmail processes for more than one user are desired.
- X
- Xactions.c: Changed Newmail action to NOT automatically remove the
- X current folder list when changing to the system mail folder.
- X 'Drop Folders' is now a separate action selectable within the
- X Newmail command menu. Fixed SetFolders routine to not prepend
- X the home directory to folder names beginning with either a
- X dot (.) or foreword slash (/). Also added a COMMIT option
- X to change of folder (when current folder has deleted mail)
- X or cancel of composed message. Commit option is tailorable
- X by -e (expert) flag, 'Preserve' menu selection, and/or resource
- X specification. Re-edit of the current message composition is
- X now supported within the 'Send' popup 'Deliver' sub-menu.
- X Deletions in the 'Send' popup text fields will no longer force
- X the cursor position to the end of the line. Additional error
- X messages from the mail program are also trapped. To better
- X support variations in 'Berkeley' mail, 'set no' commands are
- X no changed to 'unset' commands. Both forms are also parsed.
- X To allow pasting of selected text within the various windows,
- X message indexing is now indicated by a preceding greater-
- X than symbol (>) instead of highlighting using the selection
- X mechanism.
- X
- Xcallbacks.c: Mechanisms for delivering mail messages are now forked to a
- X child process if possible, instead of the previous synchronous
- X system calls. Better support for file and folder recipients
- X to messages are also included. Changes in folder or quitting
- X with a modified folder are now confirmed, unless the expert
- X flag has been specified. Callbacks for re-editing message
- X composition and for dropping the current folders list are also
- X added.
- X
- Xconfirm.c: This is a new routine which supplys the confirmation method.
- X
- Xdefs.h: Changes to accommodate 'make depend' under X11R4 .vs. X11R3.
- X Added command line option flag: expert.
- X
- Xdirectory.c: Modified list display to be more box like, to help prevent
- X the menu from running off the bottom of the screen.
- X
- Xenvirons.c: Improved alias parsing routines to separate real people from
- X file and folder names as recipients of mail messages. Also
- X expanded environment variables in GetMailEnv calls.
- X
- Xglobals.h: Added definitions for new routines and flags.
- X
- Xhandler.c: Removed widget privates dependencies in SystemFolder routine
- X by correctly calling XtGetValues for the label of the widget.
- X
- Xicon.mail: Modified bitmaps for both icons to allow for placing the
- X username under the mailbox, when requested.
- X
- Xmail.c: Added editMail routine to support re-edits of message text.
- X
- Xparser.c: Added ability to export the match function to other routines
- X for better handling of errors from mail. Changed 'set no'
- X calls to 'unset's, for support of SONY NEWS OS mail program.
- X Changed message index highlighting to use the greater-than
- X symbol (>) instead. Revert to default mail prompt of received
- X during startup, for case where user's .mailrc file fails to
- X parse before the intended prompt can be set.
- X
- Xutils.c: Changed message index selection highlighting to use symbol.
- X
- Xwindows.c: Added new command menu options. Provided for cut and paste
- X operations in File and text windows. Added second help
- X window to text area for mapping of keyboard keys to command
- X actions. Added keyboard cursor motion commands to the Index
- X and Text windows. Added routine to parse the icon geometry.
- X
- Xxmail.c: Added support for new options: -e (expert), -iconic, and
- X -rv (reverse video on the icon). Also default to no position
- X (0,0) for icon if not explicitly specified.
- X
- Xxmail.man: Many changes to document patchlevel 2 enhancements and fixes.
- X
- Xxmailregex.h: Added support for use outside of the parser routines. Also
- X added additional error messages for users with problems in
- X their environment or .mailrc file.
- X
- XXMail.ad: Changed the color specifications in the applications defaults
- X from names to hex values, to provide support when the server
- X fails to parse color names (a rare but annoying occurrence).
- X Added definitions for the new command menu buttons.
- X
- X
- XAgain, I'd like to thank the contributors of suggestions and actual patches.
- XI'd also like to thank those persons who sent in complaints and suggestions.
- XIf I somehow managed to forget some of those persons, I hope they can
- Xforgive me.
- X
- X*) Jeff Dauber was first to request the ability to re-edit new messages.
- X
- X*) Mark Scholl was responsible for requesting the addition of a Confirmation
- X option.
- X
- X*) More illegal pointer combination fixes, the ParseIconGeometry() routine,
- X and the expansion of environment variables within the GetMailEnv() routine
- X were supplied by Christos Zoulas.
- X
- X*) Tom Dunigan and Peter Marshall both pointed out the error of my ways in
- X handling RFC822 addresses, and supplied much needed help in making the
- X corrections.
- X
- X*) Peter Marshal also initiated changes to allow a greater variety of editor
- X choices, including better support for the emacs invocation. He was also
- X one of the first to complain about the delays during delivery of messages,
- X which drove the efforts to fork off those tasks.
- X
- X*) David Elliott suggested the no-default icon position, the missing paste
- X ability in the File window, and the need to support 'unset' versus 'set no'
- X construct in mail.
- X
- X*) Suggestions from Casey Leedom precipitated the revision of the Makefile
- X depends to provide better support for make depend under Sun and X11R4.
- X
- X*) Questions from John Meissen prompted modifications to the way the file
- X handlers are modified when calling mail and forking edit children. He also
- X pointed out the probability of a MAIL environment variable pointing to
- X the intended mail spool and made suggestions for changing the code.
- X
- X---------------------- end of changes for patchlevel 2 -----------------------
- X
- X May, 1990
- X
- X The following changes have been effected for Patchlevel 1 of xmail.
- X
- X
- XImakefile: Made improvements in dependencies and SunOS defines.
- X Removed requirement for linkage to system math library.
- X
- XHelpText.c: Text revised and reformatted to better fit the help window
- X
- XMailwatch.c: Corrected illegal pointer combinations and added resources
- X to allow the user to specify the number of times to ring the
- X bell when new mail has arrived. Fixed new mail bell to ring
- X only if flag is not already up.
- X
- XMailwatch.h: Eliminated warning for duplicate XtNfile definition
- X
- Xactions.c: Corrected illegal pointer combinations, added support for
- X improved index handler and Blind carbon copies. Also added
- X support for .mailrc "printmail" definition, and improved error
- X messages when attempting to select non-existent or undefined
- X mail folders. Used integer math instead of sqrt() function to
- X calculate box dimensions for aliases list.
- X
- XcallMail.c: Corrected attempts to write to read-only strings, and fixed
- X case where fork child dies for improper command arguments or
- X illegal or unfound image execution which tried to write error
- X messages to the xmail pipe instead of the terminal screen.
- X A dying child process now also terminates the xmail process.
- X
- Xcallbacks.c: Added support for external sendmail function, improved index
- X handler, and mail variable 'alwaysignore' which is now used
- X to determine header levels for reply, forward, and printed
- X messages. If recipient selection fails to find a value for
- X the <Return_Path:> to a message, the <From:> designate is now
- X used, to eliminate failures to provide a <To:> addressee.
- X Also fixed bug in replyalls which failed to pick up names from
- X the original To: field when preparing addresses for the reply.
- X
- Xdefs.h: Changed TITLE definition to accommodate use of PATCHLEVEL.
- X
- Xenvirons.c: Alias support has been extended to include the word 'group'
- X when manually extracting mail aliases from the user's .mailrc
- X file. Support has also been included for continuation lines.
- X Mechanisms to expand the MAILRC environment variable definition
- X have been eliminated, so that xmail behaves more like mail.
- X Corrected a bug in getMailEnv to return 'True' for variables
- X which have no additional value, such as 'hold' or 'autoprint'.
- X Changed strchr() calls to index().
- X
- Xhandler.c: Function icon_handler() has been added to switch xmail to a
- X dummy mail folder whenever the application is iconified, and
- X to switch back to the previous folder on de-iconification.
- X Improved index_handler() to eliminate repaints of the index
- X window for every deletion or undeletion. Also added code to
- X display as many new message headers as possible, to eliminate
- X unnecessary scrolling of the index window.
- X
- Xmail.c: Changed the fputs() to a write() to help eliminate i/o hanging,
- X added Blind Carbon Copy support to the sendMail function, and
- X added XMail class resources to the xterm message entry window.
- X Changed strrchr() call declarations to rindex().
- X
- Xparser.c: Eliminated multiple redraws of the index window during message
- X deletions, and corrected index message markers for 'N'ew,
- X 'D'eleted, and undeleted mail messages. Corrected a bug in the
- X delete processing to not reread entire message and corrected a
- X bug to erase index and text window datas if no current folder.
- X
- Xutils.c: Added use of PATCHLEVEL in determining TITLE version revision
- X and changed calls for strchr() to index().
- X
- Xwindows.c: Changed name of "hold" button to "preserve", to better match
- X error message text when used incorrectly, eliminated making
- X the preserve button insensitive, to allow use of "set" menu
- X in any folder, added a "set" menu to the "preserve" command
- X button, to toggle mail variables, "alwaysignore", "autoprint",
- X and "hold", and corrected character processing in the file
- X window, to allow deletion and insertion within the line,
- X instead of always at the end. Added use of PATCHLEVEL in
- X determining TITLE version revision
- X
- Xxmail.c: added support for the -iconic command line option, corrected
- X resource handling for iconGeometry, and improved default font
- X handling for minimum dimensions of the xmail application window.
- X Also fixed processing of geometry specifications for the top
- X level window. Update the 'what' database string to reflect
- X current version.
- X
- X
- X
- XI would like to thank the many contributors of suggestions and actual patches.
- XI would also like to thank those persons who sent in complaints, as they were
- Xoften the predictors of the many other corrections and enhancements to xmail.
- X
- X*) Message size tests in parser.c were extended to include support for DEC
- X mail return on size requests, to prevent core dumps under Ultrix UWS 2.2
- X thanks to patches from Dirk Grunwald <grunwald@foobar.Colorado.EDU>
- X
- X*) Corrections to Imakefile to eliminate the need to set SunOS dependency
- X flags manually were driven by suggestions from Casey Leedom
- X <casey@gauss.llnl.gov> and David Elliott <dce@smsc.sony.com>.
- X
- X*) The regular expressions definitions in xmailregex.h were corrected as a
- X result of suggestions from Casey Leedom.
- X
- X*) Suggestions from Casey Leedom, Mark Williams <msw@cpsc.UCalgary.CA>,
- X and Mark Scholl <scholl@inf.ethz.ch> helped identify a problem in the
- X communications links with mail. writeMail() now uses a write instead
- X of fputs, and the connection parameters are set for APPEND instead of
- X non-blocking i/o, to eliminate run-away cpu cycles.
- X
- X*) Many, many illegal pointer combination errors were identified and corrected
- X by Christos Zoulas <christos@guillemin.EE.cornell.edu>
- X
- X*) Thanks go to Robert Viduya <robert@shangri-la.gatech.ude> for suggestions
- X and assistance in adding an icon handler to switch to a dummy mail folder
- X during iconification, to prevent collisions in mail if run from another
- X process while xmail is running.
- X
- X*) Support for an alternate sendmail function was provided after receiving
- X suggestions from Jim Blythe <jsblythe%uk.co.gec-mrc@nsfnet-relay.ac.uk>
- X
- X*) Blind carbon copy support and correction of several bugs were suggested
- X by Jeff Dauber <dauber@parns.nsc.com>
- X
- X*) Support for mail variables autoprint and hold were corrected thanks to
- X requests from Dwayne Lee <dwayne@asic.nsc.com>
- X
- END_OF_FILE
- if test 43942 -ne `wc -c <'CHANGES'`; then
- echo shar: \"'CHANGES'\" unpacked with wrong size!
- fi
- # end of 'CHANGES'
- fi
- if test -f 'confirm.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'confirm.c'\"
- else
- echo shar: Extracting \"'confirm.c'\" \(6406 characters\)
- sed "s/^X//" >'confirm.c' <<'END_OF_FILE'
- X/*
- X * @(#)Confirm - a Yes/No confirmation window with optional prompt argument.
- X *
- X * From an idea contributed by Mitchell L. Model <mlm@odi.com> on 5-17-89
- X *
- X * Copyright 1990,1991,1992 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#include "global.h"
- X
- X#define btnsepr 7
- X
- Xtypedef struct _result {
- X Bool *popflg;
- X Bool *var;
- X Widget shell;
- X } *Result;
- Xvoid
- XProcessOneEvent(display)
- XDisplay *display;
- X{
- X static XEvent event;
- X
- X XNextEvent(display, &event);
- X XtDispatchEvent(&event);
- X} /* ProcessOneEvent */
- X
- X
- Xstatic Result
- XMakeResult(shell, popflg, resultvar)
- XBool *popflg, *resultvar;
- XWidget shell;
- X{
- X Result rec = (Result) XtMalloc((unsigned) sizeof(struct _result));
- X
- X rec->popflg = popflg;
- X rec->var = resultvar;
- X rec->shell = shell;
- X
- X return rec;
- X} /* MakeResult */
- X
- X
- X/* ARGSUSED */
- X/*
- X** ClearConfirm - get rid of the confirmation box.
- X*/
- Xvoid
- XClearConfirm(w, val, result)
- XWidget w;
- XBool val;
- XResult result;
- X{
- X XtPopdown(result->shell);
- X XtDestroyWidget(result->shell);
- X *result->popflg = FALSE;
- X *result->var = val;
- X} /* ClearConfirm */
- X
- X
- X/* ARGSUSED */
- XXtCallbackProc
- XYes(w, closure, call_data)
- XWidget w;
- Xcaddr_t closure;
- Xcaddr_t call_data; /* unused */
- X{
- X Result result = (Result) closure;
- X
- X ClearConfirm(w, TRUE, result);
- X}
- X
- X
- X/* ARGSUSED */
- XXtCallbackProc
- XNo(w, closure, call_data)
- XWidget w;
- Xcaddr_t closure;
- Xcaddr_t call_data; /* unused */
- X{
- X Result result = (Result) closure;
- X
- X ClearConfirm(w, FALSE, result);
- X} /* No */
- X
- X
- X/*
- X * Confirm - put up a window asking for confirmation.
- X */
- XBool
- XConfirm(prompt)
- Xchar* prompt;
- X{
- X int root_x, root_y, child_x, child_y;
- X int nargs, buttons, labelwidth, yeswidth, btnborder, btnwidth;
- X Bool popped_up = FALSE, result = FALSE;
- X String query = NULL;
- X String Translations = "<BtnDown>,<BtnUp>:\n";
- X Window root, child;
- X Widget shell, form, label, yes, no;
- X Arg args[4];
- X Result resultrec;
- X
- X/*
- X** First, find out if expert flag is set. If so, just return True.
- X*/
- X if (XMail.expert == TRUE)
- X return TRUE;
- X/*
- X** Find out where the mouse is, so we can put the confirmation
- X** box right there.
- X*/
- X XQueryPointer(XtDisplay(toplevel), XtWindow(toplevel), &root, &child,
- X &root_x, &root_y, &child_x, &child_y, &buttons);
- X /*
- X ** Construct the confirmation box
- X */
- X shell=XtCreatePopupShell("Confirm",overrideShellWidgetClass,toplevel,args,0);
- X
- X XtSetArg(args[0], XtNtranslations, XtParseTranslationTable(Translations));
- X XtSetArg(args[1], XtNborderWidth, 0);
- X form = XtCreateManagedWidget("form", formWidgetClass, shell, args, 2);
- X
- X if (! prompt) label = NULL;
- X else {
- X if (query = (String) XtMalloc((unsigned) strlen(prompt) + 2)) {
- X (void) strcpy(query, prompt);
- X (void) strcat(query, "?");
- X XtSetArg(args[0], XtNlabel, query);
- X } else XtSetArg(args[0], XtNlabel, "");
- X
- X XtSetArg(args[1], XtNjustify, XtJustifyCenter);
- X XtSetArg(args[2], XtNborderWidth, 0);
- X label = XtCreateManagedWidget("prompt", labelWidgetClass, form, args, 3);
- X XtFree((String) query); /* XtFree tests if target is null */
- X }
- X
- X nargs = 0;
- X XtSetArg(args[nargs], XtNhorizDistance, btnsepr); nargs++;
- X if (prompt) {
- X XtSetArg(args[nargs], XtNfromVert, label); nargs++;
- X XtSetArg(args[nargs], XtNvertDistance, 12); nargs++;
- X }
- X yes = XtCreateManagedWidget("yes", commandWidgetClass, form, args, nargs);
- X
- X nargs = 1;
- X XtSetArg(args[nargs], XtNfromHoriz, yes); nargs++;
- X if (prompt) {
- X XtSetArg(args[nargs], XtNfromVert, label); nargs++;
- X XtSetArg(args[nargs], XtNvertDistance, 12); nargs++;
- X }
- X no = XtCreateManagedWidget("no", commandWidgetClass, form, args, nargs);
- X
- X if (! label)
- X labelwidth = 0;
- X else {
- X XtSetArg(args[0], XtNwidth, NULL);
- X XtGetValues(label, args, ONE);
- X labelwidth = args[0].value;
- X }
- X
- X XtSetArg(args[0], XtNwidth, NULL);
- X XtSetArg(args[1], XtNborder, NULL);
- X XtGetValues(yes, args, TWO);
- X
- X yeswidth = args[0].value;
- X btnborder = args[1].value;
- X
- X btnwidth = (labelwidth - btnsepr - (2 * btnborder)) / 2;
- X if (btnwidth < yeswidth) btnwidth = yeswidth;
- X
- X XtSetArg(args[0], XtNwidth, btnwidth);
- X XtSetValues(yes, args, ONE);
- X XtSetValues(no, args, ONE);
- X
- X XtRealizeWidget(shell);
- X
- X XtSetArg(args[0], XtNwidth, NULL);
- X XtSetArg(args[1], XtNheight, NULL);
- X XtGetValues(shell, args, TWO);
- X
- X root_x -= args[0].value / 2;
- X root_y -= args[1].value / 2;
- X/*
- X** Keep confirm popup within root window borders (don't place it off-screen)
- X*/
- X if (root_x + args[0].value > RootWidth)
- X root_x = RootWidth - args[0].value;
- X if (root_x < 0) root_x = 0;
- X
- X if (root_y + args[0].value > RootHeight)
- X root_y = RootHeight - args[0].value;
- X if (root_y < 0) root_y = 0;
- X
- X XtSetArg(args[0], XtNx, root_x);
- X XtSetArg(args[1], XtNy, root_y);
- X XtSetValues(shell, args, TWO);
- X
- X resultrec = MakeResult(shell, &popped_up, &result);
- X XtAddCallback(yes, XtNcallback, Yes, resultrec);
- X XtAddCallback(no, XtNcallback, No, resultrec);
- X
- X if (XMail.bellRing) /* ring bell if not silenced by user */
- X XBell (XtDisplay (toplevel), 33);
- X
- X XtPopup(shell, XtGrabExclusive);
- X
- X popped_up = TRUE;
- X
- X while (popped_up) ProcessOneEvent(XtDisplay(shell));
- X
- X return result;
- X} /* Confirm */
- END_OF_FILE
- if test 6406 -ne `wc -c <'confirm.c'`; then
- echo shar: \"'confirm.c'\" unpacked with wrong size!
- fi
- # end of 'confirm.c'
- fi
- echo shar: End of archive 1 \(of 10\).
- cp /dev/null ark1isdone
- MISSING=""
- for I in 1 2 3 4 5 6 7 8 9 10 ; do
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have unpacked all 10 archives.
- rm -f ark[1-9]isdone ark[1-9][0-9]isdone
- else
- echo You still must unpack the following archives:
- echo " " ${MISSING}
- fi
- exit 0
- exit 0 # Just in case...
- --
- // chris@IMD.Sterling.COM | Send comp.sources.x submissions to:
- \X/ Amiga - The only way to fly! |
- "It's intuitively obvious to the most | sources-x@imd.sterling.com
- casual observer..." |
-