The following routine reads a file name from the standard input
and returns its protection mode. It treats the argument as a file
name, and returns the protection mode of the file as a short integer.
Identify three non-robust features of this routine, and state how
to fix them.
/* return protection mode of the named file */
short int protmode(void)
{
struct stat stbuf;
char inbuf[100];
gets(inbuf);
stat(inbuf, &stbuf);
return(stbuf.st_mode&0777);
}