Mercurial > emacs
comparison src/fileio.c @ 7695:aba3ffcc8f51
(Finsert_file_contents): Check for beginning of file.
author | Karl Heuer <kwzh@gnu.org> |
---|---|
date | Thu, 26 May 1994 22:30:47 +0000 |
parents | f93e2ddcf8c2 |
children | fb950b66d754 |
comparison
equal
deleted
inserted
replaced
7694:92a4522c37fc | 7695:aba3ffcc8f51 |
---|---|
2710 { | 2710 { |
2711 int total_read, nread, bufpos, curpos, trial; | 2711 int total_read, nread, bufpos, curpos, trial; |
2712 | 2712 |
2713 /* At what file position are we now scanning? */ | 2713 /* At what file position are we now scanning? */ |
2714 curpos = st.st_size - (ZV - same_at_end); | 2714 curpos = st.st_size - (ZV - same_at_end); |
2715 /* If the entire file matches the buffer tail, stop the scan. */ | |
2716 if (curpos == 0) | |
2717 break; | |
2715 /* How much can we scan in the next step? */ | 2718 /* How much can we scan in the next step? */ |
2716 trial = min (curpos, sizeof buffer); | 2719 trial = min (curpos, sizeof buffer); |
2717 if (lseek (fd, curpos - trial, 0) < 0) | 2720 if (lseek (fd, curpos - trial, 0) < 0) |
2718 report_file_error ("Setting file position", | 2721 report_file_error ("Setting file position", |
2719 Fcons (filename, Qnil)); | 2722 Fcons (filename, Qnil)); |