[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: getpass.c

On Mon, 23 Jun 1997, Andreas Schwab wrote:

> |> 	    while (((c = fgetc(tty)) != '\n') && ((int) c != EOF))
>                                                   ^^^^^
> This cast is unnecessary and misleading, it should be removed.  If `c' is
> declared `char' then it is a bad bug that should be fixed RSN.

Done.  I had declared 'c' as a char, because I thought (wrongly)
that was the type fgetc returned.

> |> 	  else if ((buf[l-1] == '\n') || ((int) buf[l-1] == EOF)) 
>                                          ^^^^^^^^^^^^^^^^^^^^^^
> It doesn't make sense to check for EOF in a string, because no character
> can ever have the value EOF.


Thanks for the help.