-static char *sccsid = "@(#)find.c 4.1 (Berkeley) %G%";
+static char *sccsid = "@(#)find.c 4.5 (Berkeley) %G%";
/* find COMPILE: cc -o find -s -O -i find.c -lS */
#include <stdio.h>
#include <sys/types.h>
return(mk(atime, (struct anode *)atoi(b), (struct anode *)s));
else if(EQ(a, "-user")) {
if((i=getunum("/etc/passwd", b)) == -1) {
- if(gmatch(b, "[0-9][0-9]*"))
+ if(gmatch(b, "[0-9]*"))
return mk(user, (struct anode *)atoi(b), (struct anode *)s);
fprintf(stderr, "find: cannot find -user name\n");
exit(1);
return(mk(ino, (struct anode *)atoi(b), (struct anode *)s));
else if(EQ(a, "-group")) {
if((i=getunum("/etc/group", b)) == -1) {
- if(gmatch(b, "[0-9][0-9]*"))
+ if(gmatch(b, "[0-9]*"))
return mk(group, (struct anode *)atoi(b), (struct anode *)s);
fprintf(stderr, "find: cannot find -group name\n");
exit(1);
}
nargv[np] = 0;
if (np==0) return(9);
- if(fork()) /*parent*/ wait(&ccode);
- else { /*child*/
+ if(fork()) /*parent*/ {
+#include <signal.h>
+ int (*old)() = signal(SIGINT, SIG_IGN);
+ int (*oldq)() = signal(SIGQUIT, SIG_IGN);
+ wait(&ccode);
+ signal(SIGINT, old);
+ signal(SIGQUIT, oldq);
+ } else { /*child*/
chdir(Home);
execvp(nargv[0], nargv, np);
exit(1);
int rv = 0;
char *endofname;
- if(stat(fname, &Statb)<0) {
+ if(lstat(fname, &Statb)<0) {
fprintf(stderr, "find: bad status < %s >\n", name);
return(0);
}