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

« back to all changes in this revision

Viewing changes to src/lib/libpsio/error.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 error.c
3
 
** \ingroup (PSIO)
4
 
*/
5
 
 
6
 
#include <stdio.h>
7
 
#include <stdlib.h>
8
 
#include "psio.h"
9
 
#include <psifiles.h>
10
 
 
11
 
/*!
12
 
** \ingroup (PSIO)
13
 
**
14
 
** PSIO_ERROR(): Print out an error message for libpsio.
15
 
**
16
 
** \param unit   = file number
17
 
** \param errval = error code (defined symbolically, PSIO_ERROR_XXX)
18
 
**
19
 
*/
20
 
void psio_error(unsigned int unit, unsigned int errval)
21
 
{
22
 
  int i;
23
 
 
24
 
  fprintf(stderr, "PSIO_ERROR: unit = %d\n", unit);
25
 
  /* Try to save the TOCs for all open units */
26
 
  /* psio_tocwrite() does not call psio_error() so this is OK */
27
 
  for(i=0; i < PSIO_MAXUNIT; i++) psio_tocwrite(i);
28
 
 
29
 
  switch(errval) {
30
 
  case PSIO_ERROR_INIT:
31
 
    fprintf(stderr, "PSIO_ERROR: %d (I/O inititalization failed)\n", PSIO_ERROR_INIT);
32
 
    break;
33
 
  case PSIO_ERROR_DONE:
34
 
    fprintf(stderr, "PSIO_ERROR: %d (I/O cleanup failed)\n", PSIO_ERROR_DONE);
35
 
    break;
36
 
  case PSIO_ERROR_MAXVOL:
37
 
    fprintf(stderr, "PSIO_ERROR: %d (maximum number of volumes exceeded)\n", PSIO_ERROR_MAXVOL);
38
 
    break;
39
 
  case PSIO_ERROR_NOVOLPATH:
40
 
    fprintf(stderr, "PSIO_ERROR: %d (no volume path given)\n", PSIO_ERROR_NOVOLPATH);
41
 
    break;
42
 
  case PSIO_ERROR_IDENTVOLPATH:
43
 
    fprintf(stderr, "PSIO_ERROR: %d (two identical volume paths)\n", PSIO_ERROR_IDENTVOLPATH);
44
 
    break;
45
 
  case PSIO_ERROR_OPEN:
46
 
    fprintf(stderr, "PSIO_ERROR: %d (file not open or open call failed)\n", PSIO_ERROR_OPEN);
47
 
    break;
48
 
  case PSIO_ERROR_REOPEN:
49
 
    fprintf(stderr, "PSIO_ERROR: %d (file is already open)\n", PSIO_ERROR_REOPEN);
50
 
    break;
51
 
  case PSIO_ERROR_CLOSE:
52
 
    fprintf(stderr, "PSIO_ERROR: %d (file close failed)\n", PSIO_ERROR_CLOSE);
53
 
    break;
54
 
  case PSIO_ERROR_RECLOSE:
55
 
    fprintf(stderr, "PSIO_ERROR: %d (file is already closed)\n", PSIO_ERROR_RECLOSE);
56
 
    break;
57
 
  case PSIO_ERROR_OSTAT:
58
 
    fprintf(stderr, "PSIO_ERROR: %d (invalid status flag for file open)\n", PSIO_ERROR_OSTAT);
59
 
    break;
60
 
  case PSIO_ERROR_LSEEK:
61
 
    fprintf(stderr, "PSIO_ERROR: %d (lseek failed)\n", PSIO_ERROR_LSEEK);
62
 
    break;
63
 
  case PSIO_ERROR_NOTOCENT:
64
 
    fprintf(stderr, "PSIO_ERROR: %d (no such TOC entry)\n", PSIO_ERROR_NOTOCENT);
65
 
    break;
66
 
  case PSIO_ERROR_TOCENTSZ:
67
 
    fprintf(stderr, "PSIO_ERROR: %d (TOC entry size mismatch)\n", PSIO_ERROR_TOCENTSZ);
68
 
    break;
69
 
  case PSIO_ERROR_KEYLEN:
70
 
    fprintf(stderr, "PSIO_ERROR: %d (TOC key too long)\n", PSIO_ERROR_KEYLEN);
71
 
    break;
72
 
  case PSIO_ERROR_BLKSIZ:
73
 
    fprintf(stderr, "PSIO_ERROR: %d (Requested blocksize invalid)\n", PSIO_ERROR_BLKSIZ);
74
 
    break;
75
 
  case PSIO_ERROR_BLKSTART:
76
 
    fprintf(stderr, "PSIO_ERROR: %d (Incorrect block start address)\n", PSIO_ERROR_BLKSTART);
77
 
    break;
78
 
  case PSIO_ERROR_BLKEND:
79
 
    fprintf(stderr, "PSIO_ERROR: %d (Incorrect block end address)\n", PSIO_ERROR_BLKEND);
80
 
    break;
81
 
  case PSIO_ERROR_MAXUNIT:
82
 
    fprintf(stderr, "PSIO_ERROR: %d (Maximum unit number exceeded)\n", PSIO_ERROR_MAXUNIT);
83
 
    fprintf(stderr, "Open failed because unit %d exceeds ", unit);
84
 
    fprintf(stderr, "PSIO_MAXUNIT = %d.\n", PSIO_MAXUNIT);
85
 
    break;
86
 
  }
87
 
  exit(PSI_RETURN_FAILURE);
88
 
}