X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/a5b2adde414330e1661db05d1ee5b1daeaa2476d..af32d40a8ca0b341c082066b2f1e3e83005c1a89:/sbr/ext_hook.c diff --git a/sbr/ext_hook.c b/sbr/ext_hook.c index ac88ac7b..106114f8 100644 --- a/sbr/ext_hook.c +++ b/sbr/ext_hook.c @@ -1,6 +1,4 @@ -/* - * - * Run a program that hooks into some other system. The first argument is +/* Run a program that hooks into some other system. The first argument is * name of the hook to use, the second is the full path name of a mail message. * The third argument is also the full path name of a mail message, or a NULL * pointer if it isn't needed. Look in the context for an error message if @@ -8,7 +6,11 @@ * Only produce the error message once. */ -#include +#include "h/mh.h" +#include "context_find.h" +#include "pidstatus.h" +#include "arglist.h" +#include "error.h" int ext_hook(char *hook_name, char *message_file_name_1, char *message_file_name_2) @@ -20,7 +22,7 @@ ext_hook(char *hook_name, char *message_file_name_1, char *message_file_name_2) int vecp; /* Vector index */ char *program; /* Name of program to execute */ - static int did_message = 0; /* set if we've already output a message */ + static bool did_message; /* set if we've already output a message */ if ((hook = context_find(hook_name)) == NULL) return OK; @@ -49,7 +51,7 @@ ext_hook(char *hook_name, char *message_file_name_1, char *message_file_name_2) if (status == OK) return OK; - if (did_message == 0) { + if (!did_message) { char *msghook; if ((msghook = context_find("msg-hook")) != NULL) inform("%s", msghook); @@ -58,7 +60,7 @@ ext_hook(char *hook_name, char *message_file_name_1, char *message_file_name_2) snprintf(errbuf, sizeof(errbuf), "external hook \"%s\"", hook); pidstatus(status, stderr, errbuf); } - did_message = 1; + did_message = true; } return NOTOK;