diff options
author | Pav Lucistnik <pav@FreeBSD.org> | 2004-05-23 16:29:27 +0000 |
---|---|---|
committer | Pav Lucistnik <pav@FreeBSD.org> | 2004-05-23 16:29:27 +0000 |
commit | 85dafff40303a63c70b0325c67b4bb8120cc2e4d (patch) | |
tree | b610cc2996aa86ec539a7968db45baad99e9abf9 /sysutils | |
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>
Diffstat (limited to 'sysutils')
-rw-r--r-- | sysutils/Makefile | 1 | ||||
-rw-r--r-- | sysutils/fileschanged/Makefile | 34 | ||||
-rw-r--r-- | sysutils/fileschanged/distinfo | 2 | ||||
-rw-r--r-- | sysutils/fileschanged/files/patch-configure | 11 | ||||
-rw-r--r-- | sysutils/fileschanged/files/patch-filelist.c | 33 | ||||
-rw-r--r-- | sysutils/fileschanged/files/patch-handlers.c | 32 | ||||
-rw-r--r-- | sysutils/fileschanged/files/patch-monitor.c | 12 | ||||
-rw-r--r-- | sysutils/fileschanged/files/patch-opts.c | 28 | ||||
-rw-r--r-- | sysutils/fileschanged/files/patch-opts.h | 10 | ||||
-rw-r--r-- | sysutils/fileschanged/pkg-descr | 7 | ||||
-rw-r--r-- | sysutils/fileschanged/pkg-message | 9 |
11 files changed, 179 insertions, 0 deletions
diff --git a/sysutils/Makefile b/sysutils/Makefile index 1ea462ba59db..d2418bcbb840 100644 --- a/sysutils/Makefile +++ b/sysutils/Makefile @@ -115,6 +115,7 @@ SUBDIR += filedupe SUBDIR += filelight SUBDIR += fileprune + SUBDIR += fileschanged SUBDIR += finfo SUBDIR += flasher SUBDIR += flexbackup diff --git a/sysutils/fileschanged/Makefile b/sysutils/fileschanged/Makefile new file mode 100644 index 000000000000..e52b91f07448 --- /dev/null +++ b/sysutils/fileschanged/Makefile @@ -0,0 +1,34 @@ +# New ports collection makefile for: fileschanged +# Date created: 18 May 2004 +# Whom: Konstantin Reznichenko <kot@premierbank.dp.ua> +# +# $FreeBSD$ +# + +PORTNAME= fileschanged +PORTVERSION= 0.6.0 +CATEGORIES= sysutils +MASTER_SITES= ${MASTER_SITE_SOURCEFORGE} +MASTER_SITE_SUBDIR= ${PORTNAME} + +MAINTAINER= kot@premierbank.dp.ua +COMMENT= Utility that reports when files have been altered + +LIB_DEPENDS= fam.0:${PORTSDIR}/devel/fam +BUILD_DEPENDS= ${LOCALBASE}/include/argp.h:${PORTSDIR}/devel/argp-standalone \ + help2man:${PORTSDIR}/misc/help2man + +GNU_CONFIGURE= yes +USE_GMAKE= yes +CONFIGURE_ENV= CPPFLAGS="-I${LOCALBASE}/include" LDFLAGS="-L${LOCALBASE}/lib" \ + LIBS="-largp" + +INFO= fileschanged +MAN1= fileschanged.1 +PORTDOCS= AUTHORS COPYING ChangeLog INSTALL NEWS README fileschanged.lsm +PLIST_FILES= bin/fileschanged + +post-install: + @${CAT} ${PKGMESSAGE} + +.include <bsd.port.mk> diff --git a/sysutils/fileschanged/distinfo b/sysutils/fileschanged/distinfo new file mode 100644 index 000000000000..c3c3f80cbe44 --- /dev/null +++ b/sysutils/fileschanged/distinfo @@ -0,0 +1,2 @@ +MD5 (fileschanged-0.6.0.tar.gz) = 78f652c17190017080eb985804d62013 +SIZE (fileschanged-0.6.0.tar.gz) = 188377 diff --git a/sysutils/fileschanged/files/patch-configure b/sysutils/fileschanged/files/patch-configure new file mode 100644 index 000000000000..b6c51787ae0c --- /dev/null +++ b/sysutils/fileschanged/files/patch-configure @@ -0,0 +1,11 @@ +--- configure.orig Mon Feb 23 02:18:08 2004 ++++ configure Tue May 18 15:08:38 2004 +@@ -341,7 +341,7 @@ + bindir='${exec_prefix}/bin' + sbindir='${exec_prefix}/sbin' + libexecdir='${exec_prefix}/libexec' +-datadir='${prefix}/share' ++datadir='${prefix}/share/doc' + sysconfdir='${prefix}/etc' + sharedstatedir='${prefix}/com' + localstatedir='${prefix}/var' diff --git a/sysutils/fileschanged/files/patch-filelist.c b/sysutils/fileschanged/files/patch-filelist.c new file mode 100644 index 000000000000..22f662c13bb6 --- /dev/null +++ b/sysutils/fileschanged/files/patch-filelist.c @@ -0,0 +1,33 @@ +--- src/filelist.c.orig Mon Feb 23 02:17:30 2004 ++++ src/filelist.c Wed May 19 18:30:04 2004 +@@ -12,6 +12,30 @@ + #include "opts.h" + #include "listdirs.h" + extern struct arguments_t arguments; ++#if defined(__FreeBSD__) ++ssize_t getline(char **lineptr, size_t *n, FILE *stream) ++{ ++ char *line; ++ size_t len; ++ ++ line = fgetln(stream, &len); ++ if (!line) ++ return -1; ++ if (len >= *n) { ++ char *tmp; ++ ++ /* XXX some realloc() implementations don't set errno */ ++ tmp = realloc(*lineptr, len + 1); ++ if (!tmp) ++ return -1; ++ *lineptr = tmp; ++ *n = len + 1; ++ } ++ memcpy(*lineptr, line, len); ++ (*lineptr)[len] = 0; ++ return len; ++} ++#endif + int for_every_filename(int (*for_every_file)(int (*)(void *, char *), void *list), int (*add_it_to_the)(void *list, char *filename), void *list) + { + for_every_file(add_it_to_the, list); 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) diff --git a/sysutils/fileschanged/files/patch-monitor.c b/sysutils/fileschanged/files/patch-monitor.c new file mode 100644 index 000000000000..fc33c2a7995c --- /dev/null +++ b/sysutils/fileschanged/files/patch-monitor.c @@ -0,0 +1,12 @@ +--- src/monitor.c.orig Mon Feb 23 02:17:30 2004 ++++ src/monitor.c Wed May 19 18:30:54 2004 +@@ -2,7 +2,9 @@ + #include <stdio.h> + #include <string.h> + #include <stdlib.h> ++#if !defined(__FreeBSD__) + #include <sys/select.h> ++#endif + #include <sys/types.h> + #include <sys/stat.h> + #include <time.h> diff --git a/sysutils/fileschanged/files/patch-opts.c b/sysutils/fileschanged/files/patch-opts.c new file mode 100644 index 000000000000..f2ee24633b09 --- /dev/null +++ b/sysutils/fileschanged/files/patch-opts.c @@ -0,0 +1,28 @@ +--- src/opts.c.orig Mon Feb 23 01:17:30 2004 ++++ src/opts.c Sun May 23 17:52:10 2004 +@@ -19,6 +19,7 @@ + const char filelist_option_explanation[]="Monitor the list of filenames inside FILE"; + const char filechangetimeout_option_explanation[]="Delay showing changed files for N seconds (Def=2)"; + const char showaction_option_explanation[]="Also display action when displaying altered files"; ++const char execcmd_option_explanation[]="Execute COMMAND when file altered (COMMAND action filename)"; + + struct arguments_t arguments; + static struct argp_option options[] = +@@ -34,6 +35,7 @@ + {"filelist", 'l',"FILENAME",0, filelist_option_explanation, 3}, + {"timeout", 't',"N",0, filechangetimeout_option_explanation, 4}, + {"prepend-action", 'p',0,0, showaction_option_explanation, 5}, ++ {"execcmd", 'x',"COMMAND",0, execcmd_option_explanation, 6}, + { 0 } + }; + +@@ -93,6 +95,9 @@ + arguments->fileschanged.filechangetimeout=atoi(arg); + if (arguments->fileschanged.filechangetimeout<=1) + arguments->fileschanged.filechangetimeout=-1; ++ break; ++ case 'x': ++ arguments->fileschanged.exec_command=strdup(arg); + break; + case ARGP_KEY_INIT: + free_arguments(); diff --git a/sysutils/fileschanged/files/patch-opts.h b/sysutils/fileschanged/files/patch-opts.h new file mode 100644 index 000000000000..7daaf7d5fe20 --- /dev/null +++ b/sysutils/fileschanged/files/patch-opts.h @@ -0,0 +1,10 @@ +--- src/opts.h.orig Mon Feb 23 01:17:30 2004 ++++ src/opts.h Sun May 23 17:53:00 2004 +@@ -17,6 +17,7 @@ + int filestomonitor; + int filechangetimeout; + int showaction; ++ char *exec_command; + }; + struct arguments_t { + char **args; diff --git a/sysutils/fileschanged/pkg-descr b/sysutils/fileschanged/pkg-descr new file mode 100644 index 000000000000..3360e730d061 --- /dev/null +++ b/sysutils/fileschanged/pkg-descr @@ -0,0 +1,7 @@ +The fileschanged utility is a client to the FAM (File Alteration Monitor) +server that is now available in some distributions. 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. + +WWW: http://fileschanged.sourceforge.net/ diff --git a/sysutils/fileschanged/pkg-message b/sysutils/fileschanged/pkg-message new file mode 100644 index 000000000000..3175f7d6a8b1 --- /dev/null +++ b/sysutils/fileschanged/pkg-message @@ -0,0 +1,9 @@ +************************************************************************ + + For correct work of FILESCHANGED, you must configure File Alteration + Monitor (/usr/ports/devel/fam) + + Read /usr/ports/devel/fam/pkg-message or run: + pkg_info -Dx fam | more + +************************************************************************ |