Pre-ansification changes for usr.bin/find
authorNick Downing <downing.nick@gmail.com>
Tue, 31 Jan 2017 07:23:21 +0000 (18:23 +1100)
committerNick Downing <downing.nick@gmail.com>
Tue, 31 Jan 2017 07:40:10 +0000 (18:40 +1100)
usr.bin/find/Makefile
usr.bin/find/conflicts.txt [new file with mode: 0644]
usr.bin/find/find.c
usr.bin/find/uniqify.sed [new file with mode: 0644]

index e30fbff..d5a6cfd 100644 (file)
@@ -16,13 +16,13 @@ SRCS=       find.c bigram.c code.c
 all: ${PROG} ${LIBS}
 
 find: find.c
-       cc ${CFLAGS} -o find find.c
+       ${CC} ${CFLAGS} -o find find.c
 
 bigram: bigram.c
-       cc ${CFLAGS} -o bigram bigram.c
+       ${CC} ${CFLAGS} -o bigram bigram.c
 
 code: code.c
-       cc ${CFLAGS} -o code code.c
+       ${CC} ${CFLAGS} -o code code.c
 
 install: ${PROG} ${LIBS}
        install -s ${PROG} ${DESTDIR}/usr/bin/${PROG}
@@ -54,16 +54,3 @@ depend:
 
 # DO NOT DELETE THIS LINE -- make depend uses it
 
-find.o: find.c
-find.o: /usr/include/stdio.h
-find.o: /usr/include/sys/param.h
-find.o: /usr/include/sys/dir.h
-find.o: /usr/include/sys/stat.h
-find.o: /usr/include/signal.h
-bigram.o: bigram.c
-bigram.o: /usr/include/stdio.h
-code.o: code.c
-code.o: /usr/include/stdio.h
-# DEPENDENCIES MUST END AT END OF FILE
-# IF YOU PUT STUFF HERE IT WILL GO AWAY
-# see make depend above
diff --git a/usr.bin/find/conflicts.txt b/usr.bin/find/conflicts.txt
new file mode 100644 (file)
index 0000000..ec1b7a6
--- /dev/null
@@ -0,0 +1 @@
+find.c vfont.h
index e948647..aced151 100644 (file)
@@ -355,9 +355,9 @@ register struct anode *p;
        return( !((*p->L->F)(p->L)));
 }
 glob(p)
-register struct { int f; char *pat; } *p; 
+register struct anode *p;
 {
-       return(gmatch(Fname, p->pat));
+       return(gmatch(Fname, (char *)p->L));
 }
 print(p)
 struct anode *p;
@@ -366,19 +366,25 @@ struct anode *p;
        return(1);
 }
 mtime(p)
-register struct { int f, t, s; } *p; 
+register struct anode *p;
 {
-       return(scomp((int)((Now - Statb.st_mtime) / A_DAY), p->t, p->s));
+       /* p->L is formerly int t */
+       /* p->R is formerly int s */
+       return(scomp((int)((Now - Statb.st_mtime) / A_DAY), (int)p->L, (int)p->R));
 }
 atime(p)
-register struct { int f, t, s; } *p; 
+register struct anode *p; 
 {
-       return(scomp((int)((Now - Statb.st_atime) / A_DAY), p->t, p->s));
+       /* p->L is formerly int t */
+       /* p->R is formerly int s */
+       return(scomp((int)((Now - Statb.st_atime) / A_DAY), (int)p->L, (int)p->R));
 }
 user(p)
-register struct { int f, u, s; } *p; 
+register struct anode *p; 
 {
-       return(scomp(Statb.st_uid, p->u, p->s));
+       /* p->L is formerly int u */
+       /* p->R is formerly int s */
+       return(scomp(Statb.st_uid, (int)p->L, (int)p->R));
 }
 nouser(p)
 struct anode *p;
@@ -388,14 +394,17 @@ struct anode *p;
        return (getname(Statb.st_uid) == NULL);
 }
 ino(p)
-register struct { int f, u, s; } *p;
+register struct anode *p;
 {
-       return(scomp((int)Statb.st_ino, p->u, p->s));
+       /* p->L is formerly int u */
+       /* p->R is formerly int s */
+       return(scomp((int)Statb.st_ino, (int)p->L, (int)p->R));
 }
 group(p)
-register struct { int f, u; } *p; 
+register struct anode *p; 
 {
-       return(p->u == Statb.st_gid);
+       /* p->L is formerly int u */
+       return((int)p->L == Statb.st_gid);
 }
 nogroup(p)
 struct anode *p;
@@ -405,44 +414,53 @@ struct anode *p;
        return (getgroup(Statb.st_gid) == NULL);
 }
 links(p)
-register struct { int f, link, s; } *p; 
+register struct anode *p; 
 {
-       return(scomp(Statb.st_nlink, p->link, p->s));
+       /* p->L is formerly int link */
+       /* p->R is formerly int s */
+       return(scomp(Statb.st_nlink, (int)p->L, (int)p->R));
 }
 size(p)
-register struct { int f, sz, s; } *p; 
+register struct anode *p; 
 {
-       return(scomp((int)((Statb.st_size+511)>>9), p->sz, p->s));
+       /* p->L is formerly int sz */
+       /* p->R is formerly int s */
+       return(scomp((int)((Statb.st_size+511)>>9), (int)p->L, (int)p->R));
 }
 perm(p)
-register struct { int f, per, s; } *p; 
+register struct anode *p; 
 {
+       /* p->L is formerly int per */
+       /* p->R is formerly int s */
        register i;
-       i = (p->s=='-') ? p->per : 07777; /* '-' means only arg bits */
-       return((Statb.st_mode & i & 07777) == p->per);
+       i = ((int)p->R=='-') ? (int)p->L : 07777; /* '-' means only arg bits */
+       return((Statb.st_mode & i & 07777) == (int)p->L);
 }
 type(p)
-register struct { int f, per, s; } *p;
+register struct anode *p;
 {
-       return((Statb.st_mode&S_IFMT)==p->per);
+       /* p->L is formerly int per */
+       return((Statb.st_mode&S_IFMT)==(int)p->L);
 }
 exeq(p)
-register struct { int f, com; } *p;
+register struct anode *p;
 {
+       /* p->L is formerly int com */
        fflush(stdout); /* to flush possible `-print' */
-       return(doex(p->com));
+       return(doex((int)p->L));
 }
 ok(p)
-struct { int f, com; } *p;
+struct anode *p;
 {
+       /* p->L is formerly int com */
        char c;  int yes;
        yes = 0;
        fflush(stdout); /* to flush possible `-print' */
-       fprintf(stderr, "< %s ... %s > ?   ", Argv[p->com], Pathname);
+       fprintf(stderr, "< %s ... %s > ?   ", Argv[(int)p->L], Pathname);
        fflush(stderr);
        if((c=getchar())=='y') yes = 1;
        while(c!='\n') c = getchar();
-       if(yes) return(doex(p->com));
+       if(yes) return(doex((int)p->L));
        return(0);
 }
 
@@ -458,8 +476,7 @@ short v[];
                U.s[0] = v[0], U.s[1] = v[1];
        return U.l;
 }
-cpio(p)
-struct anode *p;
+cpio()
 {
 #define MAGIC 070707
        struct header {
@@ -571,7 +588,7 @@ doex(com)
 
        case 0:
                chdir(Home);
-               execvp(nargv[0], nargv, np);
+               execvp(nargv[0], nargv);
                write(2, "find: Can't execute ", 20);
                perror(nargv[0]);
                /*
diff --git a/usr.bin/find/uniqify.sed b/usr.bin/find/uniqify.sed
new file mode 100644 (file)
index 0000000..6170dc8
--- /dev/null
@@ -0,0 +1,10 @@
+s/@/ATSIGN/g
+s/^/@/
+s/$/@/
+s/[^A-Za-z0-9_]\+/@&@/g
+
+s/@getgid@/@_getgid@/
+s/@getuid@/@_getuid@/
+
+s/@//g
+s/ATSIGN/@/g