v13i044: xmail, Part02/11
Michael Wagnitz
stratus!voder!nsc!berlioz.nsc.com!michael at uunet.UU.NET
Sun Jun 16 05:44:18 AEST 1991
Submitted-by: stratus!voder!nsc!berlioz.nsc.com!michael at uunet.UU.NET (Michael Wagnitz)
Posting-number: Volume 13, Issue 44
Archive-name: xmail/part02
#! /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 11)."
# Contents: XMail.ad callMail.c global.h regex.h
# Wrapped by michael at harley on Fri May 3 13:35:49 1991
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'XMail.ad' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'XMail.ad'\"
else
echo shar: Extracting \"'XMail.ad'\" \(8115 characters\)
sed "s/^X//" >'XMail.ad' <<'END_OF_FILE'
X! XMail resource default definitions
X!
X! Do not use full wildcard (*) on the geometry specification, or it will
X! force all popups to initially anchor with those same coordinates.
X!
X! The colors utilized in this application defaults file are:
X!
X! ff0000 - red ffff00 - yellow 0000ff - blue
X! 00ff00 - green 00ffff - cyan ff00ff - magenta
X! ffffff - white 000000 - black 00cd00 - green3
X! 2e8b57 - seagreen a52a2a - brown afeeee - paleturquoise
X! d2b48c - tan daa520 - goldenrod eedd82 - lightgoldenrod
X! f0e68c - khaki ffe4e1 - misty rose ffd700 - gold
X!
X! *expert: True
X! .geometry: +65+3
X! *iconGeometry: +835+0
X!
X*Abort.background: #ffffff
X*Abort.foreground: #ff0000
X*Autograph.background: #00ffff
X*autograph.background: #afeeee
X*aliasList*Background: #ffff00
X*alwaysignore*foreground: #2e8b57
X*noalwaysignore*foreground: #ff0000
X*autoprint*foreground: #2e8b57
X*noautoprint*foreground: #ff0000
X*background: #ffff00
X*borderColor: #a52a2a
X*buttonFont: *-courier-bold-r-normal--14-*
X*Bcc.background: #00ffff
X*Bcc*AsciiSink*Background: #00ffff
X*Bcc*scrollHorizontal: whenNeeded
X*Bcc*Thickness: 5
X*Bcc*MinimumThumb: 3
X*Cancel.background: #ffe4e1
X*Cancel.foreground: #000000
X*Cc.background: #00ffff
X*Cc*AsciiSink*Background: #00ffff
X*Cc*scrollHorizontal: whenNeeded
X*Cc*Thickness: 5
X*Cc*MinimumThumb: 3
X*Copy.foreground: #0000ff
X*commandPanel.background: #daa520
X*copy.background: #00ffff
X*Deliver.background: #00ff00
X*Deliver.foreground: #a52a2a
X*Deliver.borderColor: #a52a2a
X*delete.foreground: #ff0000
X*delete.background: #ffffff
X*Drop.foreground: #ff0000
X*editorCommand: xterm -name XMail -title "Message Edit" -display %s -e vi %s
X*exit.foreground: #0000ff
X*expert*foreground: #2e8b57
X*noexpert*foreground: #ff0000
X*Font: *-courier-bold-r-normal--14-*
X*Folder.background: #00ffff
X*fileWindow*background: #78fe78
X*fileWindow*scrollHorizontal: whenNeeded
X*fileWindow*Thickness: 5
X*fileWindow*MinimumThumb: 3
X*foreground: #a52a2a
X*forward.foreground: #00cd00
X*full.foreground: #ff0000
X*helpFont: *-courier-bold-r-normal--14-*
X*hold*foreground: #2e8b57
X*nohold*foreground: #ff0000
X*icon*background: #ffd700
X*icon*foreground: #a52a2a
X*inc.background: #00ffff
X*indexWindow*background: #ffffb2
X*indexWindow*Wrap: word
X*list.background: #d2b48c
X*menu.background: #d2b48c
X*Newmail.foreground: #0000ff
X*next.foreground: #00cd00
X*previous.foreground: #0000ff
X*quit.foreground: #ff0000
X*quit.background: #ffffff
X*ReEdit.background: #f0e68c
X*ReEdit.foreground: #a52a2a
X*replyall.background: #00ff00
X*save.background: #00ffff
X*Save.foreground: #0000ff
X*set_menu*background: #ffffb2
X*statusWindow.background: #a52a2a
X*statusWindow.foreground: #ffff00
X*Subject.background: #00ffff
X*Subject*AsciiSink*Background: #00ffff
X*Subject*scrollHorizontal: whenNeeded
X*Subject*Thickness: 5
X*Subject*MinimumThumb: 3
X*textWindow*background: #ffffb2
X*textWindow.text*Wrap: word
X*textWindow.face.background: #ffffff
X*titleBar*Background: #a52a2a
X*titleBar*Foreground: #ffff00
X*titleBar.logo.background: #ffffff
X*titleBar.logo.foreground: #0000ff
X*To.Background: #00ffff
X*To*AsciiSink*Background: #00ffff
X*To*scrollHorizontal: whenNeeded
X*To*Thickness: 5
X*To*MinimumThumb: 3
X*undelete.foreground: #00cd00
X*write.foreground: #00cd00
X*Write.foreground: #ff0000
X!
X*Bcc.translations: #override \n\
X <Key>Delete: delete-previous-character() \n\
X <Key>BackSpace: delete-previous-character() \n\
X Ctrl <Key>H: delete-previous-character() \n\
X Ctrl <Key>U: beginning-of-line() kill-to-end-of-line() \n\
X Ctrl <Key>W: delete-previous-word() \n\
X <Btn3Down>: SetAliases() MenuPopup(aliasList) \n\
X <Key>Return: NextField()
X!
X*Cc.translations: #override \n\
X <Key>Delete: delete-previous-character() \n\
X <Key>BackSpace: delete-previous-character() \n\
X Ctrl <Key>H: delete-previous-character() \n\
X Ctrl <Key>U: beginning-of-line() kill-to-end-of-line() \n\
X Ctrl <Key>W: delete-previous-word() \n\
X <Btn3Down>: SetAliases() MenuPopup(aliasList) \n\
X <Key>Return: NextField()
X!
X*indexWindow.translations: \
X Ctrl <Key>L: redraw-display() \n\
X Ctrl <Key>V: next-page() \n\
X Ctrl <Key>Z: scroll-one-line-up() \n\
X Meta <Key>Q: DoNothing() \n\
X Meta <Key>V: previous-page() \n\
X Meta <Key>Z: scroll-one-line-down() \n\
X Meta <Key><: beginning-of-file() \n\
X Meta <Key>>: end-of-file() \n\
X None <Key>Return: scroll-one-line-up() \n\
X None <Key>space: next-page() \n\
X None <Key>G: end-of-file() \n\
X None <Key>a: DoReply(a) \n\
X None <Key>b: previous-page() \n\
X None <Key>c: DoSave(c) \n\
X None <Key>d: DoSelected(d) \n\
X None <Key>f: DoSelected(P) \n\
X None <Key>i: DoCmd(inc) \n\
X None <Key>j: scroll-one-line-up() \n\
X None <Key>k: scroll-one-line-down() \n\
X None <Key>m: DoReply(s) \n\
X None <Key>n: DoSelected(n) \n\
X None <Key>p: DoSelected(-) \n\
X None <Key>q: Quit(q) \n\
X None <Key>r: DoSelected(p) \n\
X None <Key>s: DoSave(s) \n\
X None <Key>u: DoSelected(u) \n\
X None <Key>w: DoSave(w) \n\
X None <Key>x: Quit(x) \n\
X None <Key>-: scroll-one-line-down() \n\
X None <Key>\': beginning-of-file() \n\
X <Btn1Down>: select-start() SetSelect() \n\
X <Btn1Motion>: extend-adjust() \n\
X <Btn1Up>: extend-end(PRIMARY, CUT_BUFFER0) \n\
X <Btn3Down>: select-start() SetSelect() \n\
X <Btn3Up>: DoSelected(p)
X!
X*Subject.translations: #override \n\
X <Key>Delete: delete-previous-character() \n\
X <Key>BackSpace: delete-previous-character() \n\
X Ctrl <Key>H: delete-previous-character() \n\
X Ctrl <Key>U: beginning-of-line() kill-to-end-of-line() \n\
X Ctrl <Key>W: delete-previous-word() \n\
X <Btn3Motion>: DoNothing() \n\
X <Btn3Up>: DoNothing() \n\
X <Key>Return: NextField()
X!
X*textWindow.text.translations: #override \
X Ctrl <Key>L: redraw-display() \n\
X Ctrl <Key>V: next-page() \n\
X Ctrl <Key>Z: scroll-one-line-up() \n\
X Meta <Key>Q: DoNothing() \n\
X Meta <Key>V: previous-page() \n\
X Meta <Key>Z: scroll-one-line-down() \n\
X Meta <Key><: beginning-of-file() \n\
X Meta <Key>>: end-of-file() \n\
X Shift <Key>A: DoReply(A) \n\
X Shift <Key>C: DoSave(C) \n\
X Shift <Key>F: DoReply(S) \n\
X Shift <Key>G: end-of-file() \n\
X Shift <Key>M: DoReply(r) \n\
X Shift <Key>N: DoCmd(file %) \n\
X Shift <Key>P: PrintMsg() \n\
X Shift <Key>R: DoReply(R) \n\
X Shift <Key>S: DoSave(S) \n\
X None <Key>Linefeed: MenuPopdown(help) \n\
X None <Key>Return: scroll-one-line-up() \n\
X None <Key>-: scroll-one-line-down() \n\
X None <Key>\': beginning-of-file() \n\
X None <Key>space: next-page() \n\
X None <Key>a: DoReply(a) \n\
X None <Key>b: previous-page() \n\
X None <Key>c: DoSave(c) \n\
X None <Key>d: DoSelected(d) \n\
X None <Key>f: DoSelected(P) \n\
X None <Key>i: DoCmd(inc) \n\
X None <Key>j: scroll-one-line-up() \n\
X None <Key>k: scroll-one-line-down() \n\
X None <Key>m: DoReply(s) \n\
X None <Key>n: DoSelected(n) \n\
X None <Key>p: DoSelected(-) \n\
X None <Key>q: Quit(q) \n\
X None <Key>r: DoSelected(p) \n\
X None <Key>s: DoSave(s) \n\
X None <Key>u: DoSelected(u) \n\
X None <Key>w: DoSave(w) \n\
X None <Key>x: Quit(x) \n\
X <Key>?: ShowHelp(text2) \n\
X <Btn1Down>: select-start() \n\
X <Btn1Motion>: extend-adjust() \n\
X <Btn1Up>: extend-end(PRIMARY, CUT_BUFFER0) \n\
X <Btn2Down>: insert-selection(PRIMARY, CUT_BUFFER0) \n\
X <Btn3Down>: extend-start() \n\
X <Btn3Motion>: extend-adjust() \n\
X <Btn3Up>: extend-end(PRIMARY, CUT_BUFFER0) \n\
X Ctrl <Key>R: search(backward) \n\
X Ctrl <Key>S: search(forward)
X!
X*To.translations: #override \n\
X <Key>Delete: delete-previous-character() \n\
X <Key>BackSpace: delete-previous-character() \n\
X Ctrl <Key>H: delete-previous-character() \n\
X Ctrl <Key>U: beginning-of-line() kill-to-end-of-line() \n\
X Ctrl <Key>W: delete-previous-word() \n\
X <Btn3Down>: SetAliases() MenuPopup(aliasList) \n\
X <Key>Return: NextField()
X!
END_OF_FILE
if test 8115 -ne `wc -c <'XMail.ad'`; then
echo shar: \"'XMail.ad'\" unpacked with wrong size!
fi
# end of 'XMail.ad'
fi
if test -f 'callMail.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'callMail.c'\"
else
echo shar: Extracting \"'callMail.c'\" \(9220 characters\)
sed "s/^X//" >'callMail.c' <<'END_OF_FILE'
X/*
X * xmail - X window system interface to the mail program
X *
X * Copyright 1989 The University of Texas at Austin
X *
X * Author: Po Cheung
X * Date: March 10, 1989
X *
X * Permission to use, copy, modify, and distribute this software and
X * its documentation for any purpose and without fee is hereby granted,
X * provided that the above copyright notice appear in all copies and that
X * both that copyright notice and this permission notice appear in
X * supporting documentation. The University of Texas at Austin makes no
X * representations about the suitability of this software for any purpose.
X * It is provided "as is" without express or implied warranty.
X *
X * Copyright 1990 by National Semiconductor Corporation
X *
X * Permission to use, copy, modify, and distribute this software and its
X * documentation for any purpose is hereby granted without fee, provided that
X * the above copyright notice appear in all copies and that both that
X * copyright notice and this permission notice appear in supporting
X * documentation, and that the name of National Semiconductor Corporation not
X * be used in advertising or publicity pertaining to distribution of the
X * software without specific, written prior permission.
X *
X * NATIONAL SEMICONDUCTOR CORPORATION MAKES NO REPRESENTATIONS ABOUT THE
X * SUITABILITY OF THIS SOFTWARE FOR ANY PURPOSE. IT IS PROVIDED "AS IS"
X * WITHOUT EXPRESS OR IMPLIED WARRANTY. NATIONAL SEMICONDUCTOR CORPORATION
X * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED
X * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO
X * EVENT SHALL NATIONAL SEMICONDUCTOR CORPORATION BE LIABLE FOR ANY SPECIAL,
X * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
X * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
X * OR OTHER TORTUOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
X * PERFORMANCE OF THIS SOFTWARE.
X *
X * Author: Michael C. Wagnitz - National Semiconductor Corporation
X *
X** Xmail talks to mail through a pseudo terminal which is a pair of master
X** and slave devices: /dev/pty?? and /dev/tty??, where ?? goes from p0 to
X** zf (system dependent). The terminal is opened for both read and write.
X**
X*/
X
X#include "global.h"
X#include <sgtty.h>
X#include <sys/stat.h>
X
X#ifdef SYSV
X#include <sys/termio.h>
X#ifdef att
X#include <fcntl.h>
X#include <sys/stropts.h>
X#endif
X#else /* if not SYSV */
X#include <sgtty.h>
X#endif
X
X#ifndef TTYDEV
X#ifdef hpux
X#define TTYDEV "/dev/pty/ptyxx"
X#else /* !hpux */
X#define TTYDEV "/dev/ptyxx"
X#endif /* !hpux */
X#endif /* !TTYDEV */
X
X#ifndef PTYCHAR1
X#ifdef hpux
X#define PTYCHAR1 "zyxwvutsrqp"
X#else /* !hpux */
X#define PTYCHAR1 "pqrstuvwxyz"
X#endif /* !hpux */
X#endif /* !PTYCHAR1 */
X
X#ifndef PTYCHAR2
X#ifdef hpux
X#define PTYCHAR2 "fedcba9876543210"
X#else /* !hpux */
X#define PTYCHAR2 "0123456789abcdef"
X#endif /* !hpux */
X#endif /* !PTYCHAR2 */
X
Xint mail_fd; /* mail process master tty id */
Xint mailpid; /* mail process id */
Xint mailInputId; /* mail input id */
Xchar pseudo_tty[20];
X
X
X/*
X** @(#) openMaster - searches for and opens a pty master. If it finds one,
X** it returns the value of the file descriptor. If not,
X** it reports an error and terminates. Portions of this
X** routine were stolen from X11R4 xterm get_pty() sources.
X*/
Xint
XopenMaster()
X{
X static int devindex = 0;
X static int letter = 0;
X struct stat st_buf;
X int master;
X
X
X#ifdef att
X strcpy(pseudo_tty, "/dev/ptmx");
X if ((master = open(pseudo_tty, O_RDWR)) >= 0)
X return(master);
X#else /* !att, need lots of code */
X#if defined(umips) && defined (SYSV)
X strcpy(pseudo_tty, "/dev/ptc");
X master = open(pseudo_tty, O_RDWR);
X if (master >= 0 && (fstat(master, &st_buf)) == 0) {
X (void) sprintf(pseudo_tty, "/dev/ttyq%d", minor(st_buf.st_rdev));
X if ((c = open(pseudo_tty, O_RDWR)) < 0) {
X close (master);
X } else { /* got one! */
X close (c);
X return(master);
X }
X }
X#else /* not (umips && SYSV) */
X strcpy(pseudo_tty, TTYDEV);
X while (PTYCHAR1[letter]) {
X pseudo_tty[strlen(pseudo_tty) - 2] = PTYCHAR1[letter];
X pseudo_tty[strlen(pseudo_tty) - 1] = PTYCHAR2[0];
X
X if (stat(pseudo_tty, &st_buf) == 0)
X while (PTYCHAR2[devindex]) {
X pseudo_tty[strlen(pseudo_tty) - 1] = PTYCHAR2[devindex];
X if ((master = open(pseudo_tty, O_RDWR)) >= 0)
X return(master);
X
X devindex++;
X }
X devindex = 0;
X (void) letter++;
X }
X#endif /* umips && SYSV */
X#endif /* att */
X/*
X** We were unable to allocate a pty master! Report the error and terminate.
X*/
X XtError("xmail cannot open master side of pty");
X} /* end - openMaster */
X
X
X/*
X** @(#)openSlave() - open slave side of pipe
X*/
Xint
XopenSlave(master)
Xint master;
X{
X int slave;
X
X
X#ifdef att
X char *slaveName;
X int grantpt(), unlockpt();
X char *ptsname();
X
X if (grantpt(master) >= 0 &&
X unlockpt(master) >= 0 &&
X (slavename = ptsname(master)) != NULL &&
X (slave = open(slavename, O_RDWR)) >= 0 &&
X ioctl(slave, I_PUSH, "ptem") >= 0 &&
X ioctl(slave, I_PUSH, "ldterm") >= 0)
X return(slave);
X#else /* !att */
X#if defined(umips) && defined (SYSV)
X fstat(master, &st_buf);
X (void) sprintf(pseudo_tty, "/dev/ttyq%d", minor(st_buf.st_rdev));
X if ((slave = open(pseudo_tty, O_RDWR)) >= 0)
X return(slave); /* got one! */
X#else /* not (umips && SYSV) */
X pseudo_tty[strlen(pseudo_tty) - 5] = 't';
X if ((slave = open(pseudo_tty, O_RDWR)) >= 0)
X return(slave);
X#endif
X#endif
X XtError("xmail cannot open slave side of pty");
X} /* openSlave */
X
X
X/*
X** @(#)callMail() - fork child to execute mail and attach to xmail input
X*/
X/* ARGSUSED */
Xvoid
XcallMail(argc, argv)
Xint argc;
Xchar *argv[];
X{
X#ifdef SYSV
X struct termio tio;
X#else /* if not SYSV */
X struct sgttyb Sgtty;
X#endif
X int slave; /* file descriptor to slave pty */
X char *Mailpgm; /* name of executable Mailpgm */
X
X
X if (! (Mailpgm = (char *)getenv("XMAILER"))) /* first looks up env var */
X Mailpgm = "/usr/ucb/Mail";
X
X mail_fd = openMaster();
X slave = openSlave(mail_fd);
X
X/*
X** Set minimal requirements for slave connection (no echo, no NL->CR, keep TABS)
X*/
X#ifdef SYSV
X if (ioctl (tty, TCGETA, &tio) == -1)
X XtError("xmail cannot obtain terminal settings");
X
X tio.c_oflag &= ~(OCRNL|ONLRET|TABDLY);
X
X if (ioctl (tty, TCSETA, &tio) == -1)
X XtError("xmail cannot establish terminal settings");
X#else /* if not SYSV */
X if (ioctl(slave, TIOCGETP, (char *)&Sgtty) == -1)
X XtError("xmail cannot obtain terminal settings");
X
X Sgtty.sg_flags &= ~(ECHO|CRMOD|XTABS);
X
X if (ioctl (slave, TIOCSETP, (char *)&Sgtty) == -1)
X XtError("xmail cannot establish terminal settings");
X#endif
X
X mailpid = fork();
X if (mailpid == -1) {
X XtError("callMail could not fork the child process");
X } else if (mailpid) {
X /*
X * Parent : close the slave side of pty
X * set the mail file descriptor to append mode
X * register mail input with X
X */
X close(slave);
X fcntl(mail_fd, F_SETFL, FAPPEND);
X mailInputId = XtAddInput(mail_fd, XtInputReadMask, readMail, NULL);
X } else {
X /*
X * Child : close X connection and mail_fd side of pty
X * redirect stdin, stdout, stderr of mail to pty
X * unbuffer output data from mail
X * exec mail with arguments
X *
X * Use a select() call to delay starting the mail process
X * until our parent can close its slave side of the pipe.
X * Eliminates the parent hanging (for approximately 15
X * seconds) on the close because the child terminated for
X * lack of mail before the parent could issue its close.
X */
X int readfds, width;
X struct timeval timeout;
X
X close(ConnectionNumber(XtDisplay(toplevel)));
X
X timeout.tv_sec = 0; timeout.tv_usec = 250000; /* 0.25 seconds */
X readfds = 1 << slave; width = slave + 1;
X
X select(width, &readfds, (int *) NULL, (int *) NULL, &timeout);
X
X close(mail_fd);
X dup2(slave, 0);
X dup2(slave, 1);
X dup2(slave, 2);
X if (slave > 2)
X close(slave);
X fcntl(1, F_SETFL, FAPPEND);
X setbuf(stdout, NULL);
X argv[0] = Mailpgm;
X execvp(Mailpgm, argv);
X /*
X * If we fail to make contact, we must re-establish access to
X * the terminal screen that started us for our error message,
X * because we don't want to send it up the xmail pipe.
X * Also terminate our parent.
X */
X if ((slave = open("/dev/tty", O_RDWR)) != -1) {
X dup2(slave, 1);
X dup2(slave, 2);
X perror(Mailpgm);
X }
X kill(getppid(), SIGKILL); /* kill our parent */
X exit(1);
X }
X} /* callMail */
END_OF_FILE
if test 9220 -ne `wc -c <'callMail.c'`; then
echo shar: \"'callMail.c'\" unpacked with wrong size!
fi
# end of 'callMail.c'
fi
if test -f 'global.h' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'global.h'\"
else
echo shar: Extracting \"'global.h'\" \(9985 characters\)
sed "s/^X//" >'global.h' <<'END_OF_FILE'
X/*
X * xmail - X window system interface to the mail program
X *
X * Copyright 1989 The University of Texas at Austin
X *
X * Author: Po Cheung
X * Date: March 10, 1989
X *
X * Permission to use, copy, modify, and distribute this software and
X * its documentation for any purpose and without fee is hereby granted,
X * provided that the above copyright notice appear in all copies and that
X * both that copyright notice and this permission notice appear in
X * supporting documentation. The University of Texas at Austin makes no
X * representations about the suitability of this software for any purpose.
X * It is provided "as is" without express or implied warranty.
X *
X * Copyright 1990 by National Semiconductor Corporation
X *
X * Permission to use, copy, modify, and distribute this software and its
X * documentation for any purpose is hereby granted without fee, provided that
X * the above copyright notice appear in all copies and that both that
X * copyright notice and this permission notice appear in supporting
X * documentation, and that the name of National Semiconductor Corporation not
X * be used in advertising or publicity pertaining to distribution of the
X * software without specific, written prior permission.
X *
X * NATIONAL SEMICONDUCTOR CORPORATION MAKES NO REPRESENTATIONS ABOUT THE
X * SUITABILITY OF THIS SOFTWARE FOR ANY PURPOSE. IT IS PROVIDED "AS IS"
X * WITHOUT EXPRESS OR IMPLIED WARRANTY. NATIONAL SEMICONDUCTOR CORPORATION
X * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED
X * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO
X * EVENT SHALL NATIONAL SEMICONDUCTOR CORPORATION BE LIABLE FOR ANY SPECIAL,
X * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
X * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
X * OR OTHER TORTUOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
X * PERFORMANCE OF THIS SOFTWARE.
X *
X * Author: Michael C. Wagnitz - National Semiconductor Corporation
X *
X */
X
X
X#include "defs.h"
X
X/* HelpText.c */
X
Xextern String Autograph_Info[];
Xextern String Copy_Info[];
Xextern String Default_Status_Info;
Xextern String Delete_Info[];
Xextern String Deliver_Info[];
Xextern String Folder_Info[];
Xextern String Hold_Info[];
Xextern String NewMail_Info[];
Xextern String Print_Info[];
Xextern String Quit_Info[];
Xextern String Read_Info[];
Xextern String Reply_Info[];
Xextern String Save_Info[];
Xextern String Send_Info[];
Xextern String SendMail_Info[];
X
Xextern String Abort_Help;
Xextern String Bcc_Help;
Xextern String Cancel_Help;
Xextern String Cc_Help;
Xextern String Copy_Help;
Xextern String Delete_Help;
Xextern String Deliver_Help;
Xextern String File_Help;
Xextern String Folder_Help;
Xextern String Hold_Help;
Xextern String Index_Help;
Xextern String NewMail_Help;
Xextern String Print_Help;
Xextern String Quit_Help;
Xextern String Read_Help;
Xextern String ReEdit_Help;
Xextern String Reply_Help;
Xextern String Save_Help;
Xextern String Send_Help;
Xextern String Sign_Help;
Xextern String sign_Help;
Xextern String Status_Help;
Xextern String Subject_Help;
Xextern String Text_Help;
Xextern String Text2_Help;
Xextern String Title_Help;
Xextern String To_Help;
X
X/* actions.c */
X
Xextern XtActionProc CheckInsert(); /* for the file window */
Xextern XtActionProc DeleteChar(); /* for deletes (file window) */
Xextern XtActionProc DeleteLine(); /* in the file window */
Xextern XtActionProc DeleteWord(); /* also in the file window */
Xextern XtActionProc DoCmd(); /* effect specified command */
Xextern XtActionProc DoNothing(); /* dummy action routine */
Xextern XtActionProc DoReply(); /* invoke reply callback */
Xextern XtActionProc DoSave(); /* invoke the save callback */
Xextern XtActionProc DoSelected(); /* DoCmd w/ selected message */
Xextern XtActionProc Folder(); /* execute folder command */
Xextern XtActionProc Iconify(); /* iconification request */
Xextern XtActionProc MyNotify(); /* invokes callbacks w/ param */
Xextern XtActionProc NextField(); /* warps pointer to data fld */
Xextern XtActionProc PrintMsg(); /* send mail to the printer */
Xextern XtActionProc Quit(); /* termination procedure */
Xextern XtActionProc SetAliases(); /* menu list of alias names */
Xextern XtActionProc SetDirectory(); /* create folder files list */
Xextern XtActionProc SetFolders(); /* create a list of folders */
Xextern XtActionProc SetMenu(); /* Position set_menu popup */
Xextern XtActionProc SetPopup(); /* Position relative to owner */
Xextern XtActionProc SetSelect(); /* reposition select mark */
Xextern XtActionProc ShowHelp(); /* Position help & popup text */
X
X/* callbacks.c */
X
Xextern XtCallbackProc Autograph(); /* adds Signature to message */
Xextern XtCallbackProc Done(); /* completes mail delivery */
Xextern XtCallbackProc DoIt(); /* callback do specified cmd */
Xextern XtCallbackProc DoPrint(); /* callback printer execution */
Xextern XtCallbackProc DoQuit(); /* callback termination func */
Xextern XtCallbackProc DoSet(); /* callback to toggle options */
Xextern XtCallbackProc DoWith(); /* do cmd with arguments */
Xextern XtCallbackProc DropIt(); /* destroy Folder popup list */
Xextern XtCallbackProc GetAliasName(); /* retrieve alias name */
Xextern XtCallbackProc GetFolderName(); /* retrieve folder name */
Xextern XtCallbackProc ReEdit(); /* re-edit the mail message */
Xextern XtCallbackProc Reply(); /* use msg author and subject */
Xextern XtCallbackProc Save(); /* callback save routine */
Xextern XtCallbackProc SetNewmail(); /* highlight when new mail */
Xextern XtCallbackProc UnsetNewmail(); /* remove newmail highlight */
X
X/* callMail.c */
X
Xextern void callMail(); /* fork child, exec mail */
X
X/* confirm.c */
X
Xextern Bool Confirm(); /* Confirm destructive acts */
X
X/* environs.c */
X
Xextern char *GetMailEnv(); /* get value from mail env */
Xextern char *GetMailrc(); /* get mailrc item value */
Xextern char *alias(); /* get mailrc alias value */
X
X/* handler.c */
X
Xextern int In_System_Folder(); /* boolean test of folder */
Xextern XtEventHandler icon_handler(); /* handle iconify changes */
Xextern int index_handler(); /* highlight the msg number */
Xextern void info_handler(); /* change content of status */
Xextern int file_handler(); /* handle change of folder */
X
X/* mail.c */
X
Xextern void editMail(); /* create/compose a message */
Xextern XtInputCallbackProc readMail(); /* get data from mail */
Xextern void sendMail(); /* used by Send/Reply cmds */
Xextern void writeMail(); /* send data to mail */
X
X/* parser.c */
X
Xextern void parser_init(); /* compile patterns */
Xextern int match(); /* eval command or output */
Xextern void parse(); /* parse mail output */
Xextern char *QueryMail(); /* ask mail for info */
X
X/* utils.c */
X
Xextern void Bell(); /* disp. error and sound bell */
Xextern int figureWidth(); /* get figure width for font */
Xextern void markIndex(); /* add/replace index marker */
Xextern int SelectionNumber(); /* get number of selected msg */
Xextern void SetCursor(); /* change between wait & norm */
Xextern void SetXY(); /* set widget x/y coordinates */
Xextern XawTextPosition TextGetLastPos(); /* get last pos of text */
Xextern void UpdateTitleBar(); /* file name and msg count */
Xextern void writeText(); /* write text to buffer */
Xextern void writeTo(); /* send text data to window */
X
X/* windows.c */
X
Xextern void AddHelpText(); /* Add help popup to window */
Xextern void AddMenuWindow(); /* Add menu popup to window */
Xextern void AddButton(); /* Add command to window */
Xextern void CreateButtons(); /* make the command buttons */
Xextern void CreateCommandPanel(); /* form for command buttons */
Xextern void CreateFileWindow(); /* a text input window */
Xextern void CreateFolderButton(); /* a special command button */
Xextern void CreateHelpWindow(); /* the help window base */
Xextern void CreateIndexWindow(); /* a text input window */
Xextern void CreateStatusWindow(); /* a text output window */
Xextern void CreateSubWindows(); /* all subwindows of xmail */
Xextern void CreateTextWindow(); /* another text window */
Xextern void CreateTitleBar(); /* a text output window */
Xextern Widget CreateInputWindow(); /* To, Subject, Cc, and Bcc */
Xextern void ParseIconGeometry(); /* Parse icon geometry */
X
X/* xmail.c */
X
Xextern void initialize(); /* main initialization code */
Xextern char **mailoptions(); /* sets up call to mail pgm */
X
X/* extern functions */
X
Xextern char *strchr(), *strrchr();
X
X/* extern variables */
X
Xextern char Command[BUFSIZ]; /* xmail command string */
Xextern char Recipient[BUFSIZ]; /* message addressee */
Xextern char FileBuf[BUFSIZ]; /* buffer for file widget */
Xextern char SubjBuf[BUFSIZ]; /* message subject */
Xextern char InReply[BUFSIZ]; /* reply reference string */
Xextern char CcBuf[BUFSIZ]; /* message Cc list */
Xextern char BccBuf[BUFSIZ]; /* message Bcc list */
Xextern char tmpName[BUFSIZ]; /* message temporary filename */
Xextern char *MailPrompt; /* mail program prompt string */
Xextern char **mailargv; /* array passed to mail child */
X
Xextern Cursor waitC; /* watch cursor, used when waiting */
Xextern Cursor xtermC; /* xterm cursor, when not waiting */
Xextern Pixmap hatch; /* cross_weave, used for Newmail */
Xextern Boolean In_Bogus_Mail_File; /* in bogus folder when we're iconic */
Xextern Widget toplevel; /* top level shell widget */
Xextern Atom wmDeleteWindow; /* for WM_DELETE_WINDOW property */
X
Xextern AliasRecPtr *aliases; /* array of mail alias strings */
Xextern helpList HelpList;
Xextern XmailResources XMail; /* XMail application resources */
X
Xextern int mail_fd; /* descriptor to mail process i/o */
X
Xextern int mailargc; /* counter passed to mail child */
Xextern int RootWidth, RootHeight;
Xextern int mailpid; /* mail process id */
Xextern int Highlighted; /* state of 'Newmail' highlighting */
Xextern int mailInputId; /* Identity of the XtAddInput call */
X
X/* global.h */
END_OF_FILE
if test 9985 -ne `wc -c <'global.h'`; then
echo shar: \"'global.h'\" unpacked with wrong size!
fi
# end of 'global.h'
fi
if test -f 'regex.h' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'regex.h'\"
else
echo shar: Extracting \"'regex.h'\" \(10832 characters\)
sed "s/^X//" >'regex.h' <<'END_OF_FILE'
X/* Definitions for data structures callers pass the regex library.
X Copyright (C) 1985 Free Software Foundation, Inc.
X
X NO WARRANTY
X
X BECAUSE THIS PROGRAM IS LICENSED FREE OF CHARGE, WE PROVIDE ABSOLUTELY
XNO WARRANTY, TO THE EXTENT PERMITTED BY APPLICABLE STATE LAW. EXCEPT
XWHEN OTHERWISE STATED IN WRITING, FREE SOFTWARE FOUNDATION, INC,
XRICHARD M. STALLMAN AND/OR OTHER PARTIES PROVIDE THIS PROGRAM "AS IS"
XWITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
XBUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
XFITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY
XAND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE
XDEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR
XCORRECTION.
X
X IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL RICHARD M.
XSTALLMAN, THE FREE SOFTWARE FOUNDATION, INC., AND/OR ANY OTHER PARTY
XWHO MAY MODIFY AND REDISTRIBUTE THIS PROGRAM AS PERMITTED BELOW, BE
XLIABLE TO YOU FOR DAMAGES, INCLUDING ANY LOST PROFITS, LOST MONIES, OR
XOTHER SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
XUSE OR INABILITY TO USE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR
XDATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY THIRD PARTIES OR
XA FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS) THIS
XPROGRAM, EVEN IF YOU HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
XDAMAGES, OR FOR ANY CLAIM BY ANY OTHER PARTY.
X
X GENERAL PUBLIC LICENSE TO COPY
X
X 1. You may copy and distribute verbatim copies of this source file
Xas you receive it, in any medium, provided that you conspicuously and
Xappropriately publish on each copy a valid copyright notice "Copyright
X(C) 1985 Free Software Foundation, Inc."; and include following the
Xcopyright notice a verbatim copy of the above disclaimer of warranty
Xand of this License. You may charge a distribution fee for the
Xphysical act of transferring a copy.
X
X 2. You may modify your copy or copies of this source file or
Xany portion of it, and copy and distribute such modifications under
Xthe terms of Paragraph 1 above, provided that you also do the following:
X
X a) cause the modified files to carry prominent notices stating
X that you changed the files and the date of any change; and
X
X b) cause the whole of any work that you distribute or publish,
X that in whole or in part contains or is a derivative of this
X program or any part thereof, to be licensed at no charge to all
X third parties on terms identical to those contained in this
X License Agreement (except that you may choose to grant more extensive
X warranty protection to some or all third parties, at your option).
X
X c) You may charge a distribution fee for the physical act of
X transferring a copy, and you may at your option offer warranty
X protection in exchange for a fee.
X
XMere aggregation of another unrelated program with this program (or its
Xderivative) on a volume of a storage or distribution medium does not bring
Xthe other program under the scope of these terms.
X
X 3. You may copy and distribute this program (or a portion or derivative
Xof it, under Paragraph 2) in object code or executable form under the terms
Xof Paragraphs 1 and 2 above provided that you also do one of the following:
X
X a) accompany it with the complete corresponding machine-readable
X source code, which must be distributed under the terms of
X Paragraphs 1 and 2 above; or,
X
X b) accompany it with a written offer, valid for at least three
X years, to give any third party free (except for a nominal
X shipping charge) a complete machine-readable copy of the
X corresponding source code, to be distributed under the terms of
X Paragraphs 1 and 2 above; or,
X
X c) accompany it with the information you received as to where the
X corresponding source code may be obtained. (This alternative is
X allowed only for noncommercial distribution and only if you
X received the program in object code or executable form alone.)
X
XFor an executable file, complete source code means all the source code for
Xall modules it contains; but, as a special exception, it need not include
Xsource code for modules which are standard libraries that accompany the
Xoperating system on which the executable file runs.
X
X 4. You may not copy, sublicense, distribute or transfer this program
Xexcept as expressly provided under this License Agreement. Any attempt
Xotherwise to copy, sublicense, distribute or transfer this program is void and
Xyour rights to use the program under this License agreement shall be
Xautomatically terminated. However, parties who have received computer
Xsoftware programs from you with this License Agreement will not have
Xtheir licenses terminated so long as such parties remain in full compliance.
X
X 5. If you wish to incorporate parts of this program into other free
Xprograms whose distribution conditions are different, write to the Free
XSoftware Foundation at 675 Mass Ave, Cambridge, MA 02139. We have not yet
Xworked out a simple rule that can be stated here, but we will often permit
Xthis. We will be guided by the two goals of preserving the free status of
Xall derivatives of our free software and of promoting the sharing and reuse of
Xsoftware.
X
X
XIn other words, you are welcome to use, share and improve this program.
XYou are forbidden to forbid anyone else to use, share and improve
Xwhat you give them. Help stamp out software-hoarding! */
X
X
X#ifndef RE_NREGS
X#define RE_NREGS 10
X#endif
X
X/* This data structure is used to represent a compiled pattern. */
X
Xstruct re_pattern_buffer
X {
X char *buffer; /* Space holding the compiled pattern commands. */
X int allocated; /* Size of space that buffer points to */
X int used; /* Length of portion of buffer actually occupied */
X char *fastmap; /* Pointer to fastmap, if any, or zero if none. */
X /* re_search uses the fastmap, if there is one,
X to skip quickly over totally implausible characters */
X char *translate; /* Translate table to apply to all characters
X before comparing.
X Or zero for no translation.
X The translation is applied to a pattern when it is compiled
X and to data when it is matched. */
X char fastmap_accurate;
X /* Set to zero when a new pattern is stored,
X set to one when the fastmap is updated from it. */
X char can_be_null; /* Set to one by compiling fastmap
X if this pattern might match the null string.
X It does not necessarily match the null string
X in that case, but if this is zero, it cannot.
X 2 as value means can match null string
X but at end of range or before a character
X listed in the fastmap. */
X };
X
X/* Structure to store "register" contents data in.
X
X Pass the address of such a structure as an argument to re_match, etc.,
X if you want this information back.
X
X start[i] and end[i] record the string matched by \( ... \) grouping i,
X for i from 1 to RE_NREGS - 1.
X start[0] and end[0] record the entire string matched. */
X
Xstruct re_registers
X {
X int start[RE_NREGS];
X int end[RE_NREGS];
X };
X
X/* These are the command codes that appear in compiled regular expressions,
X one per byte.
X Some command codes are followed by argument bytes.
X A command code can specify any interpretation whatever for its arguments.
X Zero-bytes may appear in the compiled regular expression. */
X
Xenum regexpcode
X {
X unused,
X exactn, /* followed by one byte giving n, and then by n literal bytes */
X begline, /* fails unless at beginning of line */
X endline, /* fails unless at end of line */
X jump, /* followed by two bytes giving relative address to jump to */
X on_failure_jump, /* followed by two bytes giving relative address of place
X to resume at in case of failure. */
X finalize_jump, /* Throw away latest failure point and then
X jump to address. */
X maybe_finalize_jump, /* Like jump but finalize if safe to do so.
X This is used to jump back to the beginning
X of a repeat. If the command that follows
X this jump is clearly incompatible with the
X one at the beginning of the repeat, such that
X we can be sure that there is no use backtracking
X out of repetitions already completed,
X then we finalize. */
X dummy_failure_jump, /* jump, and push a dummy failure point.
X This failure point will be thrown away
X if an attempt is made to use it for a failure.
X A + construct makes this before the first repeat. */
X anychar, /* matches any one character */
X charset, /* matches any one char belonging to specified set.
X First following byte is # bitmap bytes.
X Then come bytes for a bit-map saying which chars are in.
X Bits in each byte are ordered low-bit-first.
X A character is in the set if its bit is 1.
X A character too large to have a bit in the map
X is automatically not in the set */
X charset_not, /* similar but match any character that is NOT one
X of those specified */
X start_memory, /* starts remembering the text that is matched
X and stores it in a memory register.
X followed by one byte containing the register number.
X Register numbers must be in the range 0 through NREGS. */
X stop_memory, /* stops remembering the text that is matched
X and stores it in a memory register.
X followed by one byte containing the register number.
X Register numbers must be in the range 0 through NREGS. */
X duplicate, /* match a duplicate of something remembered.
X Followed by one byte containing the index of the memory register. */
X before_dot, /* Succeeds if before dot */
X at_dot, /* Succeeds if at dot */
X after_dot, /* Succeeds if after dot */
X begbuf, /* Succeeds if at beginning of buffer */
X endbuf, /* Succeeds if at end of buffer */
X wordchar, /* Matches any word-constituent character */
X notwordchar, /* Matches any char that is not a word-constituent */
X wordbeg, /* Succeeds if at word beginning */
X wordend, /* Succeeds if at word end */
X wordbound, /* Succeeds if at a word boundary */
X notwordbound, /* Succeeds if not at a word boundary */
X syntaxspec, /* Matches any character whose syntax is specified.
X followed by a byte which contains a syntax code, Sword
X or such like */
X notsyntaxspec /* Matches any character whose syntax differs from
X the specified. */
X };
X
Xextern char *re_compile_pattern ();
X/* Is this really advertised? */
Xextern void re_compile_fastmap ();
Xextern int re_search (), re_search_2 ();
Xextern int re_match (), re_match_2 ();
X
X/* 4.2 bsd compatibility (yuck) */
Xextern char *re_comp ();
Xextern int re_exec ();
X
X#ifdef SYNTAX_TABLE
Xextern char *re_syntax_table;
X#endif
END_OF_FILE
if test 10832 -ne `wc -c <'regex.h'`; then
echo shar: \"'regex.h'\" unpacked with wrong size!
fi
# end of 'regex.h'
fi
echo shar: End of archive 2 \(of 11\).
cp /dev/null ark2isdone
MISSING=""
for I in 1 2 3 4 5 6 7 8 9 10 11 ; do
if test ! -f ark${I}isdone ; then
MISSING="${MISSING} ${I}"
fi
done
if test "${MISSING}" = "" ; then
echo You have unpacked all 11 archives.
rm -f ark[1-9]isdone ark[1-9][0-9]isdone
else
echo You still need to unpack the following archives:
echo " " ${MISSING}
fi
## End of shell archive.
exit 0
--
Dan Heller
O'Reilly && Associates Z-Code Software Comp-sources-x:
Senior Writer President comp-sources-x at uunet.uu.net
argv at ora.com argv at zipcode.com
More information about the Comp.sources.x
mailing list