1 /* 2 * xmail - X window system interface to the mail program 3 * 4 * Copyright 1990,1991,1992 by National Semiconductor Corporation 5 * 6 * Permission to use, copy, modify, and distribute this software and its 7 * documentation for any purpose is hereby granted without fee, provided that 8 * the above copyright notice appear in all copies and that both that 9 * copyright notice and this permission notice appear in supporting 10 * documentation, and that the name of National Semiconductor Corporation not 11 * be used in advertising or publicity pertaining to distribution of the 12 * software without specific, written prior permission. 13 * 14 * NATIONAL SEMICONDUCTOR CORPORATION MAKES NO REPRESENTATIONS ABOUT THE 15 * SUITABILITY OF THIS SOFTWARE FOR ANY PURPOSE. IT IS PROVIDED "AS IS" 16 * WITHOUT EXPRESS OR IMPLIED WARRANTY. NATIONAL SEMICONDUCTOR CORPORATION 17 * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO 19 * EVENT SHALL NATIONAL SEMICONDUCTOR CORPORATION BE LIABLE FOR ANY SPECIAL, 20 * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 21 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 22 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 23 * PERFORMANCE OF THIS SOFTWARE. 24 * 25 * Author: Michael C. Wagnitz - National Semiconductor Corporation 26 */ 27 28 29 #include <stdio.h> 30 #if XtSpecificationRelease > 4 31 #else 32 #include <sys/types.h> 33 #endif 34 #include <sys/param.h> 35 #include <X11/Xos.h> 36 37 #if XtSpecificationRelease > 4 38 #ifndef X_NOT_STDC_ENV 39 #include <stdlib.h> 40 #else 41 char *malloc(), *realloc(), *calloc(); 42 #endif 43 #if defined(macII) && !defined(__STDC__) /* stdlib.h fails to define these */ 44 char *malloc(), *realloc(), *calloc(); 45 #endif /* macII */ 46 #endif 47 48 #include <X11/IntrinsicP.h> 49 #include <X11/StringDefs.h> 50 #include <X11/Shell.h> 51 #include <X11/Xatom.h> 52 #include <X11/Xaw/Cardinals.h> 53 #include <X11/Xaw/Paned.h> 54 #include <X11/Xaw/Form.h> 55 #include <X11/Xaw/AsciiText.h> 56 #include <X11/Xaw/TextP.h> 57 #include <X11/Xaw/Box.h> 58 #include <X11/Xaw/List.h> 59 #include <X11/Xaw/Command.h> 60 #include <X11/Xaw/Dialog.h> 61 #include <X11/Xaw/Label.h> 62 63 #if XtSpecificationRelease > 4 64 #include <X11/Xfuncs.h> /* for bcopy, et.al. */ 65 #else 66 #define _XawTextActionsTable textActionsTable 67 #define _XawTextActionsTableCount textActionsTableCount 68 #endif 69 70 #define TITLE "xmail 1." /* program title and version string */ 71 #define StartPos 6 /* size of 'File: ' (del stop point) */ 72 #define LASTCH(s) (s[ *s ? strlen(s) - 1 : 0]) 73 #define CHARHEIGHT(X) (X->max_bounds.descent + X->max_bounds.ascent) 74 #define APPEND True /* used in writeTo function logic */ 75 #define REPLACE False 76 #define WATCH True /* used in SetCursor function logic */ 77 #define NORMAL False 78 79 #ifndef DEFAULT_MAILER 80 #ifndef linux 81 #define DEFAULT_MAILER "/usr/ucb/Mail" 82 #else 83 #define DEFAULT_MAILER "/bin/mail" 84 #endif 85 #endif 86 87 typedef struct { 88 XFontStruct *textFont; /* font to use when displaying text */ 89 XFontStruct *helpFont; /* font to use when displaying help */ 90 XFontStruct *buttonFont; /* font to use when making buttons */ 91 String iconGeometry; /* xmail icon geometry */ 92 String MFileName; /* mail option -f filename */ 93 String editorCommand; /* optional xmail send edit command */ 94 Dimension shellWidth; /* xmail window width */ 95 Dimension fileBoxWidth; /* file window box width */ 96 Dimension indexHeight; /* index window height */ 97 Dimension textHeight; /* text window height */ 98 Dimension buttonWidth; /* command button width */ 99 Dimension buttonHeight; /* command button height */ 100 Dimension commandHSpace; /* command horizontal spacing */ 101 Dimension commandVSpace; /* command vertical spacing */ 102 Dimension commandHeight; /* command window height */ 103 Dimension helpWidth; /* width of the help text popup */ 104 Dimension helpHeight; /* height of the help text popup */ 105 Dimension helpX; /* help x offset from textWindow */ 106 Dimension helpY; /* help y offset from textWindow */ 107 Dimension menuX; /* menu x offset from parent */ 108 Dimension menuY; /* menu y offset from parent */ 109 Boolean bellRing; /* xmail audible bell option */ 110 Boolean expert; /* do not confirm destructive acts */ 111 Boolean iconic; /* xmail starts in withdrawn state */ 112 Boolean mailopt_n; /* mail option -n */ 113 Boolean mailopt_U; /* mail option -U */ 114 Boolean Show_Last; /* xmail show latest option -ls */ 115 Boolean Show_Info; /* Do (or don't) show info messages */ 116 Boolean No_X_Hdr; /* don't show xface header option -nx */ 117 int borderWidth; /* default or specified border width */ 118 } XmailResources; 119 120 121 /* 122 ** structure sent to AddMenuButton() 123 */ 124 typedef struct menuList_str 125 { 126 String label; 127 XtCallbackProc func; 128 String data; 129 } menuList, *menuList_p; 130 131 /* 132 ** structure used by AddHelpText() and ShowHelp() 133 */ 134 typedef struct _helpText 135 { 136 String name; 137 AsciiSrcObject data; 138 struct _helpText *next; 139 } helpText; 140 141 142 typedef struct { 143 char *pat; /* regular expression */ 144 char *buf; /* buffer for compiled regexp */ 145 } PatternRec, *PatternRecPtr; 146 147 148 typedef struct { 149 char *name; /* recipient name */ 150 char *alias; /* alias for name */ 151 } AliasRec, *AliasRecPtr; 152