only remove final \n if there's one

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@1981 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Assar Westerlund
1997-07-06 21:36:22 +00:00
parent 48d74593a1
commit 7dd6d4bcbd

View File

@@ -42,7 +42,8 @@ parse_list(FILE *f, unsigned *lineno, krb5_config_binding **parent)
for (; fgets(buf, sizeof(buf), f) != NULL; ++*lineno) { for (; fgets(buf, sizeof(buf), f) != NULL; ++*lineno) {
char *p; char *p;
buf[strlen(buf) - 1] = '\0'; if (buf[strlen(buf) - 1] == '\n')
buf[strlen(buf) - 1] = '\0';
p = buf; p = buf;
while(isspace(*p)) while(isspace(*p))
++p; ++p;
@@ -118,7 +119,8 @@ krb5_config_parse_file (const char *fname, krb5_config_section **res)
for (lineno = 1; fgets(buf, sizeof(buf), f) != NULL; ++lineno) { for (lineno = 1; fgets(buf, sizeof(buf), f) != NULL; ++lineno) {
char *p; char *p;
buf[strlen(buf) - 1] = '\0'; if(buf[strlen(buf) - 1] == '\n')
buf[strlen(buf) - 1] = '\0';
p = buf; p = buf;
while(isspace(*p)) while(isspace(*p))
++p; ++p;