debian/rules: Use `git' potty wrapper.
[qmail] / trigger.c
CommitLineData
2117e02e
MW
1#include "select.h"
2#include "open.h"
3#include "trigger.h"
4#include "hasnpbg1.h"
5
6static int fd = -1;
7#ifdef HASNAMEDPIPEBUG1
8static int fdw = -1;
9#endif
10
11void trigger_set()
12{
13 if (fd != -1)
14 close(fd);
15#ifdef HASNAMEDPIPEBUG1
16 if (fdw != -1)
17 close(fdw);
18#endif
19 fd = open_read("lock/trigger");
20#ifdef HASNAMEDPIPEBUG1
21 fdw = open_write("lock/trigger");
22#endif
23}
24
25void trigger_selprep(nfds,rfds)
26int *nfds;
27fd_set *rfds;
28{
29 if (fd != -1)
30 {
31 FD_SET(fd,rfds);
32 if (*nfds < fd + 1) *nfds = fd + 1;
33 }
34}
35
36int trigger_pulled(rfds)
37fd_set *rfds;
38{
39 if (fd != -1) if (FD_ISSET(fd,rfds)) return 1;
40 return 0;
41}