12
** PSIO_TOCWRITE(): Write the table of contents for file number 'unit'.
14
** \param unit = The PSI unit to which we will write the TOC.
16
** NB: This function should NOT call psio_error because the latter calls it!
20
int psio_tocwrite(unsigned int unit)
23
int errcod, volume, stream;
25
psio_tocentry *this_entry;
29
this_unit = &(psio_unit[unit]);
30
entry_size = sizeof(psio_tocentry) - 2*sizeof(psio_tocentry *);
32
if(!psio_open_check(unit)) return(1);
34
psio_wt_toclen(unit, this_unit->toclen);
36
this_entry = this_unit->toc;
37
address = psio_get_address(PSIO_ZERO, sizeof(ULI));
38
for(i=0; i < this_unit->toclen; i++) {
39
psio_rw(unit, (char *) this_entry, address, entry_size, 1);
40
this_entry = this_entry->next;
41
if(this_entry != NULL) address = this_entry->sadd;