~ubuntu-branches/ubuntu/karmic/psicode/karmic

« back to all changes in this revision

Viewing changes to src/lib/libpsio/tocwrite.c

  • Committer: Bazaar Package Importer
  • Author(s): Michael Banck, Michael Banck, Daniel Leidert
  • Date: 2009-02-23 00:12:02 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20090223001202-rutldoy3dimfpesc
Tags: 3.4.0-1
* New upstream release.

[ Michael Banck ]
* debian/patches/01_DESTDIR.dpatch: Refreshed.
* debian/patches/02_FHS.dpatch: Removed, applied upstream.
* debian/patches/03_debian_docdir: Likewise.
* debian/patches/04_man.dpatch: Likewise.
* debian/patches/06_466828_fix_gcc_43_ftbfs.dpatch: Likewise.
* debian/patches/07_464867_move_executables: Fixed and refreshed.
* debian/patches/00list: Adjusted.
* debian/control: Improved description.
* debian/patches-held: Removed.
* debian/rules (install/psi3): Do not ship the ruby bindings for now.

[ Daniel Leidert ]
* debian/rules: Fix txtdir via DEB_MAKE_INSTALL_TARGET.
* debian/patches/01_DESTDIR.dpatch: Refreshed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*!
2
 
   \file tocwrite.c
3
 
   \ingroup (PSIO)
4
 
*/
5
 
 
6
 
#include <stdlib.h>
7
 
#include <unistd.h>
8
 
#include "psio.h"
9
 
#include <psifiles.h>
10
 
 
11
 
/*!
12
 
** PSIO_TOCWRITE(): Write the table of contents for file number 'unit'.
13
 
**
14
 
** \param unit  = The PSI unit to which we will write the TOC.
15
 
**
16
 
** NB: This function should NOT call psio_error because the latter calls it!
17
 
**
18
 
** \ingroup (PSIO)
19
 
*/
20
 
int psio_tocwrite(unsigned int unit)
21
 
{
22
 
  unsigned int i;
23
 
  int errcod, volume, stream;
24
 
  psio_ud *this_unit;
25
 
  psio_tocentry *this_entry;
26
 
  ULI entry_size;
27
 
  psio_address address;
28
 
 
29
 
  this_unit = &(psio_unit[unit]);
30
 
  entry_size = sizeof(psio_tocentry) - 2*sizeof(psio_tocentry *);
31
 
 
32
 
  if(!psio_open_check(unit)) return(1);
33
 
 
34
 
  psio_wt_toclen(unit, this_unit->toclen);
35
 
 
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;
42
 
  }
43
 
 
44
 
  return(1);
45
 
}