michael@parns.nsc.com (Michael C. Wagnitz) (03/22/90)
Submitted-by: michael@parns.nsc.com (Michael C. Wagnitz) Posting-number: Volume 6, Issue 43 Archive-name: xmail/part03 #! /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 3 (of 6)." # Contents: defs.h directory.c environs.c global.h handler.c # icon.nomail mail.c national.bm xmailregex.h # Wrapped by michael@harley on Tue Mar 20 15:28:06 1990 PATH=/bin:/usr/bin:/usr/ucb ; export PATH if test -f 'defs.h' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'defs.h'\" else echo shar: Extracting \"'defs.h'\" \(5263 characters\) sed "s/^X//" >'defs.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 TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR X * PERFORMANCE OF THIS SOFTWARE. X * X * Author: Michael C. Wagnitz - National Semiconductor Corporation X * X */ X X X#include <stdio.h> X#include <sys/param.h> X#include <X11/Xos.h> X#include <X11/Intrinsic.h> X#include <X11/IntrinsicP.h> X#include <X11/StringDefs.h> X#include <X11/Shell.h> X#include <X11/Xatom.h> X#ifdef X11R3 X#include <X11/Cardinals.h> X#include <X11/VPaned.h> X#include <X11/Form.h> X#include <X11/AsciiText.h> X#include <X11/TextP.h> X#include <X11/Box.h> X#include <X11/List.h> X#include <X11/Command.h> X#include <X11/Dialog.h> X#include <X11/Label.h> X#else X#include <X11/Xaw/Cardinals.h> X#include <X11/Xaw/VPaned.h> X#include <X11/Xaw/Form.h> X#include <X11/Xaw/AsciiText.h> X#include <X11/Xaw/TextP.h> X#include <X11/Xaw/Box.h> X#include <X11/Xaw/List.h> X#include <X11/Xaw/Command.h> X#include <X11/Xaw/Dialog.h> X#include <X11/Xaw/Label.h> X#endif X X#define TITLE "xmail 1.0" /* program title and version string */ X#define MAXARGS 20 /* max number of args */ X#define StartPos 6 /* size of 'File: ' (del stop point) */ X#define XMAILER "Mail" /* name of mail program executable */ X#define LASTCH(s) (s[strlen(s)-1]) X#define TEXTWIDTH (TextFontStr->max_bounds.width) X#define TEXTHEIGHT (TextFontStr->max_bounds.descent + TextFontStr->max_bounds.ascent) X#define HELPWIDTH (HelpFontStr->max_bounds.width) X#define HELPHEIGHT (HelpFontStr->max_bounds.descent + HelpFontStr->max_bounds.ascent) X/* X** A shorter name for the Xt function - to keep source line lengths small X*/ X#define WidgetOf XtNameToWidget X Xtypedef struct { X String textFont; /* xmail text font */ X String helpFont; /* xmail help font */ X Dimension shellWidth; /* xmail window width */ X Dimension fileBoxWidth; /* file window box width */ X Dimension indexHeight; /* index window height */ X Dimension textHeight; /* text window height */ X Dimension textMinHeight; /* text window minimum height */ X Dimension buttonWidth; /* command button width */ X Dimension buttonHeight; /* command button height */ X Dimension commandHSpace; /* command horizontal spacing */ X Dimension commandVSpace; /* command vertical spacing */ X Dimension commandMinHeight; /* command window height */ X Dimension helpWidth; /* width of the help text popup */ X Dimension helpHeight; /* height of the help text popup */ X Dimension helpX; /* help x offset from textWindow */ X Dimension helpY; /* help y offset from textWindow */ X Dimension menuX; /* menu x offset from parent */ X Dimension menuY; /* menu y offset from parent */ X X Boolean bellRing; /* xmail audible bell option */ X Boolean mailopt_i; /* mail option -i */ X Boolean mailopt_n; /* mail option -n */ X Boolean mailopt_U; /* mail option -U */ X String MFileName; /* mail option -f filename */ X String SubjectStr; /* mail option -s subject */ X Boolean Show_Last; /* xmail show latest option -ls */ X} XmailResources; X X X/* X** structure sent to AddMenuButton() X*/ Xtypedef struct menuList_str X { X String label; X XtCallbackProc func; X String data; X } menuList, *menuList_p; X X Xtypedef struct { X char *pat; /* regular expression */ X struct re_pattern_buffer *buf; /* buffer for compile regex */ X} PatternRec, *PatternRecPtr; X Xtypedef struct { X char *name; /* recipient name */ X char *alias; /* alias for name */ X} AliasRec, *AliasRecPtr; END_OF_FILE if test 5263 -ne `wc -c <'defs.h'`; then echo shar: \"'defs.h'\" unpacked with wrong size! fi # end of 'defs.h' fi if test -f 'directory.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'directory.c'\" else echo shar: Extracting \"'directory.c'\" \(5245 characters\) sed "s/^X//" >'directory.c' <<'END_OF_FILE' X/* X * xmail - X window system interface to the mail program X * X * Copyright 1990 by National Semiconductor Corporation X * X * Permission to use, copy, modify, and distribute this software and its X * documentation for any purpose is hereby granted without fee, provided that X * the above copyright notice appear in all copies and that both that X * copyright notice and this permission notice appear in supporting X * documentation, and that the name of National Semiconductor Corporation not X * be used in advertising or publicity pertaining to distribution of the X * software without specific, written prior permission. X * X * NATIONAL SEMICONDUCTOR CORPORATION MAKES NO REPRESENTATIONS ABOUT THE X * SUITABILITY OF THIS SOFTWARE FOR ANY PURPOSE. IT IS PROVIDED "AS IS" X * WITHOUT EXPRESS OR IMPLIED WARRANTY. NATIONAL SEMICONDUCTOR CORPORATION X * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED X * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO X * EVENT SHALL NATIONAL SEMICONDUCTOR CORPORATION BE LIABLE FOR ANY SPECIAL, X * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM X * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE X * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR X * PERFORMANCE OF THIS SOFTWARE. X * X * Author: Michael C. Wagnitz - National Semiconductor Corporation X * X */ X X X#include "global.h" X#ifdef SUNOS_4 X#include <dirent.h> X#else X#include <sys/dir.h> X#endif X X X/* X** @(#)SetDirectory() - Create popup list of directory folder names X*/ X/* ARGSUSED */ XXtActionProc XSetDirectory(w, event, params, num_params) XWidget w; XXEvent *event; XString *params; XCardinal *num_params; X{ X Arg args[MAXARGS]; X Cardinal label_width, path_length, n, depth, x, y; X DIR *new_dir, *dirp; X String name, path; X Widget menu, layout, bw; X char *s, trans[BUFSIZ], tmp[BUFSIZ]; X X#ifdef SUNOS_4 X struct dirent *dp; X#else X struct direct *dp; X#endif X X static String dir_Trans = X "<Btn1Down>: SetCursor(True) SetDirectory(%s, %s, %d) SetCursor()"; X X static String m_Trans = "<LeaveWindow>: MenuPopdown(%s)"; X X static String b_Trans = "<EnterWindow>: set() \n\ X <LeaveWindow>: unset() \n\ X <Btn3Up>: MyNotify(%d) MenuPopdown(%s)"; X X static XtCallbackRec callbacks[] = { X { (XtCallbackProc) GetFolderName, NULL }, X { NULL, NULL } X }; X X X name = params[0]; X path = params[1]; X path_length = strlen(path); X sscanf(params[2], "%d", &depth); X depth++; X X if (! XtNameToWidget(w, name)) { X (void) sprintf(trans, m_Trans, name); X XtSetArg(args[0], XtNtranslations, XtParseTranslationTable(trans)); X menu = XtCreatePopupShell(name, overrideShellWidgetClass, w, args, ONE); X X XtSetArg(args[0], XtNdefaultDistance, 1); X layout = XtCreateManagedWidget("menu", formWidgetClass, menu, args, ONE); X X if ((dirp = opendir(path)) == NULL) X XtError("SetDirectory: Can't access passed directory name"); X/* X** Find width of longest label for this menu X*/ X strcpy(tmp, ""); X for (dp = readdir(dirp); dp != NULL; dp = readdir(dirp)) X if (strcmp(dp->d_name, ".") && strcmp(dp->d_name, "..")) X if (strlen(tmp) < strlen(dp->d_name)) X strcpy(tmp, dp->d_name); X X rewinddir(dirp); X X label_width = (n=strlen(tmp)) ? XTextWidth(TextFontStr, tmp, n) + 12 : 0; X X if (label_width) { X (void) sprintf(trans, b_Trans, depth, name); X X n = 0; X XtSetArg(args[n], XtNwidth, label_width); n++; X XtSetArg(args[n], XtNfont, TextFontStr); n++; X XtSetArg(args[n], XtNcallback, callbacks); n++; X XtSetArg(args[n], XtNtranslations, XtParseTranslationTable(trans)); n++; X/* X** create the menu buttons X*/ X bw = NULL; X for (dp = readdir(dirp); dp != NULL; dp = readdir(dirp), n = 4) { X if (strcmp(dp->d_name, ".") && strcmp(dp->d_name, "..")) { X/* X** If this 'folder file' is also a directory, mark it with a trailing slash '/' X*/ X s = XtMalloc(path_length + strlen(dp->d_name) + 2); X sprintf(s, "%s/%s", path, dp->d_name); X if ((new_dir = opendir(s)) != NULL) { X sprintf(tmp, "%s/", dp->d_name); X XtSetArg(args[n], XtNlabel, tmp); X } else X XtSetArg(args[n], XtNlabel, dp->d_name); X n++; X XtSetArg(args[n], XtNfromVert, bw); n++; X bw = XtCreateManagedWidget("menubutton",commandWidgetClass,layout,args,n); X/* X** If this 'folder' is a directory, add a button popup menu of its files. X*/ X if (new_dir) { X closedir(new_dir); X sprintf(trans, dir_Trans, tmp, s, depth); X XtOverrideTranslations(bw, XtParseTranslationTable(trans)); X } X XtFree(s); X } X } X closedir(dirp); X } X/* X** If no buttons were created for this menu, destroy the widget. X*/ X if (! label_width) X XtDestroyWidget(menu); X } /* end - if menu had not yet been realized */ X/* X** If menu exists, pop it up, after setting x,y coordinates X*/ X menu = XtNameToWidget(w, name); X X if (menu->core.being_destroyed) X XBell(XtDisplay(toplevel), 33); X else { X SetPopup(w, event, params, num_params); X X XtPopup(menu, XtGrabNone); X } X} /* SetDirectory */ END_OF_FILE if test 5245 -ne `wc -c <'directory.c'`; then echo shar: \"'directory.c'\" unpacked with wrong size! fi # end of 'directory.c' fi if test -f 'environs.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'environs.c'\" else echo shar: Extracting \"'environs.c'\" \(7072 characters\) sed "s/^X//" >'environs.c' <<'END_OF_FILE' X/* X * xmail - X window system interface to the mail program X * X * Copyright 1990 by National Semiconductor Corporation X * X * Permission to use, copy, modify, and distribute this software and its X * documentation for any purpose is hereby granted without fee, provided that X * the above copyright notice appear in all copies and that both that X * copyright notice and this permission notice appear in supporting X * documentation, and that the name of National Semiconductor Corporation not X * be used in advertising or publicity pertaining to distribution of the X * software without specific, written prior permission. X * X * NATIONAL SEMICONDUCTOR CORPORATION MAKES NO REPRESENTATIONS ABOUT THE X * SUITABILITY OF THIS SOFTWARE FOR ANY PURPOSE. IT IS PROVIDED "AS IS" X * WITHOUT EXPRESS OR IMPLIED WARRANTY. NATIONAL SEMICONDUCTOR CORPORATION X * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED X * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO X * EVENT SHALL NATIONAL SEMICONDUCTOR CORPORATION BE LIABLE FOR ANY SPECIAL, X * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM X * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE X * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR X * PERFORMANCE OF THIS SOFTWARE. X * X * Author: Michael C. Wagnitz - National Semiconductor Corporation X * X */ X#include "global.h" X Xextern char *mailrcFile(); X XAliasRecPtr *aliases = NULL; /* array of mail alias strings */ X X/* X** @(#)alias() - return alias value(s) from mail, or name if no alias found X*/ Xchar * Xalias(name) Xchar *name; X{ X static char tmp[BUFSIZ]; X static char buf[BUFSIZ]; X char *s, *p, *list, *value; X int i, n; X FILE *fp; X X X strcpy(tmp, ""); X if (name) X strcpy(tmp, name); X/* X** If not already done, extract the mail alias list and build the alias table. X*/ X if (! aliases) { X if (mailpid) X list = QueryMail("alias"); X else { X i = BUFSIZ; X list = XtMalloc(i); X strcpy(list, ""); X if ((fp = fopen(mailrcFile(), "r")) != NULL) { X while (s = fgets(buf, BUFSIZ, fp)) { X if (strncmp(buf, "alias", 5) == 0) { X for (s = &buf[5]; *s == ' ' || *s == '\t'; s++); X if (strlen(list) + strlen(s) > i) { X i += BUFSIZ; X list = XtRealloc(list, i); X } X strcat(list, s); X } X } X fclose(fp); X } X } X for (i = 1, p = list; *p; p++) if (*p == '\n') i++; X aliases = (AliasRec **) XtMalloc((i + 1) * sizeof(AliasRec *)); X X for (n = 0, p = list; n < i && *p; n++, p++) { X aliases[n] = (AliasRec *) XtMalloc(sizeof(AliasRec)); X for (aliases[n]->name = p; *p && *p != ' ' && *p != '\t'; p++); X for (*p++ = '\0'; *p && (*p == ' ' || *p == '\t'); p++); X for (aliases[n]->alias = p; *p && *p != '\n'; p++); X if (*p) *p = '\0'; X } X aliases[n] = (AliasRec *) XtMalloc(sizeof(AliasRec)); X aliases[n] = NULL; X } X/* X** If name is made up of more than one word, check each word for aliasing. X*/ X if (value = tmp) { X if (strchr(tmp, ',') || strchr(tmp, ' ') || strchr(tmp, '\t')) { X buf[0] = '\0'; X for (p = value; *p;) { X for (; *p && *p != ',' && *p != ' ' && *p != '\t'; p++); X if (*p) *p++ = '\0'; X for (n = 0; aliases[n]; n++) { X if (strcmp(value, aliases[n]->name) == 0) { X if (*buf) strcat(buf, ", "); X strcat(buf, aliases[n]->alias); X break; X } X } X if (! aliases[n]) { /* If not an alias, use the name supplied. */ X if (*buf) strcat(buf, ", "); X strcat(buf, value); X } X for (; *p && (*p == ',' || *p == ' ' || *p == '\t'); p++); X value = p; X if (*p) p++; X } X value = buf; X } else { X/* X** Otherwise, test the single word for aliasing, substituting if matched. X*/ X for (n = 0; *tmp && aliases[n]; n++) X if (strcmp(tmp, aliases[n]->name) == 0) { X value = aliases[n]->alias; X break; X } X } X } X return ((char *)value); X} /* alias */ X X X/* X** @(#)GetMailEnv() - Get environment value from mail or shell X*/ Xchar * XGetMailEnv(item) Xchar *item; X{ X static char *mailenv; X char *s, *c, *value, *getenv(); X char buf[BUFSIZ]; X register int length; X X X value = NULL; X if (! mailpid) { X if (! (value = GetMailrc(item))) { X if ((s = getenv(item)) != NULL) X value = XtNewString(s); X } X } else { X if (! mailenv) X mailenv = QueryMail("set"); X X for (s = mailenv; *s && strncmp(s, item, strlen(item)); s++) X for (; *s && *s != '\n'; s++); X X if (! *s) { X if (s = getenv(item)) X value = XtNewString(s); X } else { X for (; *s && *s != '"' && *s != '\n'; s++); X if (! *s || *s == '\n') { /* variable is flag only, no value */ X value = XtNewString("True"); /* substitute boolean for no value */ X } else { X for (c = ++s; *c && *c != '"'; c++); X length = c - s; X value = XtMalloc(length + 1); X strncpy(value, s, length); X value[length] = '\0'; X } X } X } X return(value); X} /* GetMailEnv */ X X X/* X** @(#)mailrcFile() - Return a pointer to fully qualified mailrc file name X*/ Xchar * XmailrcFile() X{ X char *s, *h, *p, *getenv(); X static char buf[BUFSIZ]; X X if ((s = getenv("MAILRC")) == NULL) { X if ((s = getenv("HOME")) == NULL) s = ""; X sprintf(buf, "%s/.mailrc", s); X } else { X if (*s == '/' || (*s != '~' && *s != '$')) sprintf(buf, "%s", s); X else { X if (*s == '~') { X if ((h = getenv("HOME")) == NULL) h = ""; X sprintf(buf, "%s%s", h, &s[1]); X } else { X for (p = s; *p && (*p == '$' || *p == '{' || *p == '('); p++); X for (s = p; *s && *s != '}' && *s != ')'; s++); X *s++ = '\0'; X if ((h = getenv(p)) == NULL) h = ""; X sprintf(buf, "%s/%s", h, s); X } X } X } X return((char *)buf); X} /* mailrcFile */ X X X/* X** @(#)GetMailrc() - Get mail variable setting from the mailrc file X*/ Xchar * XGetMailrc(item) Xchar *item; X{ X FILE *fp; X char *s, buf[BUFSIZ]; X X X s = ""; X if ((fp = fopen(mailrcFile(), "r")) != NULL) { X while (s = fgets(buf, BUFSIZ, fp)) { X if (strncmp(buf, "set", 3) == 0) { X for (s = &buf[3]; *s == ' ' || *s == '\t'; s++); X if (strncmp(s, item, strlen(item)) == 0) { X s = s + strlen(item) + 1; X if (*s == '\"') /* if surrounded by quotes */ X buf[strlen(buf) - 2] = '\0'; X else { X buf[strlen(buf) - 1] = '\0'; X --s; X } X strcpy(buf, ++s); X s = XtNewString(buf); X break; X } X } X } X fclose(fp); X } X return((char *)s); X} /* GetMailrc */ END_OF_FILE if test 7072 -ne `wc -c <'environs.c'`; then echo shar: \"'environs.c'\" unpacked with wrong size! fi # end of 'environs.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'\" \(8775 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 TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR X * PERFORMANCE OF THIS SOFTWARE. X * X * Author: Michael C. Wagnitz - National Semiconductor Corporation X * X */ X X X#include "defs.h" X X/* HelpText.c */ X Xextern String Cc_Help_Text; Xextern String Copy_Help_Text; Xextern String Delete_Help_Text; Xextern String Deliver_Help_Text; Xextern String File_Help_Text; Xextern String Folder_Help_Text; Xextern String Hold_Help_Text; Xextern String Index_Help_Text; Xextern String NewMail_Help_Text; Xextern String Print_Help_Text; Xextern String Quit_Help_Text; Xextern String Read_Help_Text; Xextern String Reply_Help_Text; Xextern String Save_Help_Text; Xextern String Send_Help_Text; Xextern String Sign_Help_Text; Xextern String Status_Help_Text; Xextern String Subject_Help_Text; Xextern String Text_Help_Text; Xextern String Title_Help_Text; Xextern String To_Help_Text; X X/* actions.c */ X Xextern XtActionProc DeleteLine(); /* in the file window */ Xextern XtActionProc DeleteWord(); /* also in the file window */ Xextern XtActionProc DoAutograph(); /* call Autograph callback */ Xextern XtActionProc DoCmd(); /* effect specified command */ Xextern XtActionProc DoDone(); /* send/reply completion */ 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 InsertSpace(); /* for deletes (file window) */ 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 SetAliases(); /* menu list of alias names */ Xextern XtActionProc SetCursor(); /* change between wait & norm */ Xextern XtActionProc SetDirectory(); /* create folder files list */ Xextern XtActionProc SetFolders(); /* create a list of folders */ Xextern XtActionProc SetHelp(); /* Position help popup text */ Xextern XtActionProc SetPopup(); /* Position relative to owner */ Xextern XtActionProc SetSelect(); /* reposition select mark */ Xextern XtActionProc Quit(); /* termination procedure */ 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 DoWith(); /* do cmd with arguments */ Xextern XtCallbackProc GetAliasName(); /* retrieve alias name */ Xextern XtCallbackProc GetFolderName(); /* retrieve folder name */ 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/* 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 index_handler(); /* highlight the msg number */ Xextern int file_handler(); /* handle change of folder */ X X/* mail.c */ X Xextern XtInputCallbackProc readMail(); /* get data from mail */ Xextern void writeMail(); /* send data to mail */ Xextern void sendMail(); /* used by Send/Reply cmds */ X X/* parser.c */ X Xextern void parser_init(); /* compile patterns */ 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 void Normalize(); /* position to end of text */ Xextern int PositionToMsgNumber(); /* convert pos to msg number */ Xextern void writeText(); /* write text to buffer */ Xextern XtTextPosition TextGetLastPos(); /* get last pos of text */ Xextern void UpdateTitleBar(); /* file name and msg count */ 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(); /* for To, Subject, and Cc */ X X/* xmail.c */ X Xextern void initialize(); /* main initialization code */ Xextern char **mailoptions(); /* sets up call to mail pgm */ X X/* extern variables */ X Xextern char *IndexBuf; /* buffer for index widget */ 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 tmpName[BUFSIZ]; /* message temporary filename */ Xextern char MailPrompt[20]; /* mail program prompt string */ Xextern char *HelpNames[23]; /* array of help window names */ Xextern char **mailargv; /* array passed to mail child */ X Xextern Pixmap hatch; /* cross_weave, used for Newmail */ Xextern Cursor waitC; /* watch cursor, used when waiting */ Xextern Cursor xtermC; /* normal cursor for text windows */ Xextern Widget toplevel; /* top level shell widget */ X Xextern AliasRecPtr *aliases; /* array of mail alias strings */ Xextern XmailResources XMail; /* XMail application resources */ Xextern XtTextSource HelpStrings[22]; Xextern XFontStruct *TextFontStr, *HelpFontStr; X Xextern FILE *mailfp; /* file pointer to mail process */ 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 */ Xextern int INDEXSIZE; /* size of index window buffer */ X X/* global.h */ END_OF_FILE if test 8775 -ne `wc -c <'global.h'`; then echo shar: \"'global.h'\" unpacked with wrong size! fi # end of 'global.h' fi if test -f 'handler.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'handler.c'\" else echo shar: Extracting \"'handler.c'\" \(6607 characters\) sed "s/^X//" >'handler.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 TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR X * PERFORMANCE OF THIS SOFTWARE. X * X * The following software modules were created and are Copyrighted by National X * Semiconductor Corporation: X * X * 1. index_handler: and X * 2. file_handler. X * X * Author: Michael C. Wagnitz - National Semiconductor Corporation X * X */ X X X#include <ctype.h> X#include "global.h" X#include "xmailregex.h" X X/* X** @(#)index_handler() - mark index line of specified or current mail message X*/ Xint Xindex_handler(msg_num) Xint msg_num; X{ X char *c, *s, *strchr(); X Arg args[2]; X Cardinal j, k; X Widget w; X XtTextPosition pos, top; X X X Bell("Use <Shift><Button2> for help on any window"); X X k = msg_num; /* Try to mark chosen msg. */ X if (! k) { /* If one wasn't specified */ X c = QueryMail("="); X sscanf(c, "%d", &k); /* get msg num from mail. */ X XtFree(c); X } X X if (k <= 50) X for (s = IndexBuf, j = k; j > 1 && (c = strchr(s,'\n')); j--) s = c + 1; X else { /* if index is fairly large */ X for (s = &IndexBuf[strlen(IndexBuf) - 2]; s > IndexBuf && *s != '\n'; s--); X for (c = s + 1; *c && !isdigit(*c); c++); X sscanf(c, "%d", &j); /* look from end backwards */ X for (; j > k; j--) X for (s--; s > IndexBuf && *s != '\n'; s--); X s++; X } X X for (;;) { /* allow for deleted msgs */ X for (c = s; *c && !isdigit(*c); c++); X if (sscanf(c, "%d", &j) && j <= k) break; /* total may be less than us */ X for (s -= 2; s > IndexBuf && *s != '\n'; s--); X s++; X } X X if (*(s + 1) == 'D') { /* If this is a deleted msg */ X for (;*s && *(s + 1) == 'D';) { /* try looking above deletes */ X if (! (c = strchr(s,'\n'))) break; /* don't go past end of buf */ X s = c + 1; X } X for (;s > IndexBuf && *(s + 1) == 'D';) { X for (s -= 2; s > IndexBuf && *s != '\n'; s--); X s++; X } X for (c = s; *c && !isdigit(*c); c++); X sscanf(c, "%d", &j); X } X X pos = s - IndexBuf; /* resolve our position */ X X w = WidgetOf(WidgetOf(toplevel, "vpane"), "indexWindow"); X X XtTextSetInsertionPoint(w, pos); X X SetSelect(w, NULL, NULL, NULL); X X return(j); /* return msg actually found */ X} /* index_handler */ X X X/* X** @(#)file_handler() - Handle output of Start, file, and delete commands X** If *Show_Last: resource is NOT False and show_latest is true, show last X** message in list, if none are marked as new. X*/ Xfile_handler(show_latest) Xint show_latest; X{ X Widget w; X char msgnum_str[10], *c, *s, *p, *strchr(); X int msg_num = 0; /* zero means no message */ X X X c = QueryMail("="); /* Get current mail msg num. */ X while (! isdigit(*c)) X c = QueryMail("="); X sprintf(msgnum_str, c); X XtFree(c); X X c = QueryMail("file"); /* Forces current msg to one */ X UpdateTitleBar(c); X XtFree(c); X X if (strcmp(Command, "Start") == 0) { /* unless we're at Start, in */ X c = QueryMail("="); /* which case we get it now */ X sprintf(msgnum_str, c); /* (due to -N mailargv use). */ X XtFree(c); X } X X s = QueryMail("h"); X if (strncmp(s, "No applicable messages", 22) == 0) { X Bell(s); X writeText(WidgetOf(WidgetOf(toplevel, "vpane"), "indexWindow"), " ", 0); X writeTo(WidgetOf(WidgetOf(toplevel, "vpane"), "textWindow"), " "); X } else { X/* X** find message pointer caret and replace it with a space X*/ X c = s; X if (*s == '>') *s = ' '; X else { X for (; *c; c++) X if (*c == '>' && *(c - 1) == '\n') { X *c = ' '; X break; X } X } X/* X** If current message is not marked as new or unread, show_latest is true, and X** the Show_Last resource is not false, select the last message in the header. X*/ X if (show_latest && XMail.Show_Last) { X if (*(c+1) != 'N' && *(c+1) != 'U') { /* If this is not a special */ X p = c; /* find the last message */ X if (c == s) { /* if would've started @ One */ X for (p = &s[strlen(s)-2]; p > s && *p != '\n'; p--); X p++; /* go to last line of buffer */ X } else { X for (;*++c && *(c+1) != 'N' && *(c+1) != 'U';) { X if (! (c = strchr(p,'\n'))) X break; /* don't go past end of buf */ X p = c + 1; X } X } X for (c = p; *c && !isdigit(*c); c++); X sscanf(c, "%d", &msg_num); X sprintf(msgnum_str, "%d", msg_num); X } X } X/* X** write the header info to the index window X*/ X writeText(WidgetOf(WidgetOf(toplevel, "vpane"), "indexWindow"), s, 0); X/* X** return the current mail message number X*/ X msg_num = atoi(msgnum_str); X/* X** highlight the current message's header line index number X*/ X index_handler(msg_num); X } X XtFree(s); X return(msg_num); X} /* file_handler */ END_OF_FILE if test 6607 -ne `wc -c <'handler.c'`; then echo shar: \"'handler.c'\" unpacked with wrong size! fi # end of 'handler.c' fi if test -f 'icon.nomail' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'icon.nomail'\" else echo shar: Extracting \"'icon.nomail'\" \(3864 characters\) sed "s/^X//" >'icon.nomail' <<'END_OF_FILE' X/* X * xmail - X window system interface to the mail program X * X * Copyright 1990 by National Semiconductor Corporation X * X * Permission to use, copy, modify, and distribute this software and its X * documentation for any purpose is hereby granted without fee, provided that X * the above copyright notice appear in all copies and that both that X * copyright notice and this permission notice appear in supporting X * documentation, and that the name of National Semiconductor Corporation not X * be used in advertising or publicity pertaining to distribution of the X * software without specific, written prior permission. National Semiconductor X * Corporation makes no representations about the suitability of this software X * for any purpose. It is provided "as is" without express or implied warranty. X * X * NATIONAL SEMICONDUCTOR CORPORATION DISCLAIMS ALL WARRANTIES WITH REGARD TO X * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND X * FITNESS, IN NO EVENT SHALL NATIONAL SEMICONDUCTOR CORPORATION BE LIABLE FOR X * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER X * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF X * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN X * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. X * X * Author: Michael C. Wagnitz - National Semiconductor Corporation X * X */ X X#define no_mail_width 56 X#define no_mail_height 56 X Xstatic char no_mail_bits[] = { X 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, X 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, X 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, X 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, X 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, X 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0xc0, 0x00, 0x00, 0x00, 0x00, X 0x00, 0x18, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x03, 0x04, X 0x00, 0x00, 0x00, 0x07, 0x00, 0x06, 0x06, 0x00, 0x00, 0x80, 0x01, 0x00, X 0x06, 0x07, 0x00, 0x00, 0xc0, 0x1c, 0x00, 0x87, 0x07, 0x00, 0x00, 0xe0, X 0x1f, 0x80, 0xc7, 0x07, 0x00, 0x00, 0xf0, 0x3f, 0xc0, 0xe6, 0x07, 0x00, X 0x00, 0xf8, 0xe2, 0x60, 0x76, 0x07, 0x00, 0x00, 0x9c, 0xce, 0x31, 0x3e, X 0x03, 0x00, 0x00, 0x8e, 0x86, 0x19, 0x1e, 0x01, 0x00, 0x00, 0x86, 0x03, X 0x0f, 0x0e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x07, 0x07, 0x00, 0x00, 0x00, X 0xc2, 0x06, 0x83, 0x07, 0x00, 0x00, 0x00, 0xa2, 0x0b, 0xc3, 0x07, 0x00, X 0x00, 0x00, 0x12, 0x11, 0xe3, 0x06, 0x00, 0x00, 0x00, 0x82, 0x02, 0x73, X 0x06, 0x00, 0xff, 0xff, 0xaa, 0x2a, 0x33, 0xf6, 0xff, 0x00, 0x00, 0x52, X 0x15, 0x13, 0x06, 0x00, 0x00, 0x00, 0x02, 0x00, 0x03, 0x03, 0x00, 0x00, X 0x00, 0x02, 0x00, 0x83, 0x01, 0x00, 0x00, 0x00, 0x2a, 0x29, 0xc3, 0x00, X 0x00, 0x00, 0x00, 0xba, 0x2a, 0x63, 0x00, 0x00, 0x00, 0x00, 0xaa, 0x2b, X 0x33, 0x00, 0x00, 0x00, 0x00, 0xaa, 0x6a, 0x3b, 0x00, 0x00, 0x00, 0x00, X 0x02, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x37, 0x00, 0x00, X 0x00, 0x00, 0xfe, 0xff, 0x33, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0x31, X 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x30, 0x00, 0x00, 0x00, 0x00, 0x60, X 0x60, 0x30, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x30, 0x00, 0x00, 0x00, X 0x00, 0x60, 0x60, 0x30, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x30, 0x00, X 0x00, 0x00, 0x00, 0x60, 0x60, 0x30, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, X 0x30, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x30, 0x00, 0x00, 0x00, 0x00, X 0x60, 0x60, 0x30, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x30, 0x00, 0x00, X 0xee, 0x28, 0x68, 0x60, 0x3a, 0x21, 0x11, 0x88, 0x22, 0x76, 0x60, 0x2c, X 0x29, 0x00, 0x29, 0xc8, 0x76, 0x60, 0xaf, 0x40, 0x9a, 0xc4, 0x4a, 0x72, X 0xe0, 0x87, 0x4e, 0x1a, 0xcb, 0x67, 0x7b, 0xe2, 0x7c, 0xee, 0x3f, 0xbf, X 0xdc, 0x66, 0xe9, 0xd2, 0x33, 0xa5, 0x2a, 0x8f, 0x6d, 0xba, 0x73, 0xb9, X 0x7b, 0xfd, 0x72, 0x9b, 0xda, 0x4e, 0xe7, 0xd4 }; END_OF_FILE if test 3864 -ne `wc -c <'icon.nomail'`; then echo shar: \"'icon.nomail'\" unpacked with wrong size! fi # end of 'icon.nomail' fi if test -f 'mail.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'mail.c'\" else echo shar: Extracting \"'mail.c'\" \(7812 characters\) sed "s/^X//" >'mail.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 TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR X * PERFORMANCE OF THIS SOFTWARE. X * X * The following software modules were created and are Copyrighted by National X * Semiconductor Corporation: X * X * 1. sendMail: X * X * Author: Michael C. Wagnitz - National Semiconductor Corporation X * X */ X X X#include "global.h" X X#ifndef DEFAULT_EDITOR X#define DEFAULT_EDITOR "/usr/ucb/vi"; X#endif X X/* X** @(#)readMail() - callback invoked everytime input is pending on mail fd X** X** Calls QueryMail() to read all available data from mail file descriptor, X** and passes output to parse() for analysis and appropriate action. X*/ XXtInputCallbackProc XreadMail(client_data, source, id) Xcaddr_t client_data; Xint *source; XXtInputId *id; X{ X parse(QueryMail("")); X} /* readMail */ X X X/* X** @(#)writeMail() - Write s to mail, and flush the output. X*/ Xvoid XwriteMail(s) Xchar *s; X{ X fputs(s, mailfp); X fflush(mailfp); X} /* writeMail */ X X X/* X** @(#)sendMail() - send a mail message to the indicated recipient(s) X*/ X/* ARGSUSED */ Xvoid XsendMail(parent) XWidget parent; X{ X Arg args[MAXARGS]; X Cardinal n; X Display *ad; X Widget Popup, Layout; X Widget lab1, lab2, lab3; X Widget To, Subject, Cclist, Last; X Window aw, dumy; X String Editor; X menuList_p *list; X menuList b1, b2, b3; X char cmd[BUFSIZ]; X int x, y, scn; X X X aw = XtWindow(WidgetOf(WidgetOf(toplevel, "vpane"), "statusWindow")); X ad = XtDisplay(WidgetOf(WidgetOf(toplevel, "vpane"), "statusWindow")); X scn = DefaultScreen(ad); X X XTranslateCoordinates(ad, aw, RootWindow(ad, scn), XMail.menuX, XMail.menuY, X &x, &y, &dumy); X X scn = XMail.shellWidth - 100; X X n = 0; X XtSetArg(args[n], XtNinput, True); n++; X XtSetArg(args[n], XtNwidth, scn); n++; X XtSetArg(args[n], XtNheight, XMail.textMinHeight); n++; X XtSetArg(args[n], XtNborderWidth, 2); n++; X XtSetArg(args[n], XtNx, x); n++; X XtSetArg(args[n], XtNy, y); n++; X Popup = XtCreatePopupShell("popup", overrideShellWidgetClass,parent,args,n); X X n = 0; X XtSetArg(args[n], XtNdefaultDistance, 2); n++; X Layout = XtCreateManagedWidget("SubjCc", formWidgetClass, Popup, args, n); X X n = 0; X XtSetArg(args[n], XtNfromVert, NULL); n++; X XtSetArg(args[n], XtNfromHoriz, NULL); n++; X XtSetArg(args[n], XtNlabel, "To: "); n++; X XtSetArg(args[n], XtNborderWidth, 0); n++; X XtSetArg(args[n], XtNfont, TextFontStr); n++; X XtSetArg(args[n], XtNheight, XMail.buttonHeight); n++; X XtSetArg(args[n], XtNjustify, XtJustifyLeft); n++; X XtSetArg(args[n], XtNinternalHeight, 0); n++; X XtSetArg(args[n], XtNinternalWidth, 1); n++; X lab1 = XtCreateManagedWidget("SubjCc", labelWidgetClass, Layout, args, n); X X To = CreateInputWindow(Layout, "To", Recipient, BUFSIZ); X n = 0; X XtSetArg(args[n], XtNfromVert, NULL); n++; X XtSetArg(args[n], XtNfromHoriz, lab1); n++; X XtSetValues(To, args, n); X X AddHelpText(To, "To", To_Help_Text); X X n = 0; X XtSetArg(args[n], XtNfromVert, lab1); n++; X XtSetArg(args[n], XtNfromHoriz, NULL); n++; X XtSetArg(args[n], XtNlabel, "Subject: "); n++; X n = 9; X lab2 = XtCreateManagedWidget("SubjCc", labelWidgetClass, Layout, args, n); X X Subject = CreateInputWindow(Layout, "Subject", SubjBuf, BUFSIZ); X n = 0; X XtSetArg(args[n], XtNfromVert, To); n++; X XtSetArg(args[n], XtNfromHoriz, lab2); n++; X XtSetValues(Subject, args, n); X X AddHelpText(Subject, "Subject", Subject_Help_Text); X X n = 0; X XtSetArg(args[n], XtNfromVert, lab2); n++; X XtSetArg(args[n], XtNfromHoriz, NULL); n++; X XtSetArg(args[n], XtNlabel, "Cc: "); n++; X n = 9; X lab3 = XtCreateManagedWidget("SubjCc", labelWidgetClass, Layout, args, n); X X Cclist = CreateInputWindow(Layout, "Cc", CcBuf, BUFSIZ); X n = 0; X XtSetArg(args[n], XtNfromVert, Subject); n++; X XtSetArg(args[n], XtNfromHoriz, lab3); n++; X XtSetValues(Cclist, args, n); X X AddHelpText(Cclist, "Cc", Cc_Help_Text); X X n = 0; X XtSetArg(args[n], XtNfromVert, lab3); n++; X XtSetArg(args[n], XtNfromHoriz, NULL); n++; X XtSetArg(args[n], XtNwidth, scn / 2); n++; X XtSetArg(args[n], XtNheight, XMail.buttonHeight); n++; X XtSetArg(args[n], XtNfont, TextFontStr); n++; X lab2 = XtCreateManagedWidget("Autograph", commandWidgetClass, Layout, args, n); X X XtAddCallback(lab2, XtNcallback, (XtCallbackProc) Autograph, (caddr_t) NULL); X X list = (menuList **) XtMalloc(4 * sizeof(menuList *)); X X b1.label = "Add your autograph string Sign (~A)"; X b1.func = (XtCallbackProc) Autograph; X b1.data = "A"; X b2.label = "Add your autograph string sign (~a)"; X b2.func = (XtCallbackProc) Autograph; X b2.data = "a"; X list[0] = &b1; list[1] = &b2; list[2] = NULL; X X AddMenuWindow(lab2, "Autograph", "DoAutograph", list); X X AddHelpText(lab2, "Autograph", Sign_Help_Text); X X XtSetArg(args[1], XtNfromHoriz, lab2); X Last = XtCreateManagedWidget("Deliver", commandWidgetClass, Layout, args, 5); X X XtAddCallback(Last, XtNcallback, (XtCallbackProc) Done, (caddr_t) "Deliver"); X X b1.label = "Deliver the message"; X b1.func = (XtCallbackProc) Done; X b1.data = "Deliver"; X b2.label = "Cancel message and delete"; X b2.func = (XtCallbackProc) Done; X b2.data = "Cancel"; X b3.label = "Cancel, save in DEAD folder"; X b3.func = (XtCallbackProc) Done; X b3.data = "cancel"; X list[0] = &b1; list[1] = &b2; list[2] = &b3; list[3] = NULL; X X AddMenuWindow(Last, "Deliver", "DoDone", list); X X AddHelpText(Last, "Deliver", Deliver_Help_Text); X X Normalize(To); X Normalize(Subject); X Normalize(Cclist); X X XtFree(list); X X n = 1; X if ((Editor = GetMailEnv("EDITOR")) == NULL && X (Editor = GetMailEnv("VISUAL")) == NULL) { X Editor = DEFAULT_EDITOR; X n = 0; X } X X sprintf(cmd, X "xterm -display %s -T \"xmail message entry - using %s\" -n xmail_%s -e %s %s", X ad->display_name, Editor, Editor, Editor, tmpName); X system(cmd); X X if (n) X XtFree(Editor); X X XtPopup(Popup, XtGrabNone); X X XWarpPointer(XtDisplay(toplevel), None, XtWindow(To), 0, 0, 0, 0, 10, 5); X} /* sendMail */ END_OF_FILE if test 7812 -ne `wc -c <'mail.c'`; then echo shar: \"'mail.c'\" unpacked with wrong size! fi # end of 'mail.c' fi if test -f 'national.bm' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'national.bm'\" else echo shar: Extracting \"'national.bm'\" \(1889 characters\) sed "s/^X//" >'national.bm' <<'END_OF_FILE' X/* X * xmail - X window system interface to the mail program X * X * Copyright 1990 by National Semiconductor Corporation X * X * Permission to use, copy, modify, and distribute this software and its X * documentation for any purpose is hereby granted without fee, provided that X * the above copyright notice appear in all copies and that both that X * copyright notice and this permission notice appear in supporting X * documentation, and that the name of National Semiconductor Corporation not X * be used in advertising or publicity pertaining to distribution of the X * software without specific, written prior permission. National Semiconductor X * Corporation makes no representations about the suitability of this software X * for any purpose. It is provided "as is" without express or implied warranty. X * X * NATIONAL SEMICONDUCTOR CORPORATION DISCLAIMS ALL WARRANTIES WITH REGARD TO X * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND X * FITNESS, IN NO EVENT SHALL NATIONAL SEMICONDUCTOR CORPORATION BE LIABLE FOR X * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER X * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF X * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN X * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. X * X * Author: Michael C. Wagnitz - National Semiconductor Corporation X * X */ X X#define national_width 19 X#define national_height 19 X#define national_x_hot -1 X#define national_y_hot -1 Xstatic char national_bits[] = { X 0x00, 0x00, 0x00, 0x80, 0x41, 0x00, 0xc0, 0x61, 0x00, 0xe0, 0x71, 0x00, X 0x70, 0x39, 0x00, 0x38, 0x1d, 0x00, 0x1c, 0x0f, 0x00, 0x0e, 0x47, 0x00, X 0xc6, 0x63, 0x00, 0xe2, 0x70, 0x00, 0xf0, 0x38, 0x00, 0xb8, 0x1c, 0x00, X 0x9c, 0x0e, 0x00, 0x8e, 0x07, 0x00, 0x86, 0x03, 0x00, 0x82, 0x01, 0x00, X 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; END_OF_FILE if test 1889 -ne `wc -c <'national.bm'`; then echo shar: \"'national.bm'\" unpacked with wrong size! fi # end of 'national.bm' fi if test -f 'xmailregex.h' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'xmailregex.h'\" else echo shar: Extracting \"'xmailregex.h'\" \(3566 characters\) sed "s/^X//" >'xmailregex.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 TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR X * PERFORMANCE OF THIS SOFTWARE. X * X * Author: Michael C. Wagnitz - National Semiconductor Corporation X * X */ X X X#define C_START 0 X#define C_EXEC 1 X#define C_FILE 2 X#define C_DELETE 3 X#define C_NEWMAIL 4 X Xstatic PatternRec command_pattern[] = { X {"Start", NULL }, X {"p [^\n]+\n\\|c [^\n]+\n\\|C [^\n]+\n\\|s [^\n]+\n\\|S [^\n]+\n\\|\ Xw [^\n]+\n\\|W [^\n]+\n\\|-\n\\|hold [^\n]+\n\\|m[^\n]+\n\\|n\n", NULL }, X {"file[^%]*\n", NULL }, X {"d[^\n]*\n\\|u[^\n]*\n", NULL }, X {"file %\n\\|inc\n", NULL }, X NULL X}; X X#define O_BELL 0 X#define O_EXEC 1 X#define O_FILE 2 X#define O_PRINT 3 X Xstatic PatternRec output_pattern[] = { X { "No more messages\n\\|\ XAt EOF\n\\|\ XNo applicable messages from \{[^\}]+\}\n\\|\ XNo applicable messages\n\\|\ XNo new mail for [^\n]+\n\\|\ XNo mail for [^\n]+\n\\|\ XUnknown command: \"[^\"]+\"\n\\|\ XReferencing before first message\n\\|\ XCannot \"[^\"]+\" in edit mode\n\\|\ X\"[^\"]+\" \\[Appended\\] [0-9]+/[0-9]+\n\\|\ X\"[^\"]+\" \\[New file\\] [0-9]+/[0-9]+\n\\|\ X\"[^\"]+\" No such file or directory\n\\|\ X\"[^\"]+\" Invalid argument\n\\|\ X[0-9]+: Inappropriate message\n\\|\ X[0-9]+: Invalid message number\n\\|\ X[^:]+: No such file or directory\n\\|\ X[^:]+: Not a directory\n\\|\ X[^:]+: not a regular file\n\\|\ X[^:]+: empty file\n\\|\ XNot in system mailbox\n\\|\ XNo message [^\n]+\n\\|\ XNo messages to [^\n]+\n\\|\ XNo recipients specified\n\\|\ XNo recipients specified\n[^\n]+\n\\|\ XNew mail has arrived\n", NULL }, X X { "From \\|Message ", NULL }, X { "\"[^\"]+\": [0-9]+ message[^\n]+\n\\|[^:]+: [^\n]+\n", NULL }, X { "Pipe to: \"lpr -p\"\n\"lpr -p\" [0-9]+/[0-9]+\n", NULL }, X NULL X}; END_OF_FILE if test 3566 -ne `wc -c <'xmailregex.h'`; then echo shar: \"'xmailregex.h'\" unpacked with wrong size! fi # end of 'xmailregex.h' fi echo shar: End of archive 3 \(of 6\). cp /dev/null ark3isdone MISSING="" for I in 1 2 3 4 5 6 ; do if test ! -f ark${I}isdone ; then MISSING="${MISSING} ${I}" fi done if test "${MISSING}" = "" ; then echo You have unpacked all 6 archives. rm -f ark[1-9]isdone else echo You still need to unpack the following archives: echo " " ${MISSING} fi ## End of shell archive. exit 0 dan ----------------------------------------------------------- O'Reilly && Associates argv@sun.com / argv@ora.com 632 Petaluma Ave, Sebastopol, CA 95472 800-338-NUTS, in CA: 800-533-NUTS, FAX 707-829-0104 Opinions expressed reflect those of the author only.