This program should take in two arguments from stdin, then write them to a pipe. Then, have fork the program and have the child process call the program ./validate with the two arguments from the pipe. Depending on the exit code of ./validate, the program should output SUCCESS, INVALID or NO_USER.

  int fd[2];
  if(pipe(fd) = -1){
        perror("pipe");
  }

  int status;
  int n = fork();
  if(n < 0){
        perror("fork");
        exit(1);
  } else if (n > 0){
        close(fd[0]);

        if (write(fd[1], user_id, MAXLINE) == -1){
                perror("write to pipe");
        }
        if (write(fd[1], password, MAXLINE) == -1){
                perror("write to pipe");
        }
        close(fd[1]);

        if (wait(&status) == -1){
                perror("wait");
                exit(1);
        }
        if (WIFEXITED(status)){
                int child_status = WEXITSTATUS(status);
                if (child_status == 0){
                        printf(SUCCESS);
                } else if (child_status == 2){
                        printf(INVALID);
                } else {
                        printf(NO_USER);
                }
        }
  } else if (n == 0){
        close(fd[1]);
        execl("./validate", "validate", NULL);
        read(fd[0], STDIN_FILENO, MAXLINE);
        read(fd[0], STDIN_FILENO, MAXLINE);
        execl("echo $?", "echo", "$?", NULL);
        close(fd[0]);
        exit(0);
  }
