X-Git-Url: http://git.marmaro.de/?a=blobdiff_plain;f=sbr%2Fext_hook.c;h=771d5589cc86b615f5c2b18152f3b64d3de6767f;hb=ca1023716d4c2ab890696f3e41fa0d94267a940e;hp=5ff9394971d6545ade422dcf6b92a965b0eef623;hpb=a485ed478abbd599d8c9aab48934e7a26733ecb1;p=mmh diff --git a/sbr/ext_hook.c b/sbr/ext_hook.c index 5ff9394..771d558 100644 --- a/sbr/ext_hook.c +++ b/sbr/ext_hook.c @@ -1,11 +1,11 @@ /* - * 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 - * something goes wrong; there is a built-in message in case one isn't specified. - * Only produce the error message once. - */ +** 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 +** something goes wrong; there is a built-in message in case one isn't +** specified. Only produce the error message once. +*/ #include @@ -19,20 +19,20 @@ ext_hook(char *hook_name, char *message_file_name_1, char *message_file_name_2) static int did_message = 0; /* set if we've already output a message */ - if ((hook = context_find(hook_name)) == (char *)0) + if ((hook = context_find(hook_name)) == NULL) return (OK); - switch (pid = vfork()) { + switch (pid = fork()) { case -1: status = NOTOK; advise(NULL, "external database may be out-of-date."); break; case 0: - vec[0] = r1bindex(hook, '/'); + vec[0] = mhbasename(hook); vec[1] = message_file_name_1; vec[2] = message_file_name_2; - vec[3] = (char *)0; + vec[3] = NULL; execvp(hook, vec); _exit(-1); /* NOTREACHED */ @@ -44,7 +44,7 @@ ext_hook(char *hook_name, char *message_file_name_1, char *message_file_name_2) if (status != OK) { if (did_message == 0) { - if ((hook = context_find("msg-hook")) != (char *)0) + if ((hook = context_find("msg-hook")) != NULL) advise(NULL, hook); else advise(NULL, "external hook (%s) did not work properly.", hook); @@ -53,8 +53,6 @@ ext_hook(char *hook_name, char *message_file_name_1, char *message_file_name_2) } return (NOTOK); - } - - else + } else return (OK); }