To remove empty and comment lines from the Jamfile cache sounds like a nice idea, but it fools the line counter and thus makes error and warning messages a quite confusing.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2283 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2002-12-22 19:18:25 +00:00
parent 201df7927c
commit 9bfac2505c
+8 -5
View File
@@ -372,13 +372,17 @@ read_file(const char *filename, string_list* list)
result = !0; result = !0;
while (result && fgets(buffer, sizeof(buffer) - 1, file)) { while (result && fgets(buffer, sizeof(buffer) - 1, file)) {
char* line = buffer; char* line = buffer;
int len = 0;
char *string = 0;
// skip leading white spaces // skip leading white spaces
while (*line == ' ' || *line == '\t' || *line == '\n') while (*line == ' ' || *line == '\t' || *line == '\n')
line++; line++;
// copy the line, if not empty or a comment line // make empty and comment lines simple new-line lines
if (*line && *line != '#') { if (!*line || *line == '#') {
int len = strlen(line); line[0] = '\n';
char *string = 0; line[1] = '\0';
}
len = strlen(line);
// make sure, the line ends in a LF // make sure, the line ends in a LF
if (line[len - 1] != '\n') { if (line[len - 1] != '\n') {
line[len] = '\n'; line[len] = '\n';
@@ -393,7 +397,6 @@ read_file(const char *filename, string_list* list)
} else } else
result = 0; result = 0;
} }
}
// close the file // close the file
fclose(file); fclose(file);
} else } else