On Thu, 9 Dec 1999, Alistair Riddoch wrote:
> but as David pointed out, this is not efficient code, so I replaced it with
> his example, as shown above
I never really thought about it being efficient as such, I was more
pointing out the issue that in some instances, the \n isn't at the end of
the line. I've had some instances where the password that login.c has
read, is something like "password\nls\n". You only want the 'password'
bit, since the buffer obviously missed the 'ls\n' which is the next
command. My code simply goes for the first \n and replaces that.
If it's more efficient, then it's almost by accident :)
> - char lbuf[UT_NAMESIZE], pbuf[20], salt[3];
> + char lbuf[UT_NAMESIZE], * pbuf, salt[3];
> char * tty_name;
> int n;
Is 'n' still needed?
Davey