avoid using gets() to compile with glibc >= 2.16