pic_fflush and pic_ffill should change cursor positions

This commit is contained in:
Yuichi Nishiwaki 2014-01-16 19:51:03 +09:00
parent a5f478a7d5
commit f564626556
1 changed files with 10 additions and 2 deletions

View File

@ -69,13 +69,21 @@ pic_setvbuf(pic_file *file, char *buf, int mode, size_t bufsiz)
int
pic_fflush(pic_file *file)
{
return file->vtable.write(file->vtable.cookie, file->s, file->c - file->s);
int r;
r = file->vtable.write(file->vtable.cookie, file->s, file->c - file->s);
file->c -= r;
return r;
}
int
pic_ffill(pic_file *file)
{
return file->vtable.read(file->vtable.cookie, file->c, file->e - file->c);
int r;
r = file->vtable.read(file->vtable.cookie, file->c, file->e - file->c);
file->c += r;
return r;
}
pic_file *