View | Details | Raw Unified | Return to bug 18941 | Differences between
and this patch

Collapse All | Expand All

(-)extern.h (-1 / +4 lines)
Lines 80-88 Link Here
80
PLAN	*c_xdev __P((void));
80
PLAN	*c_xdev __P((void));
81
PLAN	*c_openparen __P((void));
81
PLAN	*c_openparen __P((void));
82
PLAN	*c_closeparen __P((void));
82
PLAN	*c_closeparen __P((void));
83
PLAN	*c_maxdepth __P((char *));
84
PLAN	*c_mindepth __P((char *));
83
PLAN	*c_mmin __P((char *));
85
PLAN	*c_mmin __P((char *));
84
PLAN	*c_mtime __P((char *));
86
PLAN	*c_mtime __P((char *));
85
PLAN	*c_not __P((void));
87
PLAN	*c_not __P((void));
86
PLAN	*c_or __P((void));
88
PLAN	*c_or __P((void));
87
89
88
extern int ftsoptions, isdeprecated, isdepth, isoutput, issort, isxargs;
90
extern int ftsoptions, isdeprecated, isdepth, isoutput, issort, isxargs,
91
    mindepth, maxdepth;
(-)find.1 (+6 lines)
Lines 245-250 Link Here
245
If the file is a symbolic link, the pathname of the linked\-to file will be
245
If the file is a symbolic link, the pathname of the linked\-to file will be
246
displayed preceded by ``\->''.
246
displayed preceded by ``\->''.
247
The format is identical to that produced by ``ls \-dgils''.
247
The format is identical to that produced by ``ls \-dgils''.
248
.It Ic -maxdepth Ar n
249
True if the depth of the current file into the tree is less than or equal to
250
.Ar n .
251
.It Ic -mindepth Ar n
252
True if the depth of the current file into the tree is greater than or equal to
253
.Ar n .
248
.It Ic -mmin Ar n 
254
.It Ic -mmin Ar n 
249
True if the difference between the file last modification time and the time
255
True if the difference between the file last modification time and the time
250
.Nm find
256
.Nm find
(-)find.c (-1 / +12 lines)
Lines 35-41 Link Here
35
 */
35
 */
36
36
37
#ifndef lint
37
#ifndef lint
38
static char sccsid[] = "@(#)find.c	8.5 (Berkeley) 8/5/94";
38
static const char sccsid[] = "@(#)find.c	8.5 (Berkeley) 8/5/94";
39
static const char rcsid[] =
40
	"$FreeBSD$";
39
#endif /* not lint */
41
#endif /* not lint */
40
42
41
#include <sys/types.h>
43
#include <sys/types.h>
Lines 206-217 Link Here
206
			continue;
208
			continue;
207
		}
209
		}
208
210
211
		if (mindepth != -1 && entry->fts_level < mindepth)
212
			continue;
213
209
		/*
214
		/*
210
		 * Call all the functions in the execution plan until one is
215
		 * Call all the functions in the execution plan until one is
211
		 * false or all have been executed.  This is where we do all
216
		 * false or all have been executed.  This is where we do all
212
		 * the work specified by the user on the command line.
217
		 * the work specified by the user on the command line.
213
		 */
218
		 */
214
		for (p = plan; p && (p->eval)(p, entry); p = p->next);
219
		for (p = plan; p && (p->eval)(p, entry); p = p->next);
220
221
		if (maxdepth != -1 && entry->fts_level >= maxdepth) {
222
			if (fts_set(tree, entry, FTS_SKIP))
223
				err(1, "%s", entry->fts_path);
224
			continue;
225
		}
215
	}
226
	}
216
	if (errno)
227
	if (errno)
217
		err(1, "fts_read");
228
		err(1, "fts_read");
(-)find.h (-1 / +1 lines)
Lines 46-52 Link Here
46
        N_MTIME, N_NAME,
46
        N_MTIME, N_NAME,
47
	N_NEWER, N_NOGROUP, N_NOT, N_NOUSER, N_OK, N_OPENPAREN, N_OR, N_PATH,
47
	N_NEWER, N_NOGROUP, N_NOT, N_NOUSER, N_OK, N_OPENPAREN, N_OR, N_PATH,
48
	N_PERM, N_PRINT, N_PRUNE, N_SIZE, N_TYPE, N_USER, N_XDEV,
48
	N_PERM, N_PRINT, N_PRUNE, N_SIZE, N_TYPE, N_USER, N_XDEV,
49
	N_PRINT0, N_DELETE
49
	N_PRINT0, N_DELETE, N_MAXDEPTH, N_MINDEPTH
50
};
50
};
51
51
52
/* node definition */
52
/* node definition */
(-)function.c (-5 / +65 lines)
Lines 35-42 Link Here
35
 */
35
 */
36
36
37
#ifndef lint
37
#ifndef lint
38
static char sccsid[] = "@(#)function.c	8.10 (Berkeley) 5/4/95";
38
static const char sccsid[] = "@(#)function.c	8.10 (Berkeley) 5/4/95";
39
static char rcsid[] = "$FreeBSD: src/usr.bin/find/function.c,v 1.22 2000/02/05 18:42:34 joe Exp $";
39
static const char rcsid[] =
40
	"$FreeBSD: src/usr.bin/find/function.c,v 1.22 2000/02/05 18:42:34 joe Exp $";
40
#endif /* not lint */
41
#endif /* not lint */
41
42
42
#include <sys/param.h>
43
#include <sys/param.h>
Lines 717-722 Link Here
717
}
718
}
718
719
719
/*
720
/*
721
 * -maxdepth n functions --
722
 *
723
 *	Does the same as -prune if the level of the current file is greater
724
 *	than the specified maximum depth.
725
 *
726
 *	Note that -maxdepth and -mindepth are handled specially in
727
 *	find_execute() so their f_* functions here do nothing.
728
 */
729
int
730
f_maxdepth(plan, entry)
731
	PLAN *plan;
732
	FTSENT *entry;
733
{
734
	return (1);
735
}
736
737
PLAN *
738
c_maxdepth(arg)
739
	char *arg;
740
{
741
	PLAN *new;
742
743
	if (*arg == '-')
744
		/* all other errors handled by find_parsenum() */
745
		errx(1, "-maxdepth: %s: value must be positive", arg);
746
747
	new = palloc(N_MAXDEPTH, f_maxdepth);
748
	maxdepth = find_parsenum(new, "-maxdepth", arg, NULL);
749
	return (new);
750
751
}
752
753
/*
754
 * -mindepth n functions --
755
 *
756
 *	True if the current file is at or deeper than the specified minimum
757
 *	depth.
758
 */
759
int
760
f_mindepth(plan, entry)
761
	PLAN *plan;
762
	FTSENT *entry;
763
{
764
	return (1);
765
}
766
767
PLAN *
768
c_mindepth(arg)
769
	char *arg;
770
{
771
	PLAN *new;
772
773
	if (*arg == '-')
774
		/* all other errors handled by find_parsenum() */
775
		errx(1, "-maxdepth: %s: value must be positive", arg);
776
777
	new = palloc(N_MINDEPTH, f_mindepth);
778
	mindepth = find_parsenum(new, "-mindepth", arg, NULL);
779
	return (new);
780
}
781
782
/*
720
 * -mtime n functions --
783
 * -mtime n functions --
721
 *
784
 *
722
 *	True if the difference between the file modification time and the
785
 *	True if the difference between the file modification time and the
Lines 1005-1013 Link Here
1005
#endif
1068
#endif
1006
	return new;
1069
	return new;
1007
}
1070
}
1008
  
1009
  /*
1010
1011
1071
1012
/*
1072
/*
1013
 * -print functions --
1073
 * -print functions --
(-)ls.c (-1 / +3 lines)
Lines 32-38 Link Here
32
 */
32
 */
33
33
34
#ifndef lint
34
#ifndef lint
35
static char sccsid[] = "@(#)ls.c	8.1 (Berkeley) 6/6/93";
35
static const char sccsid[] = "@(#)ls.c	8.1 (Berkeley) 6/6/93";
36
static const char rcsid[] =
37
	"$FreeBSD$";
36
#endif /* not lint */
38
#endif /* not lint */
37
39
38
#include <sys/param.h>
40
#include <sys/param.h>
(-)main.c (-1 / +4 lines)
Lines 41-47 Link Here
41
#endif /* not lint */
41
#endif /* not lint */
42
42
43
#ifndef lint
43
#ifndef lint
44
static char sccsid[] = "@(#)main.c	8.4 (Berkeley) 5/4/95";
44
static const char sccsid[] = "@(#)main.c	8.4 (Berkeley) 5/4/95";
45
static const char rcsid[] =
46
	"$FreeBSD$";
45
#endif /* not lint */
47
#endif /* not lint */
46
48
47
#include <sys/types.h>
49
#include <sys/types.h>
Lines 67-72 Link Here
67
int isoutput;			/* user specified output operator */
69
int isoutput;			/* user specified output operator */
68
int issort;         		/* do hierarchies in lexicographical order */
70
int issort;         		/* do hierarchies in lexicographical order */
69
int isxargs;			/* don't permit xargs delimiting chars */
71
int isxargs;			/* don't permit xargs delimiting chars */
72
int mindepth = -1, maxdepth = -1; /* minimum and maximum depth */
70
73
71
static void usage __P((void));
74
static void usage __P((void));
72
75
(-)misc.c (-1 / +3 lines)
Lines 35-41 Link Here
35
 */
35
 */
36
36
37
#ifndef lint
37
#ifndef lint
38
static char sccsid[] = "@(#)misc.c	8.2 (Berkeley) 4/1/94";
38
static const char sccsid[] = "@(#)misc.c	8.2 (Berkeley) 4/1/94";
39
static const char rcsid[] =
40
	"$FreeBSD$";
39
#endif /* not lint */
41
#endif /* not lint */
40
42
41
#include <sys/types.h>
43
#include <sys/types.h>
(-)operator.c (-1 / +3 lines)
Lines 35-41 Link Here
35
 */
35
 */
36
36
37
#ifndef lint
37
#ifndef lint
38
static char sccsid[] = "@(#)operator.c	8.1 (Berkeley) 6/6/93";
38
static const char sccsid[] = "@(#)operator.c	8.1 (Berkeley) 6/6/93";
39
static const char rcsid[] =
40
	"$FreeBSD$";
39
#endif /* not lint */
41
#endif /* not lint */
40
42
41
#include <sys/types.h>
43
#include <sys/types.h>
(-)option.c (+2 lines)
Lines 84-89 Link Here
84
	{ "-inum",	N_INUM,		c_inum,		O_ARGV },
84
	{ "-inum",	N_INUM,		c_inum,		O_ARGV },
85
	{ "-links",	N_LINKS,	c_links,	O_ARGV },
85
	{ "-links",	N_LINKS,	c_links,	O_ARGV },
86
	{ "-ls",	N_LS,		c_ls,		O_ZERO },
86
	{ "-ls",	N_LS,		c_ls,		O_ZERO },
87
	{ "-maxdepth",	N_MAXDEPTH,	c_maxdepth,	O_ARGV },
88
	{ "-mindepth",	N_MINDEPTH,	c_mindepth,	O_ARGV },
87
	{ "-mmin",	N_MMIN,	        c_mmin,	        O_ARGV },
89
	{ "-mmin",	N_MMIN,	        c_mmin,	        O_ARGV },
88
	{ "-mtime",	N_MTIME,	c_mtime,	O_ARGV },
90
	{ "-mtime",	N_MTIME,	c_mtime,	O_ARGV },
89
	{ "-name",	N_NAME,		c_name,		O_ARGV },
91
	{ "-name",	N_NAME,		c_name,		O_ARGV },

Return to bug 18941