Skip to content

Instantly share code, notes, and snippets.

@madx
Created May 9, 2010 17:17
Show Gist options
  • Save madx/395283 to your computer and use it in GitHub Desktop.
Save madx/395283 to your computer and use it in GitHub Desktop.
void sgf_append_block(OFILE* file) {
TBLOCK b;
int adr;
adr = alloc_block ();
if (adr <= 0) panic ("Disque plein");
set_fat (adr, FAT_EOF);
/* Aucun bloc pour l'instant */
if (file->first == FAT_EOF) {
file->first = file->last = adr;
} else {
/* Plusieurs blocs */
set_fat (file->last, adr);
file->last = adr;
}
write_block (adr, &file->buffer);
b.inode.length = file->ptr;
b.inode.first = file->first;
b.inode.last = file->last;
write_block (file->inode, &b.data);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment