1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-24 04:33:24 +00:00

- Update to 0.6.5

This commit is contained in:
Pav Lucistnik 2007-06-04 22:29:29 +00:00
parent aaf911d26d
commit 2a1722100b
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=192776
9 changed files with 149 additions and 95 deletions

View File

@ -6,8 +6,7 @@
#
PORTNAME= fileschanged
PORTVERSION= 0.6.0
PORTREVISION= 1
PORTVERSION= 0.6.5
CATEGORIES= sysutils
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
MASTER_SITE_SUBDIR= ${PORTNAME}
@ -21,20 +20,13 @@ BUILD_DEPENDS= ${LOCALBASE}/include/argp.h:${PORTSDIR}/devel/argp-standalone \
GNU_CONFIGURE= yes
USE_GMAKE= yes
USE_FAM= yes
WANT_FAM_SYSTEM=fam
CONFIGURE_ENV+= CPPFLAGS="-I${LOCALBASE}/include" LDFLAGS="-L${LOCALBASE}/lib" \
LIBS="-largp"
CONFIGURE_ARGS+=--datadir=${PREFIX}/share/doc
CONFIGURE_ARGS= --datadir=${PREFIX}/share/doc --disable-nls
INFO= fileschanged
MAN1= fileschanged.1
PORTDOCS= AUTHORS COPYING ChangeLog INSTALL NEWS README fileschanged.lsm
PORTDOCS= AUTHORS ChangeLog INSTALL NEWS README
PLIST_FILES= bin/fileschanged
post-patch:
${REINPLACE_CMD} -e "s,-Werror,," ${WRKSRC}/src/Makefile.in
post-install:
@${CAT} ${PKGMESSAGE}
.include <bsd.port.mk>

View File

@ -1,3 +1,3 @@
MD5 (fileschanged-0.6.0.tar.gz) = 78f652c17190017080eb985804d62013
SHA256 (fileschanged-0.6.0.tar.gz) = fe9039b7fd113f41a5abc5873317c369efbf583388cbf74ae5dbade883eb071b
SIZE (fileschanged-0.6.0.tar.gz) = 188377
MD5 (fileschanged-0.6.5.tar.gz) = 49ae8bed507c000f9c7fa430b5b71205
SHA256 (fileschanged-0.6.5.tar.gz) = 63c10995197bca6a7f24a19ca26870abafc919b23a870447cb44199d22f777cc
SIZE (fileschanged-0.6.5.tar.gz) = 270182

View File

@ -1,9 +1,17 @@
--- 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"
--- src/filelist.c.orig Wed Apr 19 21:42:28 2006
+++ src/filelist.c Mon Jun 4 21:31:54 2007
@@ -4,7 +4,6 @@
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
-#include <error.h>
#include "gettext.h"
#include <libgen.h>
#include <unistd.h>
@@ -16,6 +15,31 @@
#include "listdirs.h"
extern struct arguments_t arguments;
+#if defined(__FreeBSD__)
+ssize_t getline(char **lineptr, size_t *n, FILE *stream)
+{
@ -28,6 +36,16 @@
+ 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);
+
/*
* filelist.c:
* int filelist_populate (void *list_of_files_to_monitor);
@@ -74,7 +98,7 @@
{
fileptr = fopen (filename, "r");
if (!fileptr)
- error(1, 0, _("Error: couldn't open '%s'\n"), filename);
+ fprintf(stderr, _("Error: couldn't open '%s'\n"), filename);
}
while (getline (&line, &n, fileptr) > 0)
{

View File

@ -0,0 +1,21 @@
--- src/fileschanged.c.orig Wed Apr 19 21:42:28 2006
+++ src/fileschanged.c Mon Jun 4 21:30:49 2007
@@ -3,7 +3,6 @@
#include <signal.h>
#include <fam.h>
#include <errno.h>
-#include <error.h>
#include "config.h"
#include "gettext.h"
#include "fileschanged.h"
@@ -15,6 +14,10 @@
#include "handlers.h"
extern struct arguments_t arguments;
struct fileschanged_appstate_t app;
+
+static void error (int status, int errnum, const char *format) {
+ fprintf(stderr, "%s\n", format);
+}
static void
show_changed_file (char *filename, struct stat *statbuf)

View File

@ -1,39 +1,13 @@
--- src/handlers.c.orig Mon Feb 23 01:42:46 2004
+++ src/handlers.c Wed Jun 16 20:13:06 2004
@@ -7,6 +7,11 @@
@@ -7,6 +7,10 @@
#include "node.h"
#include "opts.h"
#include "wl.h"
+#if defined(__FreeBSD__)
+#include <signal.h>
+#include "libgen.h"
+#endif
+
extern struct arguments_t arguments;
struct handler_t handlers[FC_HANDLER_MAX]=
{
@@ -180,12 +185,24 @@
}
void show_event(enum handler_enum_t id, char *filename)
{
+ struct sigaction sa;
+
+ if (arguments.fileschanged.exec_command == NULL) {
if (arguments.fileschanged.showaction)
{
fprintf(stdout, "%s ", handlers[id].name);
}
fprintf(stdout, "%s\n",filename);
fflush(stdout);
+ } else {
+ sa.sa_handler = SIG_IGN;
+ sa.sa_flags = SA_NOCLDWAIT;
+ sigemptyset(&sa.sa_mask);
+ sigaction(SIGCHLD, &sa, NULL);
+ 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)

View File

@ -1,28 +0,0 @@
--- 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();

View File

@ -1,10 +0,0 @@
--- 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;

View File

@ -0,0 +1,96 @@
--- src/wl.c.orig Wed Apr 19 21:42:30 2006
+++ src/wl.c Mon Jun 4 21:49:40 2007
@@ -4,12 +4,92 @@
#include <sys/stat.h>
#include <unistd.h>
#include <time.h>
-#include <argz.h>
+#include <assert.h>
+#include <errno.h>
#include "wl.h"
#include "opts.h"
int wl_index = 0;
char*wl = NULL;
size_t wl_max = 0;
+
+// -------------------- XXX ---------------------
+
+static char *
+argz_next (argz, argz_len, entry)
+ char *argz;
+ size_t argz_len;
+ const char *entry;
+{
+ assert ((argz && argz_len) || (!argz && !argz_len));
+
+ if (entry)
+ {
+ /* Either ARGZ/ARGZ_LEN is empty, or ENTRY points into an address
+ within the ARGZ vector. */
+ assert ((!argz && !argz_len)
+ || ((argz <= entry) && (entry < (argz + argz_len))));
+
+ /* Move to the char immediately after the terminating
+ '\0' of ENTRY. */
+ entry = 1+ strchr (entry, '\0');
+
+ /* Return either the new ENTRY, or else NULL if ARGZ is
+ exhausted. */
+ return (entry >= argz + argz_len) ? 0 : (char *) entry;
+ }
+ else
+ {
+ /* This should probably be flagged as a programmer error,
+ since starting an argz_next loop with the iterator set
+ to ARGZ is safer. To preserve semantics, handle the NULL
+ case by returning the start of ARGZ (if any). */
+ if (argz_len > 0)
+ return argz;
+ else
+ return 0;
+ }
+}
+
+static int
+argz_append (char **argz, size_t *argz_len, const char *buf, size_t buf_len)
+{
+ size_t new_argz_len = *argz_len + buf_len;
+ char *new_argz = realloc (*argz, new_argz_len);
+ if (new_argz)
+ {
+ memcpy (new_argz + *argz_len, buf, buf_len);
+ *argz = new_argz;
+ *argz_len = new_argz_len;
+ return 0;
+ }
+ else
+ return ENOMEM;
+}
+
+static int
+argz_add (char **argz, size_t *argz_len, const char *str)
+{
+ return argz_append (argz, argz_len, str, strlen (str) + 1);
+}
+
+static void
+argz_delete (char **argz, size_t *argz_len, char *entry)
+{
+ if (entry)
+ /* Get rid of the old value for NAME. */
+ {
+ size_t entry_len = strlen (entry) + 1;
+ *argz_len -= entry_len;
+ memmove (entry, entry + entry_len, *argz_len - (entry - *argz));
+ if (*argz_len == 0)
+ {
+ free (*argz);
+ *argz = 0;
+ }
+ }
+}
+
+// -------------------- XXX ---------------------
void
wl_init ()

View File

@ -1,9 +0,0 @@
************************************************************************
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
************************************************************************