summaryrefslogtreecommitdiff
path: root/sysutils/fileschanged/files/patch-handlers.c
diff options
context:
space:
mode:
authorPav Lucistnik <pav@FreeBSD.org>2004-05-23 16:29:27 +0000
committerPav Lucistnik <pav@FreeBSD.org>2004-05-23 16:29:27 +0000
commit85dafff40303a63c70b0325c67b4bb8120cc2e4d (patch)
treeb610cc2996aa86ec539a7968db45baad99e9abf9 /sysutils/fileschanged/files/patch-handlers.c
parent- Unmark BROKEN, it's fetchable again (diff)
Add fileschanged, a client to the FAM (File Alteration Monitor) server.
Here's how the fileschanged FAM client works: you give it some filenames on the command line and then it monitors those files for changes. When it discovers that a file has changed (or has been altered), it displays the filename on the standard-output. PR: ports/66894 Submitted by: Konstantin Reznichenko <kot@premierbank.dp.ua>
Notes
Notes: svn path=/head/; revision=109792
Diffstat (limited to '')
-rw-r--r--sysutils/fileschanged/files/patch-handlers.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/sysutils/fileschanged/files/patch-handlers.c b/sysutils/fileschanged/files/patch-handlers.c
new file mode 100644
index 000000000000..6a85acfd3fca
--- /dev/null
+++ b/sysutils/fileschanged/files/patch-handlers.c
@@ -0,0 +1,32 @@
+--- src/handlers.c.orig Mon Feb 23 01:42:46 2004
++++ src/handlers.c Sun May 23 17:50:35 2004
+@@ -7,6 +7,10 @@
+ #include "node.h"
+ #include "opts.h"
+ #include "wl.h"
++#if defined(__FreeBSD__)
++#include "libgen.h"
++#endif
++
+ extern struct arguments_t arguments;
+ struct handler_t handlers[FC_HANDLER_MAX]=
+ {
+@@ -180,12 +184,18 @@
+ }
+ void show_event(enum handler_enum_t id, char *filename)
+ {
++ if (arguments.fileschanged.exec_command == NULL) {
+ if (arguments.fileschanged.showaction)
+ {
+ fprintf(stdout, "%s ", handlers[id].name);
+ }
+ fprintf(stdout, "%s\n",filename);
+ fflush(stdout);
++ } else {
++ if (!fork()) {
++ execlp(arguments.fileschanged.exec_command, arguments.fileschanged.exec_command, handlers[id].name, filename, NULL);
++ }
++ }
+ return;
+ }
+ int handle_created_file(FAMConnection *c, void *list, enum handler_enum_t id, char *filename)