BSD 4_1_snap release
[unix-history] / usr / src / cmd / find.c
index ca673a6..b966ed3 100644 (file)
@@ -1,4 +1,4 @@
-static char *sccsid = "@(#)find.c      4.1 (Berkeley) 10/1/80";
+static char *sccsid = "@(#)find.c      4.4 (Berkeley) 7/3/81";
 /*     find    COMPILE:        cc -o find -s -O -i find.c -lS  */
 #include <stdio.h>
 #include <sys/types.h>
 /*     find    COMPILE:        cc -o find -s -O -i find.c -lS  */
 #include <stdio.h>
 #include <sys/types.h>
@@ -170,7 +170,7 @@ struct anode *e3() { /* parse parens and predicates */
                return(mk(atime, (struct anode *)atoi(b), (struct anode *)s));
        else if(EQ(a, "-user")) {
                if((i=getunum("/etc/passwd", b)) == -1) {
                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(user, (struct anode *)atoi(b), (struct anode *)s);
                        fprintf(stderr, "find: cannot find -user name\n");
                        exit(1);
@@ -181,7 +181,7 @@ struct anode *e3() { /* parse parens and predicates */
                return(mk(ino, (struct anode *)atoi(b), (struct anode *)s));
        else if(EQ(a, "-group")) {
                if((i=getunum("/etc/group", b)) == -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);
                                return mk(group, (struct anode *)atoi(b), (struct anode *)s);
                        fprintf(stderr, "find: cannot find -group name\n");
                        exit(1);
@@ -456,8 +456,14 @@ doex(com)
        }
        nargv[np] = 0;
        if (np==0) return(9);
        }
        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);
                chdir(Home);
                execvp(nargv[0], nargv, np);
                exit(1);