prints if password verified, invalid password, or no such user
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>

#define MAXLINE 256

#define SUCCESS "Password verified\n"
#define INVALID "Invalid password\n"
#define NO_USER "No such user\n"

int main(void) {
  char user_id[MAXLINE];
  char password[MAXLINE];
  if(fgets(user_id, MAXLINE, stdin) == NULL) {
      perror("fgets");
      exit(1);
  }
  if(fgets(password, MAXLINE, stdin) == NULL) {
      perror("fgets");
      exit(1);
  }
    int fd[2];
    pipe(fd);

    int pid = fork();
    if (pid == 0) {
        close(fd[1]);
        dup2(fd[0], 0);
        execl("./validate", "validate", user_id, password, NULL);
    }
    else {
        close(fd[0]);
        write(fd[1], user_id, strlen(user_id));
        write(fd[1], "\n", 1);
        write(fd[1], password, strlen(password));
        close(fd[1]);
        int status;
        wait(&status);
        if (WEXITSTATUS(status) == 1) {
            printf(SUCCESS"\n");
        }
        else if (WEXITSTATUS(status) == 2) {
            printf(INVALID"\n");
        }
        else if (WEXITSTATUS(status) == 3) {
            printf(NO_USER"\n");
        }
    }

  return 0;
}