git://git.exim.org
/
users
/
heiko
/
exim.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
kevent: handle OpenBSD API anomaly, redux
[users/heiko/exim.git]
/
src
/
exim_monitor
/
em_menu.c
diff --git
a/src/exim_monitor/em_menu.c
b/src/exim_monitor/em_menu.c
index 6deb909da5b6d44e2888770d25945678d7356eb4..7139bbf251514378027b65bc32ca0af430ad1334 100644
(file)
--- a/
src/exim_monitor/em_menu.c
+++ b/
src/exim_monitor/em_menu.c
@@
-2,7
+2,7
@@
* Exim Monitor *
*************************************************/
* Exim Monitor *
*************************************************/
-/* Copyright (c) University of Cambridge 1995 - 201
6
*/
+/* Copyright (c) University of Cambridge 1995 - 201
8
*/
/* See the file NOTICE for conditions of use and distribution. */
/* See the file NOTICE for conditions of use and distribution. */
@@
-115,10
+115,9
@@
static Arg item_99_arg[] = {
* Destroy the menu when popped down *
*************************************************/
* Destroy the menu when popped down *
*************************************************/
-static void popdownAction(Widget w, XtPointer client_data, XtPointer call_data)
+static void
+popdownAction(Widget w, XtPointer client_data, XtPointer call_data)
{
{
-client_data = client_data; /* Keep picky compilers happy */
-call_data = call_data;
if (highlighted_x >= 0)
XawTextSinkDisplayText(queue_text_sink,
highlighted_x, highlighted_y,
if (highlighted_x >= 0)
XawTextSinkDisplayText(queue_text_sink,
highlighted_x, highlighted_y,
@@
-136,17
+135,13
@@
menu_is_up = FALSE;
static void
msglogAction(Widget w, XtPointer client_data, XtPointer call_data)
{
static void
msglogAction(Widget w, XtPointer client_data, XtPointer call_data)
{
-int i;
Widget text = text_create(US client_data, text_depth);
uschar * fname = NULL;
FILE * f = NULL;
Widget text = text_create(US client_data, text_depth);
uschar * fname = NULL;
FILE * f = NULL;
-w = w; /* Keep picky compilers happy */
-call_data = call_data;
-
/* End up with the split version, so message looks right when non-exist */
/* End up with the split version, so message looks right when non-exist */
-for (i = 0; i < (spool_is_split ? 2:1); i++)
+for (i
nt i
= 0; i < (spool_is_split ? 2:1); i++)
{
message_subdir[0] = i != 0 ? (US client_data)[5] : 0;
fname = spool_fname(US"msglog", message_subdir, US client_data, US"");
{
message_subdir[0] = i != 0 ? (US client_data)[5] : 0;
fname = spool_fname(US"msglog", message_subdir, US client_data, US"");
@@
-173,23
+168,19
@@
else
static void
bodyAction(Widget w, XtPointer client_data, XtPointer call_data)
{
static void
bodyAction(Widget w, XtPointer client_data, XtPointer call_data)
{
-int i;
-Widget text = text_create((uschar *)client_data, text_depth);
+Widget text = text_create(US client_data, text_depth);
FILE *f = NULL;
FILE *f = NULL;
-w = w; /* Keep picky compilers happy */
-call_data = call_data;
-
-for (i = 0; i < (spool_is_split? 2:1); i++)
+for (int i = 0; i < (spool_is_split? 2:1); i++)
{
uschar * fname;
{
uschar * fname;
- message_subdir[0] = i != 0 ? (
(uschar *)
client_data)[5] : 0;
+ message_subdir[0] = i != 0 ? (
US
client_data)[5] : 0;
fname = spool_fname(US"input", message_subdir, US client_data, US"-D");
if ((f = fopen(CS fname, "r")))
break;
}
fname = spool_fname(US"input", message_subdir, US client_data, US"-D");
if ((f = fopen(CS fname, "r")))
break;
}
-if (
f == NULL
)
+if (
!f
)
text_showf(text, "Failed to open file: %s\n", strerror(errno));
else
{
text_showf(text, "Failed to open file: %s\n", strerror(errno));
else
{
@@
-221,7
+212,8
@@
unless action_output is set. We can't, however, tell until we have run
the command whether we want the output or not, so the pipe has to be set up in
all cases. */
the command whether we want the output or not, so the pipe has to be set up in
all cases. */
-static void ActOnMessage(uschar *id, uschar *action, uschar *address_arg)
+static void
+ActOnMessage(uschar *id, uschar *action, uschar *address_arg)
{
int pid;
int pipe_fd[2];
{
int pid;
int pipe_fd[2];
@@
-334,9
+326,9
@@
if (!delivery)
if (rc == 0 && Ustrcmp(action + Ustrlen(action) - 4, "-Mes") == 0)
{
queue_item *q = find_queue(id, queue_noop, 0);
if (rc == 0 && Ustrcmp(action + Ustrlen(action) - 4, "-Mes") == 0)
{
queue_item *q = find_queue(id, queue_noop, 0);
- if (q
!= NULL
)
+ if (q)
{
{
- if (q->sender
!= NULL
) store_free(q->sender);
+ if (q->sender) store_free(q->sender);
q->sender = store_malloc(Ustrlen(address_arg) + 1);
Ustrcpy(q->sender, address_arg);
}
q->sender = store_malloc(Ustrlen(address_arg) + 1);
Ustrcpy(q->sender, address_arg);
}
@@
-407,41
+399,32
@@
if (pid < 0) text_showf(text, "Failed to fork: %s\n", strerror(errno)); else
* Cause a message to be delivered *
*************************************************/
* Cause a message to be delivered *
*************************************************/
-static void deliverAction(Widget w, XtPointer client_data, XtPointer call_data)
+static void
+deliverAction(Widget w, XtPointer client_data, XtPointer call_data)
{
{
-w = w; /* Keep picky compilers happy */
-call_data = call_data;
-ActOnMessage((uschar *)client_data, US"-v -M", US"");
+ActOnMessage(US client_data, US"-v -M", US"");
}
}
-
-
/*************************************************
* Cause a message to be Frozen *
*************************************************/
/*************************************************
* Cause a message to be Frozen *
*************************************************/
-static void freezeAction(Widget w, XtPointer client_data, XtPointer call_data)
+static void
+freezeAction(Widget w, XtPointer client_data, XtPointer call_data)
{
{
-w = w; /* Keep picky compilers happy */
-call_data = call_data;
-ActOnMessage((uschar *)client_data, US"-Mf", US"");
+ActOnMessage(US client_data, US"-Mf", US"");
}
}
-
-
/*************************************************
* Cause a message to be thawed *
*************************************************/
/*************************************************
* Cause a message to be thawed *
*************************************************/
-static void thawAction(Widget w, XtPointer client_data, XtPointer call_data)
+static void
+thawAction(Widget w, XtPointer client_data, XtPointer call_data)
{
{
-w = w; /* Keep picky compilers happy */
-call_data = call_data;
-ActOnMessage((uschar *)client_data, US"-Mt", US"");
+ActOnMessage(US client_data, US"-Mt", US"");
}
}
-
-
/*************************************************
* Take action using dialog data *
*************************************************/
/*************************************************
* Take action using dialog data *
*************************************************/
@@
-450,25
+433,19
@@
ActOnMessage((uschar *)client_data, US"-Mt", US"");
in. It is global because it is set up in the action table at
start-up time. If the string is empty, do nothing. */
in. It is global because it is set up in the action table at
start-up time. If the string is empty, do nothing. */
-XtActionProc dialogAction(Widget w, XEvent *event, String *ss, Cardinal *c)
+XtActionProc
+dialogAction(Widget w, XEvent *event, String *ss, Cardinal *c)
{
uschar *s = US XawDialogGetValueString(dialog_widget);
{
uschar *s = US XawDialogGetValueString(dialog_widget);
-w = w; /* Keep picky compilers happy */
-event = event;
-ss = ss;
-c = c;
-
XtPopdown((Widget)dialog_shell);
XtDestroyWidget((Widget)dialog_shell);
while (isspace(*s)) s++;
if (s[0] != 0)
XtPopdown((Widget)dialog_shell);
XtDestroyWidget((Widget)dialog_shell);
while (isspace(*s)) s++;
if (s[0] != 0)
- {
if (actioned_message[0] != 0)
ActOnMessage(actioned_message, action_required, s);
else
NonMessageDialogue(s); /* When called from somewhere else */
if (actioned_message[0] != 0)
ActOnMessage(actioned_message, action_required, s);
else
NonMessageDialogue(s); /* When called from somewhere else */
- }
return NULL;
}
return NULL;
}
@@
-482,7
+459,8
@@
return NULL;
be done to the application until the box is filled in. This
function is also used by the Hide button handler. */
be done to the application until the box is filled in. This
function is also used by the Hide button handler. */
-void create_dialog(uschar *label, uschar *value)
+void
+create_dialog(uschar *label, uschar *value)
{
Arg warg[4];
Dimension x, y, xx, yy;
{
Arg warg[4];
Dimension x, y, xx, yy;
@@
-544,9
+522,6
@@
XFlush(X_display);
}
}
-
-
-
/*************************************************
* Cause a recipient to be added *
*************************************************/
/*************************************************
* Cause a recipient to be added *
*************************************************/
@@
-554,10
+529,9
@@
XFlush(X_display);
/* This just sets up the dialog box; the action happens when it has been filled
in. */
/* This just sets up the dialog box; the action happens when it has been filled
in. */
-static void addrecipAction(Widget w, XtPointer client_data, XtPointer call_data)
+static void
+addrecipAction(Widget w, XtPointer client_data, XtPointer call_data)
{
{
-w = w; /* Keep picky compilers happy */
-call_data = call_data;
Ustrncpy(actioned_message, client_data, 24);
actioned_message[23] = '\0';
action_required = US"-Mar";
Ustrncpy(actioned_message, client_data, 24);
actioned_message[23] = '\0';
action_required = US"-Mar";
@@
-565,16
+539,13
@@
dialog_ref_widget = menushell;
create_dialog(US"Recipient address to add?", US"");
}
create_dialog(US"Recipient address to add?", US"");
}
-
-
/*************************************************
* Cause an address to be marked delivered *
*************************************************/
/*************************************************
* Cause an address to be marked delivered *
*************************************************/
-static void markdelAction(Widget w, XtPointer client_data, XtPointer call_data)
+static void
+markdelAction(Widget w, XtPointer client_data, XtPointer call_data)
{
{
-w = w; /* Keep picky compilers happy */
-call_data = call_data;
Ustrncpy(actioned_message, client_data, 24);
actioned_message[23] = '\0';
action_required = US"-Mmd";
Ustrncpy(actioned_message, client_data, 24);
actioned_message[23] = '\0';
action_required = US"-Mmd";
@@
-582,30
+553,26
@@
dialog_ref_widget = menushell;
create_dialog(US"Recipient address to mark delivered?", US"");
}
create_dialog(US"Recipient address to mark delivered?", US"");
}
-
/*************************************************
* Cause all addresses to be marked delivered *
*************************************************/
/*************************************************
* Cause all addresses to be marked delivered *
*************************************************/
-static void markalldelAction(Widget w, XtPointer client_data, XtPointer call_data)
+static void
+markalldelAction(Widget w, XtPointer client_data, XtPointer call_data)
{
{
-w = w; /* Keep picky compilers happy */
-call_data = call_data;
ActOnMessage(US client_data, US"-Mmad", US"");
}
ActOnMessage(US client_data, US"-Mmad", US"");
}
-
/*************************************************
* Edit the message's sender *
*************************************************/
/*************************************************
* Edit the message's sender *
*************************************************/
-static void
editsenderAction(Widget w, XtPointer client_data,
-
XtPointer call_data)
+static void
+
editsenderAction(Widget w, XtPointer client_data,
XtPointer call_data)
{
queue_item *q;
uschar *sender;
{
queue_item *q;
uschar *sender;
-w = w; /* Keep picky compilers happy */
-call_data = call_data;
+
Ustrncpy(actioned_message, client_data, 24);
actioned_message[23] = '\0';
q = find_queue(actioned_message, queue_noop, 0);
Ustrncpy(actioned_message, client_data, 24);
actioned_message[23] = '\0';
q = find_queue(actioned_message, queue_noop, 0);
@@
-615,53
+582,43
@@
dialog_ref_widget = menushell;
create_dialog(US"New sender address?", sender);
}
create_dialog(US"New sender address?", sender);
}
-
/*************************************************
* Cause a message to be returned to sender *
*************************************************/
/*************************************************
* Cause a message to be returned to sender *
*************************************************/
-static void giveupAction(Widget w, XtPointer client_data, XtPointer call_data)
+static void
+giveupAction(Widget w, XtPointer client_data, XtPointer call_data)
{
{
-w = w; /* Keep picky compilers happy */
-call_data = call_data;
-ActOnMessage((uschar *)client_data, US"-v -Mg", US"");
+ActOnMessage(US client_data, US"-v -Mg", US"");
}
}
-
-
/*************************************************
* Cause a message to be cancelled *
*************************************************/
/*************************************************
* Cause a message to be cancelled *
*************************************************/
-static void removeAction(Widget w, XtPointer client_data, XtPointer call_data)
+static void
+removeAction(Widget w, XtPointer client_data, XtPointer call_data)
{
{
-w = w; /* Keep picky compilers happy */
-call_data = call_data;
-ActOnMessage((uschar *)client_data, US"-Mrm", US"");
+ActOnMessage(US client_data, US"-Mrm", US"");
}
}
-
-
/*************************************************
* Display a message's headers *
*************************************************/
/*************************************************
* Display a message's headers *
*************************************************/
-static void headersAction(Widget w, XtPointer client_data, XtPointer call_data)
+static void
+headersAction(Widget w, XtPointer client_data, XtPointer call_data)
{
uschar buffer[256];
{
uschar buffer[256];
-header_line *h, *next;
-Widget text = text_create((uschar *)client_data, text_depth);
-void *reset_point;
-
-w = w; /* Keep picky compilers happy */
-call_data = call_data;
+Widget text = text_create(US client_data, text_depth);
+rmark reset_point;
/* Remember the point in the dynamic store so we can recover to it afterwards.
Then use Exim's function to read the header. */
/* Remember the point in the dynamic store so we can recover to it afterwards.
Then use Exim's function to read the header. */
-reset_point = store_
get(0
);
+reset_point = store_
mark(
);
-sprintf(CS buffer, "%s-H",
(uschar *)
client_data);
+sprintf(CS buffer, "%s-H",
US
client_data);
if (spool_read_header(buffer, TRUE, FALSE) != spool_read_OK)
{
if (errno == ERRNO_SPOOLFORMAT)
if (spool_read_header(buffer, TRUE, FALSE) != spool_read_OK)
{
if (errno == ERRNO_SPOOLFORMAT)
@@
-669,8
+626,8
@@
if (spool_read_header(buffer, TRUE, FALSE) != spool_read_OK)
struct stat statbuf;
sprintf(CS big_buffer, "%s/input/%s", spool_directory, buffer);
if (Ustat(big_buffer, &statbuf) == 0)
struct stat statbuf;
sprintf(CS big_buffer, "%s/input/%s", spool_directory, buffer);
if (Ustat(big_buffer, &statbuf) == 0)
- text_showf(text, "Format error in spool file %s: size=%
d
\n", buffer,
- statbuf.st_size);
+ text_showf(text, "Format error in spool file %s: size=%
lu
\n", buffer,
+
(unsigned long)
statbuf.st_size);
else text_showf(text, "Format error in spool file %s\n", buffer);
}
else text_showf(text, "Read error for spool file %s\n", buffer);
else text_showf(text, "Format error in spool file %s\n", buffer);
}
else text_showf(text, "Read error for spool file %s\n", buffer);
@@
-678,26
+635,22
@@
if (spool_read_header(buffer, TRUE, FALSE) != spool_read_OK)
return;
}
return;
}
-if (sender_address != NULL)
- {
- text_showf(text, "%s sender: <%s>\n", sender_local? "Local" : "Remote",
+if (sender_address)
+ text_showf(text, "%s sender: <%s>\n", f.sender_local ? "Local" : "Remote",
sender_address);
sender_address);
- }
-if (recipients_list
!= NULL
)
+if (recipients_list)
{
{
- int i;
text_show(text, US"Recipients:\n");
text_show(text, US"Recipients:\n");
- for (i = 0; i < recipients_count; i++)
- {
+ for (int i = 0; i < recipients_count; i++)
text_showf(text, " %s %s\n",
text_showf(text, " %s %s\n",
- (tree_search(tree_nonrecipients, recipients_list[i].address) == NULL)?
- " ":"*", recipients_list[i].address);
- }
+ tree_search(tree_nonrecipients, recipients_list[i].address)
+ ? "*" : " ",
+ recipients_list[i].address);
text_show(text, US"\n");
}
text_show(text, US"\n");
}
-for (h
= header_list; h != NULL
; h = next)
+for (h
eader_line * next, * h = header_list; h
; h = next)
{
next = h->next;
text_showf(text, "%c ", h->type); /* Don't push h->text through a %s */
{
next = h->next;
text_showf(text, "%c ", h->type); /* Don't push h->text through a %s */
@@
-707,20
+660,13
@@
for (h = header_list; h != NULL; h = next)
store_reset(reset_point);
}
store_reset(reset_point);
}
-
-
-
/*************************************************
* Dismiss a text window *
*************************************************/
/*************************************************
* Dismiss a text window *
*************************************************/
-static void dismissAction(Widget w, XtPointer client_data, XtPointer call_data)
+static void
+dismissAction(Widget w, XtPointer client_data, XtPointer call_data)
{
{
-pipe_item *p = pipe_chain;
-
-w = w; /* Keep picky compilers happy */
-call_data = call_data;
-
XtPopdown((Widget)client_data);
XtDestroyWidget((Widget)client_data);
XtPopdown((Widget)client_data);
XtDestroyWidget((Widget)client_data);
@@
-729,16
+675,9
@@
the chain so that subsequent data doesn't try to use it. We have
to search the parents of the saved widget to see if one of them
is what we have just destroyed. */
to search the parents of the saved widget to see if one of them
is what we have just destroyed. */
-while (p != NULL)
- {
- Widget pp = p->widget;
- while (pp != NULL)
- {
+for (pipe_item * p = pipe_chain; p; p = p->next)
+ for (Widget pp = p->widget; pp; pp = XtParent(pp))
if (pp == (Widget)client_data) { p->widget = NULL; return; }
if (pp == (Widget)client_data) { p->widget = NULL; return; }
- pp = XtParent(pp);
- }
- p = p->next;
- }
}
}
@@
-747,7
+686,8
@@
while (p != NULL)
* Set up popup text window *
*************************************************/
* Set up popup text window *
*************************************************/
-static Widget text_create(uschar *name, int height)
+static Widget
+text_create(uschar *name, int height)
{
Widget textshell, form, text, button;
{
Widget textshell, form, text, button;
@@
-798,9
+738,6
@@
XtPopup(textshell, XtGrabNone);
return text;
}
return text;
}
-
-
-
/*************************************************
* Set up menu in queue window *
*************************************************/
/*************************************************
* Set up menu in queue window *
*************************************************/
@@
-808,7
+745,8
@@
return text;
/* We have added an action table that causes this function to
be called, and set up button 2 in the text widgets to call it. */
/* We have added an action table that causes this function to
be called, and set up button 2 in the text widgets to call it. */
-void menu_create(Widget w, XEvent *event, String *actargs, Cardinal *count)
+void
+menu_create(Widget w, XEvent *event, String *actargs, Cardinal *count)
{
int line;
int i;
{
int line;
int i;
@@
-824,9
+762,6
@@
XtTranslations menu_trans = XtParseTranslationTable(
<BtnUp>: MenuPopdown()notify()unhighlight()\n\
");
<BtnUp>: MenuPopdown()notify()unhighlight()\n\
");
-actargs = actargs; /* Keep picky compilers happy */
-count = count;
-
/* Get the sink and source and the current text pointer */
queue_get_arg[0].value = (XtArgVal)(&queue_text_sink);
/* Get the sink and source and the current text pointer */
queue_get_arg[0].value = (XtArgVal)(&queue_text_sink);