SCCS-vsn: usr.bin/find/find.c 4.19
-static char *sccsid = "@(#)find.c 4.18 (Berkeley) %G%";
+static char *sccsid = "@(#)find.c 4.19 (Berkeley) %G%";
#endif
#include <stdio.h>
#endif
#include <stdio.h>
long Newer;
int Xdev = 1; /* true if SHOULD cross devices (file systems) */
long Newer;
int Xdev = 1; /* true if SHOULD cross devices (file systems) */
+int follow; /* true if SHOULD descend symlinked directories */
struct stat Devstat; /* stats of each argument path's file system */
struct stat Statb;
struct stat Devstat; /* stats of each argument path's file system */
struct stat Statb;
struct anode *e3() { /* parse parens and predicates */
int exeq(), ok(), glob(), mtime(), atime(), user(),
group(), size(), perm(), links(), print(),
struct anode *e3() { /* parse parens and predicates */
int exeq(), ok(), glob(), mtime(), atime(), user(),
group(), size(), perm(), links(), print(),
- type(), ino(), cpio(), newer(),
+ type(), ino(), cpio(), newer(),
nouser(), nogroup(), ls(), dummy();
struct anode *p1;
int i;
nouser(), nogroup(), ls(), dummy();
struct anode *p1;
int i;
Xdev = 0;
return (mk(dummy, (struct anode *)0, (struct anode *)0));
}
Xdev = 0;
return (mk(dummy, (struct anode *)0, (struct anode *)0));
}
+ else if (EQ(a, "-follow")) {
+ follow=1;
+ return mk(dummy, (struct anode *)0, (struct anode *)0);
+ }
b = nxtarg();
s = *b;
if(s=='+') b++;
b = nxtarg();
s = *b;
if(s=='+') b++;
int rv = 0;
char *endofname;
int rv = 0;
char *endofname;
- if (lstat(fname, &Statb)<0) {
+ if ((follow?stat(fname, &Statb):lstat(fname, &Statb))<0) {
fprintf(stderr, "find: bad status < %s >\n", name);
return(0);
}
fprintf(stderr, "find: bad status < %s >\n", name);
return(0);
}