- start = 0;
- end = 0;
-
- char *s;
-
- int line_number = 0;
-
- while(end > start || !feof(file)) {
- eol = start;
-
- /* Look for the end of a line in what is already in the buffer */
- while(eol < end && raw_line[eol] != '\n') eol++;
-
- /* if we did not find the of a line, move what has not been
- processed and is in the buffer to the beginning of the buffer,
- fill the buffer with new data from the file, and look for the
- end of a line */
- if(eol == end) {
- for(k = 0; k < end - start; k++) {
- raw_line[k] = raw_line[k + start];
- }
- end -= start;
- eol -= start;
- start = 0;
- end += fread(raw_line + end, sizeof(char), buffer_size - end, file);
- while(eol < end && raw_line[eol] != '\n') eol++;
- }