repl: use fgets() instead of gets().

According to the man page, gets() could overflow the buffer.
This patch switches the gets() call to the safer fgets().