our task is to complete checkpasswd.c, which reads a user id and password from stdin, creates a new process to run the validate program, sends it the user id and password, and prints a message to stdout reporting whether the validation is successful.

Your program should use the exit status of the validate program to determine which of the three following messages to print:

"Password verified" if the user id and password match.
"Invalid password" if the user id exists, but the password does not match.
"No such user" if the user id is not recognized
The exact messages are given in the starter code as defined constants.

The only case that should be handled directly in checkpasswd is the case where either the userid or password are too long.  This is to prevent sending the wrong number of bytes to validate.

Note that in the given password file pass.txt, the "killerwhales:swim" has a user id that is too large, and "monkeys:eatcoconuts" has a password that is too long. The examples are expected to fail, but the other cases should work correctly.

You will find the following system calls useful: fork, exec, pipe, dup2, write, wait (along with WIFEXITED, WEXITSTATUS). You may not use popen or pclose in your solution.