1/*
2  Copyright (c) 1990-2008 Info-ZIP.  All rights reserved.
3
4  See the accompanying file LICENSE, version 2007-Mar-4 or later
5  (the contents of which are also included in zip.h) for terms of use.
6  If, for some reason, all these files are missing, the Info-ZIP license
7  also may be found at:  ftp://ftp.info-zip.org/pub/infozip/license.html
8*/
9/*---------------------------------------------------------------------------
10
11  zbz2err.c
12
13  This file contains the "fatal error" callback routine required by the
14  "minimal" (silent, non-stdio) setup of the bzip2 compression library.
15
16  The fatal bzip2 error bail-out routine is provided in a separate code
17  module, so that it can be easily overridden when the Zip package is
18  used as a static link library. One example is the WinDLL static library
19  usage for building a monolithic binary of the Windows application "WiZ"
20  that supports bzip2 both in compression and decompression operations.
21
22  Contains:  bz_internal_error()      (BZIP2_SUPPORT only)
23
24  Adapted from UnZip ubz2err.c, with all the DLL fine print stripped
25  out.
26
27  ---------------------------------------------------------------------------*/
28
29
30#define __ZBZ2ERR_C     /* identifies this source module */
31
32#include "zip.h"
33
34#ifdef BZIP2_SUPPORT
35# ifdef BZIP2_USEBZIP2DIR
36#   include "bzip2/bzlib.h"
37# else
38    /* If IZ_BZIP2 is defined as the location of the bzip2 files then
39       assume the location has been added to include path.  For Unix
40       this is done by the configure script. */
41    /* Also do not need path for bzip2 include if OS includes support
42       for bzip2 library. */
43#   include "bzlib.h"
44# endif
45
46/**********************************/
47/*  Function bz_internal_error()  */
48/**********************************/
49
50/* Call-back function for the bzip2 decompression code (compiled with
51 * BZ_NO_STDIO), required to handle fatal internal bug-type errors of
52 * the bzip2 library.
53 */
54void bz_internal_error(errcode)
55    int errcode;
56{
57    sprintf(errbuf, "fatal error (code %d) in bzip2 library", errcode);
58    ziperr(ZE_LOGIC, errbuf);
59} /* end function bz_internal_error() */
60
61#endif /* def BZIP2_SUPPORT */
62