Sorry Dodji, I still do not see how this is supposed to work:
If the previous invocation of get_line already had read some characters of the following line(s), how is that information recovered? I see it is copied behind lineptr[cur_len]. But when get_line is re-entered, cur_len is set to zero again. and all that contents up to 16K are forgotten. Right? If an empty line of just a new-line is read, the return value of get_line is 0, and string is "". But the return value of read_line is NULL in that case. Now the function location_get_source_line will leave the while loop. But there may be more lines, propably not just empty ones? How did you test your patch? Regards Bernd.