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

Collapse All | Expand All

(-)Makefile (+1 lines)
Lines 1-6 Link Here
1
#	@(#)Makefile	8.1 (Berkeley) 6/6/93
1
#	@(#)Makefile	8.1 (Berkeley) 6/6/93
2
# $FreeBSD: src/usr.bin/find/Makefile,v 1.8 2000/02/05 18:42:34 joe Exp $
2
# $FreeBSD: src/usr.bin/find/Makefile,v 1.8 2000/02/05 18:42:34 joe Exp $
3
3
4
CFLAGS+=	-Wall
4
PROG=	find
5
PROG=	find
5
SRCS=	find.c function.c ls.c main.c misc.c operator.c option.c setflags.c
6
SRCS=	find.c function.c ls.c main.c misc.c operator.c option.c setflags.c
6
.PATH:	${.CURDIR}/../../lib/libc/gen
7
.PATH:	${.CURDIR}/../../lib/libc/gen
(-)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 (+14 lines)
Lines 35-41 Link Here
35
 */
35
 */
36
36
37
#ifndef lint
37
#ifndef lint
38
#if 0
38
static char sccsid[] = "@(#)find.c	8.5 (Berkeley) 8/5/94";
39
static char sccsid[] = "@(#)find.c	8.5 (Berkeley) 8/5/94";
40
#else
41
static const char rcsid[] =
42
	"$FreeBSD$";
43
#endif
39
#endif /* not lint */
44
#endif /* not lint */
40
45
41
#include <sys/types.h>
46
#include <sys/types.h>
Lines 206-217 Link Here
206
			continue;
211
			continue;
207
		}
212
		}
208
213
214
		if (mindepth != -1 && entry->fts_level < mindepth)
215
			continue;
216
209
		/*
217
		/*
210
		 * Call all the functions in the execution plan until one is
218
		 * Call all the functions in the execution plan until one is
211
		 * false or all have been executed.  This is where we do all
219
		 * false or all have been executed.  This is where we do all
212
		 * the work specified by the user on the command line.
220
		 * the work specified by the user on the command line.
213
		 */
221
		 */
214
		for (p = plan; p && (p->eval)(p, entry); p = p->next);
222
		for (p = plan; p && (p->eval)(p, entry); p = p->next);
223
224
		if (maxdepth != -1 && entry->fts_level >= maxdepth) {
225
			if (fts_set(tree, entry, FTS_SKIP))
226
				err(1, "%s", entry->fts_path);
227
			continue;
228
		}
215
	}
229
	}
216
	if (errno)
230
	if (errno)
217
		err(1, "fts_read");
231
		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 (-4 / +67 lines)
Lines 35-42 Link Here
35
 */
35
 */
36
36
37
#ifndef lint
37
#ifndef lint
38
#if 0
38
static char sccsid[] = "@(#)function.c	8.10 (Berkeley) 5/4/95";
39
static 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 $";
40
#else
41
static const char rcsid[] =
42
	"$FreeBSD: src/usr.bin/find/function.c,v 1.22 2000/02/05 18:42:34 joe Exp $";
43
#endif
40
#endif /* not lint */
44
#endif /* not lint */
41
45
42
#include <sys/param.h>
46
#include <sys/param.h>
Lines 717-722 Link Here
717
}
721
}
718
722
719
/*
723
/*
724
 * -maxdepth n functions --
725
 *
726
 *	Does the same as -prune if the level of the current file is greater
727
 *	than the specified maximum depth.
728
 *
729
 *	Note that -maxdepth and -mindepth are handled specially in
730
 *	find_execute() so their f_* functions here do nothing.
731
 */
732
int
733
f_maxdepth(plan, entry)
734
	PLAN *plan;
735
	FTSENT *entry;
736
{
737
	return (1);
738
}
739
740
PLAN *
741
c_maxdepth(arg)
742
	char *arg;
743
{
744
	PLAN *new;
745
746
	if (*arg == '-')
747
		/* all other errors handled by find_parsenum() */
748
		errx(1, "-maxdepth: %s: value must be positive", arg);
749
750
	new = palloc(N_MAXDEPTH, f_maxdepth);
751
	maxdepth = find_parsenum(new, "-maxdepth", arg, NULL);
752
	return (new);
753
754
}
755
756
/*
757
 * -mindepth n functions --
758
 *
759
 *	True if the current file is at or deeper than the specified minimum
760
 *	depth.
761
 */
762
int
763
f_mindepth(plan, entry)
764
	PLAN *plan;
765
	FTSENT *entry;
766
{
767
	return (1);
768
}
769
770
PLAN *
771
c_mindepth(arg)
772
	char *arg;
773
{
774
	PLAN *new;
775
776
	if (*arg == '-')
777
		/* all other errors handled by find_parsenum() */
778
		errx(1, "-maxdepth: %s: value must be positive", arg);
779
780
	new = palloc(N_MINDEPTH, f_mindepth);
781
	mindepth = find_parsenum(new, "-mindepth", arg, NULL);
782
	return (new);
783
}
784
785
/*
720
 * -mtime n functions --
786
 * -mtime n functions --
721
 *
787
 *
722
 *	True if the difference between the file modification time and the
788
 *	True if the difference between the file modification time and the
Lines 1005-1013 Link Here
1005
#endif
1071
#endif
1006
	return new;
1072
	return new;
1007
}
1073
}
1008
  
1009
  /*
1010
1011
1074
1012
/*
1075
/*
1013
 * -print functions --
1076
 * -print functions --
(-)ls.c (+5 lines)
Lines 32-38 Link Here
32
 */
32
 */
33
33
34
#ifndef lint
34
#ifndef lint
35
#if 0
35
static char sccsid[] = "@(#)ls.c	8.1 (Berkeley) 6/6/93";
36
static char sccsid[] = "@(#)ls.c	8.1 (Berkeley) 6/6/93";
37
#else
38
static const char rcsid[] =
39
	"$FreeBSD$";
40
#endif
36
#endif /* not lint */
41
#endif /* not lint */
37
42
38
#include <sys/param.h>
43
#include <sys/param.h>
(-)main.c (+6 lines)
Lines 41-47 Link Here
41
#endif /* not lint */
41
#endif /* not lint */
42
42
43
#ifndef lint
43
#ifndef lint
44
#if 0
44
static char sccsid[] = "@(#)main.c	8.4 (Berkeley) 5/4/95";
45
static char sccsid[] = "@(#)main.c	8.4 (Berkeley) 5/4/95";
46
#else
47
static const char rcsid[] =
48
	"$FreeBSD$";
49
#endif
45
#endif /* not lint */
50
#endif /* not lint */
46
51
47
#include <sys/types.h>
52
#include <sys/types.h>
Lines 67-72 Link Here
67
int isoutput;			/* user specified output operator */
72
int isoutput;			/* user specified output operator */
68
int issort;         		/* do hierarchies in lexicographical order */
73
int issort;         		/* do hierarchies in lexicographical order */
69
int isxargs;			/* don't permit xargs delimiting chars */
74
int isxargs;			/* don't permit xargs delimiting chars */
75
int mindepth = -1, maxdepth = -1; /* minimum and maximum depth */
70
76
71
static void usage __P((void));
77
static void usage __P((void));
72
78
(-)misc.c (+5 lines)
Lines 35-41 Link Here
35
 */
35
 */
36
36
37
#ifndef lint
37
#ifndef lint
38
#if 0
38
static char sccsid[] = "@(#)misc.c	8.2 (Berkeley) 4/1/94";
39
static char sccsid[] = "@(#)misc.c	8.2 (Berkeley) 4/1/94";
40
#else
41
static const char rcsid[] =
42
	"$FreeBSD$";
43
#endif
39
#endif /* not lint */
44
#endif /* not lint */
40
45
41
#include <sys/types.h>
46
#include <sys/types.h>
(-)operator.c (+5 lines)
Lines 35-41 Link Here
35
 */
35
 */
36
36
37
#ifndef lint
37
#ifndef lint
38
#if 0
38
static char sccsid[] = "@(#)operator.c	8.1 (Berkeley) 6/6/93";
39
static char sccsid[] = "@(#)operator.c	8.1 (Berkeley) 6/6/93";
40
#else
41
static const char rcsid[] =
42
	"$FreeBSD$";
43
#endif
39
#endif /* not lint */
44
#endif /* not lint */
40
45
41
#include <sys/types.h>
46
#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