XmListDeletePos (list_w, cbs−>item_position);
/* it's a long way, but traverse to To: text field */
XmProcessTraversal (list_w, XmTRAVERSE_NEXT_TAB_GROUP);
}
/* send_it() −− callback for when user clicked on Send. Build
* a command line, use popen() to open pipe to mail command, send
* text data to it and then exit. The message is sent to all
* of the addresses that have been specified and are shown in the
* list.
*/
void
send_it(w, client_data, call_data)
Widget w;
XtPointer client_data;
XtPointer call_data;
{
Widget send_w;
XmAnyCallbackStruct *cbs = (XmAnyCallbackStruct *) call_data;
char *text, *subj, cmd[BUFSIZ], *p, *dummy, *getenv();
int n, i, status;
XmString *list;
FILE *pp, *popen();
if (w == text_w) {
send_w = (Widget) client_data;
XtCallActionProc (send_w, "ArmAndActivate", cbs−>event, NULL, 0);
return;
}
/* if something was left in the To: field, grab it */
text = XmTextGetString (to_w);
if (text != 0 && *text != 0) {
XmString str = XmStringCreateLocalized (text);
XmListAddItemUnselected (list_w, str, 0);
XmTextSetString (to_w, "");
XmStringFree (str);
XtFree (text);
}
/* Get the list of users entered */
XtVaGetValues (list_w,
XmNitems, &list,
XmNitemCount, &n,
NULL);
if (n == 0) {
static Widget dialog;
/* user goofed −− must provide at least one recipient */
if (!dialog) {
Arg args[5];
n = 0;
XtSetArg (args[n], XmNdialogStyle,
XmDIALOG_APPLICATION_MODAL); n++;
dialog = XmCreateErrorDialog (to_w, "error", args, n);
XtUnmanageChild (
XmMessageBoxGetChild (dialog, ...