Back to index

courier  0.68.2
comtrigger.c
Go to the documentation of this file.
00001 /*
00002 ** Copyright 1998 - 2006 Double Precision, Inc.
00003 ** See COPYING for distribution information.
00004 */
00005 
00006 #include      "courier.h"
00007 #include      "localstatedir.h"
00008 #include      <string.h>
00009 #if    HAVE_UNISTD_H
00010 #include      <unistd.h>
00011 #endif
00012 #if    HAVE_FCNTL_H
00013 #include      <fcntl.h>
00014 #endif
00015 #include      <stdlib.h>
00016 
00017 int trigger_open(int mode)
00018 {
00019 int    fd;
00020 
00021        fd=open(TMPDIR "/trigger", mode);
00022        return (fd);
00023 }
00024 
00025 void trigger(const char *command)
00026 {
00027 int    fd=trigger_open(O_WRONLY | O_NDELAY);
00028 
00029        if (fd >= 0)
00030        {
00031               if (write( fd, command, strlen(command)))
00032                      ; /* ignore */
00033               close(fd);
00034        }
00035 }