home *** CD-ROM | disk | FTP | other *** search
/ PC-Online 1998 February / PCOnline_02_1998.iso / filesbbs / os2 / pgp263.arj / PGP263I.SRC / PGP263II.ZIP / src / zip.c < prev    next >
C/C++ Source or Header  |  1995-10-22  |  1KB  |  44 lines

  1. /* Support code for the zip/unzip code - just handles error messages.  To
  2.    get exact errors, define ZIPDEBUG */
  3.  
  4. #include <stdio.h>
  5. #include <stdlib.h>
  6. #include "usuals.h"
  7. #include "fileio.h"
  8. #include "language.h"
  9. #include "pgp.h"
  10. #include "exitpgp.h"
  11. #include "zip.h"
  12.  
  13. #include "ziperr.h" /* for ZE_MEM (and errors[] if ZIPDEBUG defined) */
  14.  
  15. /* Clean error exit: c is a ZE_-class error, *msg is an error message.
  16.    Issue a message for the error, clean up files and memory, and exit */
  17.  
  18. void err(int c, char *msg)
  19. {
  20.  
  21. #ifdef ZIPDEBUG
  22.     if (PERR(c))
  23.         perror("zip error");
  24.     fprintf(stderr, "zip error: %s (%s)\n", errors[c-1], msg);
  25. #endif /* ZIPDEBUG */
  26.  
  27.     /* Complain and return and out of memory error code */
  28.     if(c==ZE_MEM) {
  29.         fprintf( stderr, LANG("\nOut of memory\n") );
  30.         exitPGP( 7 );
  31.     } else {
  32.         fprintf(stderr,LANG("\nCompression/decompression error\n") );
  33.         /* Yuck */
  34.         exitPGP( 23 );
  35.     }
  36. }
  37.  
  38. /* Internal error, should never happen */
  39.  
  40. void error(char *msg)
  41. {
  42.     err(-1, msg);
  43. }
  44.