aboutsummaryrefslogtreecommitdiff
path: root/flx
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--flx/ChangeLog5
-rw-r--r--flx/Makefile2
-rw-r--r--flx/check.c4
-rw-r--r--flx/fct1.c5
-rw-r--r--flx/flx.h4
-rw-r--r--flx/input_fs.c32
6 files changed, 34 insertions, 18 deletions
diff --git a/flx/ChangeLog b/flx/ChangeLog
index 4e61cdf..8af9db3 100644
--- a/flx/ChangeLog
+++ b/flx/ChangeLog
@@ -1,3 +1,8 @@
+2005/04/09 : Version 0.7.1
+- added the '--ignore-dir' option to ignore differences in directories
+ size/date.
+- during a check, do not compute the md5 sums if the user asks to
+ ignore it. This makes simple diffs a lot faster.
2004/12/14 : Version 0.6.9
- fixed a bug in fct1.c where two different but valid links would
not be reported as different.
diff --git a/flx/Makefile b/flx/Makefile
index 4d0c460..02b7847 100644
--- a/flx/Makefile
+++ b/flx/Makefile
@@ -26,7 +26,7 @@
NAME=flx
-VERSION=0.7.0
+VERSION=0.7.1
SRC=main.c arg.c utils.c md5.c flx.c fct1.c check.c sign.c \
input.c input_fs.c input_file.c \
output.c output_file.c
diff --git a/flx/check.c b/flx/check.c
index 4c09a47..0a425c3 100644
--- a/flx/check.c
+++ b/flx/check.c
@@ -50,6 +50,7 @@ static POOL_INIT(t_file_diff);
#define O_REWRITE_SRC2 17
#define O_OUTPUT 18
#define O_IGN_DOT 19
+#define O_IGN_DIR 20
t_param flxcheck_poptions[] = {
{ 'h', "help", O_HELP, 0,
@@ -70,6 +71,8 @@ t_param flxcheck_poptions[] = {
"--ignore-ldate ignore date on links" },
{ 0, "ignore-dot", O_IGN_DOT, 0,
"--ignore-dot do not compare '.' and '..'" },
+ { 0, "ignore-dir", O_IGN_DIR, 0,
+ "--ignore-dir do not compare directories" },
{ 0, "show-all", O_SH_ALL, 0,
"--show-all show all files (same and differs)" },
{ 0, "only-new", O_SH_NEW, 0,
@@ -524,6 +527,7 @@ int flxcheck_pfct(int opt, t_param *param, char **flag, char **argv) {
else if (opt == O_IGN_DATE) UNSET(Diff, DIFF_TIME);
else if (opt == O_IGN_LINK) UNSET(Diff, DIFF_LINK);
else if (opt == O_IGN_LDATE) UNSET(Diff, DIFF_LDATE);
+ else if (opt == O_IGN_DIR) UNSET(Diff, DIFF_DIR);
else if (opt == O_SH_HR) SET(Options, GOPT_HUMAN_READABLE);
else if (opt == O_REWRITE_SRC1) Rewrite_Src1 = strdup(*(argv+1));
else if (opt == O_REWRITE_SRC2) Rewrite_Src2 = strdup(*(argv+1));
diff --git a/flx/fct1.c b/flx/fct1.c
index 622add7..c074a7a 100644
--- a/flx/fct1.c
+++ b/flx/fct1.c
@@ -76,8 +76,9 @@ int files_are_the_same(t_file_desc *f1, t_file_desc *f2, int Diff, char *path)
f1->stat.st_rdev != f2->stat.st_rdev)
diff |= DIFF_DEV; /* minor/major differ for device files */
if (DIFF(TIME) && f1->stat.st_mtime != f2->stat.st_mtime) {
- if (DIFF(LDATE) || !(S_ISLNK(f1->stat.st_mode)))
- diff |= DIFF_TIME; /* modification times diff */
+ if (DIFF(DIR) || !S_ISDIR(f1->stat.st_mode) || !S_ISDIR(f2->stat.st_mode))
+ if (DIFF(LDATE) || !(S_ISLNK(f1->stat.st_mode)))
+ diff |= DIFF_TIME; /* modification times diff */
}
if (DIFF(LINK) && S_ISLNK(f1->stat.st_mode) && S_ISLNK(f2->stat.st_mode)) {
char temp[BUFFER_LENGTH];
diff --git a/flx/flx.h b/flx/flx.h
index 6c71355..3315ded 100644
--- a/flx/flx.h
+++ b/flx/flx.h
@@ -8,7 +8,7 @@
#include "utils.h"
#include "md5.h"
-#define COPYRIGHT "Copyright 2002-2004, Benoit DOLEZ <bdolez@ant-computing.com>"
+#define COPYRIGHT "Copyright 2002-2005, Benoit DOLEZ <bdolez@ant-computing.com>"
#define DUMPBASENAME "formilux-sig.dat"
@@ -48,6 +48,7 @@
#define F_LINK 0x0040
#define F_TIME 0x0080
#define F_LDATE 0x0100
+#define F_DIR 0x0200
#define DIFF_TYPE F_TYPE
#define DIFF_MODE F_MODE
@@ -58,6 +59,7 @@
#define DIFF_LINK F_LINK
#define DIFF_TIME F_TIME
#define DIFF_LDATE F_LDATE
+#define DIFF_DIR F_DIR
#define DIFF_NOTFILLED 0x8000
#define DELIM_BASE ':'
diff --git a/flx/input_fs.c b/flx/input_fs.c
index 042134c..e64f9da 100644
--- a/flx/input_fs.c
+++ b/flx/input_fs.c
@@ -35,21 +35,25 @@ static t_file_desc *complete_info_from_fs(char *path, t_file_desc *desc) {
/* copy stat informations */
memcpy(&desc->stat, &stat, sizeof(stat));
- if (S_ISREG(stat.st_mode) && !desc->md5) /* get md5 checksum */
- desc->md5 = checksum_md5_from_file(path);
- else if (S_ISLNK(stat.st_mode) && !desc->link) {
- /* get link and md5 associed */
- char temp[BUFFER_LENGTH];
- int l;
-
- if ((l = readlink(path, temp, BUFFER_LENGTH)) < 0) {
- PFERROR("readlink(%s)", path);
- } else {
- temp[l] = 0;
- desc->link = strdup(temp);
- desc->md5 = checksum_md5_from_data(temp, l);
+ if (IS(Diff, DIFF_CHECKSUM)) {
+ if (S_ISREG(stat.st_mode) && !desc->md5) /* get md5 checksum */
+ desc->md5 = checksum_md5_from_file(path);
+ else if (S_ISLNK(stat.st_mode) && !desc->link) {
+ /* get link and md5 associed */
+ char temp[BUFFER_LENGTH];
+ int l;
+
+ if ((l = readlink(path, temp, BUFFER_LENGTH)) < 0) {
+ PFERROR("readlink(%s)", path);
+ } else {
+ temp[l] = 0;
+ desc->link = strdup(temp);
+ desc->md5 = checksum_md5_from_data(temp, l);
+ }
}
- }
+ } else
+ desc->md5 = NULL;
+
return (desc);
}