BSD 4_3_Reno release
[unix-history] / usr / src / old / crypt / crypt.c
index ff65632..6cd3a72 100644 (file)
@@ -1,4 +1,4 @@
-static char *sccsid = "@(#)crypt.c     4.2 (Berkeley) %G%";
+static char *sccsid = "@(#)crypt.c     4.4 (Berkeley) 5/11/89";
 
 /*
  *     A one-rotor machine designed along the lines of Enigma
 
 /*
  *     A one-rotor machine designed along the lines of Enigma
@@ -7,6 +7,7 @@ static char *sccsid = "@(#)crypt.c      4.2 (Berkeley) %G%";
 
 #define ECHO 010
 #include <stdio.h>
 
 #define ECHO 010
 #include <stdio.h>
+#include "pathnames.h"
 #define ROTORSZ 256
 #define MASK 0377
 char   t1[ROTORSZ];
 #define ROTORSZ 256
 #define MASK 0377
 char   t1[ROTORSZ];
@@ -20,6 +21,7 @@ setup(pw)
 char *pw;
 {
        int ic, i, k, temp, pf[2];
 char *pw;
 {
        int ic, i, k, temp, pf[2];
+       int pid, wpid;
        unsigned random;
        long seed;
 
        unsigned random;
        long seed;
 
@@ -29,17 +31,17 @@ char *pw;
        buf[8] = buf[0];
        buf[9] = buf[1];
        pipe(pf);
        buf[8] = buf[0];
        buf[9] = buf[1];
        pipe(pf);
-       if (fork()==0) {
+       if ((pid=fork())==0) {
                close(0);
                close(1);
                dup(pf[0]);
                dup(pf[1]);
                close(0);
                close(1);
                dup(pf[0]);
                dup(pf[1]);
-               execl("/usr/lib/makekey", "-", 0);
-               execl("/lib/makekey", "-", 0);
+               execl(_PATH_MAKEKEY, "-", 0);
                exit(1);
        }
        write(pf[1], buf, 10);
                exit(1);
        }
        write(pf[1], buf, 10);
-       wait((int *)NULL);
+       while ((wpid = wait((int *)NULL)) != -1 && wpid != pid)
+           ;
        if (read(pf[0], buf, 13) != 13) {
                fprintf(stderr, "crypt: cannot generate key\n");
                exit(1);
        if (read(pf[0], buf, 13) != 13) {
                fprintf(stderr, "crypt: cannot generate key\n");
                exit(1);