+ while (!end_of_file && line->offset == 0) {
+ space_pending = slash_pending = in_comment = false;
+
+ while ((ch = getc(file)) != '\n' && ch != EOF) {
+ if (ch == '\\') {
+ ch = getc(file);
+
+ if (ch == EOF)
+ break;
+
+ if (ch == '\n') {
+ in_comment = false;
+ ch = ' ';
+ }
+ }
+
+ if (in_comment)
+ continue;
+
+ if (ch == '/') {
+ if (slash_pending) {
+ in_comment = true;
+ slash_pending = false;
+ }
+ else {
+ slash_pending = true;
+ }
+
+ continue;
+ }
+
+ if (slash_pending) {
+ if (space_pending) {
+ input_line_add_char(line, ' ');
+ space_pending = false;
+ }
+
+ input_line_add_char(line, '/');
+ slash_pending = false;
+ }
+
+ if (isspace(ch)) {
+ while (isspace(ch) && ch != '\n' && ch != EOF)
+ ch = getc(file);
+
+ if (ch == EOF)
+ break;
+
+ if (ch != '\n' && line->offset > 0)
+ space_pending = true;
+
+ ungetc(ch, file);
+ }
+ else {
+ if (space_pending) {
+ input_line_add_char(line, ' ');
+ space_pending = false;
+ }
+
+ if (ch == '!') {
+ if (line->offset != 0) {
+ WARN("The '!' is legal only at start of line\n");
+ ACTION("Line containing '!' ignored\n");
+ line->offset = 0;
+ break;
+ }
+ }
+
+ input_line_add_char(line, ch);
+ }
+ }
+
+ if (ch == EOF)
+ end_of_file = true;
+ }
+
+ if (line->offset == 0 && end_of_file)
+ return false;
+
+ input_line_add_char(line, '\0');
+ return true;