Don't ignore the last line of config file (/etc/hosts, /etc/services, etc)

which doesn't end in \n, since it may be very confusing. Also this should
increase consistency, since most other config files work just fine regardless
of the presence of traling \n in the last line.

MFC After:	2 weeks
This commit is contained in:
Maxim Sobolev 2005-01-03 11:07:45 +00:00
parent a8ef988f65
commit 7b6cc40479
5 changed files with 12 additions and 15 deletions

View File

@ -2070,9 +2070,9 @@ _gethtent(name, pai)
return (NULL);
if (*p == '#')
goto again;
if (!(cp = strpbrk(p, "#\n")))
goto again;
*cp = '\0';
cp = strpbrk(p, "#\n");
if (cp != NULL)
*cp = '\0';
if (!(cp = strpbrk(p, " \t")))
goto again;
*cp++ = '\0';

View File

@ -118,9 +118,9 @@ gethostent()
}
if (*p == '#')
goto again;
if (!(cp = strpbrk(p, "#\n")))
goto again;
*cp = '\0';
cp = strpbrk(p, "#\n");
if (cp != NULL)
*cp = '\0';
if (!(cp = strpbrk(p, " \t")))
goto again;
*cp++ = '\0';

View File

@ -105,9 +105,8 @@ getnetent()
if (*p == '#')
goto again;
cp = strpbrk(p, "#\n");
if (cp == NULL)
goto again;
*cp = '\0';
if (cp != NULL)
*cp = '\0';
net.n_name = p;
cp = strpbrk(p, " \t");
if (cp == NULL)

View File

@ -87,9 +87,8 @@ getprotoent()
if (*p == '#')
goto again;
cp = strpbrk(p, "#\n");
if (cp == NULL)
goto again;
*cp = '\0';
if (cp != NULL)
*cp = '\0';
proto.p_name = p;
cp = strpbrk(p, " \t");
if (cp == NULL)

View File

@ -244,9 +244,8 @@ getservent()
if (*p == '#')
goto again;
cp = strpbrk(p, "#\n");
if (cp == NULL)
goto again;
*cp = '\0';
if (cp != NULL)
*cp = '\0';
serv.s_name = p;
p = strpbrk(p, " \t");
if (p == NULL)