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:
sobomax 2005-01-03 11:07:45 +00:00
parent 4bf9384dba
commit 742d1c9a2d
5 changed files with 12 additions and 15 deletions

View File

@ -2070,9 +2070,9 @@ again:
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 @@ again:
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 @@ again:
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 @@ unpack:
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)