mirror of
https://git.FreeBSD.org/ports.git
synced 2025-01-27 10:03:20 +00:00
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>
This commit is contained in:
parent
3d01474b04
commit
85dafff403
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=109792
@ -115,6 +115,7 @@
|
||||
SUBDIR += filedupe
|
||||
SUBDIR += filelight
|
||||
SUBDIR += fileprune
|
||||
SUBDIR += fileschanged
|
||||
SUBDIR += finfo
|
||||
SUBDIR += flasher
|
||||
SUBDIR += flexbackup
|
||||
|
34
sysutils/fileschanged/Makefile
Normal file
34
sysutils/fileschanged/Makefile
Normal file
@ -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>
|
2
sysutils/fileschanged/distinfo
Normal file
2
sysutils/fileschanged/distinfo
Normal file
@ -0,0 +1,2 @@
|
||||
MD5 (fileschanged-0.6.0.tar.gz) = 78f652c17190017080eb985804d62013
|
||||
SIZE (fileschanged-0.6.0.tar.gz) = 188377
|
11
sysutils/fileschanged/files/patch-configure
Normal file
11
sysutils/fileschanged/files/patch-configure
Normal file
@ -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'
|
33
sysutils/fileschanged/files/patch-filelist.c
Normal file
33
sysutils/fileschanged/files/patch-filelist.c
Normal file
@ -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);
|
32
sysutils/fileschanged/files/patch-handlers.c
Normal file
32
sysutils/fileschanged/files/patch-handlers.c
Normal file
@ -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)
|
12
sysutils/fileschanged/files/patch-monitor.c
Normal file
12
sysutils/fileschanged/files/patch-monitor.c
Normal file
@ -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>
|
28
sysutils/fileschanged/files/patch-opts.c
Normal file
28
sysutils/fileschanged/files/patch-opts.c
Normal file
@ -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();
|
10
sysutils/fileschanged/files/patch-opts.h
Normal file
10
sysutils/fileschanged/files/patch-opts.h
Normal file
@ -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;
|
7
sysutils/fileschanged/pkg-descr
Normal file
7
sysutils/fileschanged/pkg-descr
Normal file
@ -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/
|
9
sysutils/fileschanged/pkg-message
Normal file
9
sysutils/fileschanged/pkg-message
Normal file
@ -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
|
||||
|
||||
************************************************************************
|
Loading…
Reference in New Issue
Block a user