home *** CD-ROM | disk | FTP | other *** search
/ RISC DISC 2 / RISC_DISC_2.iso / pd_share / utilities / cli / pgp2 / src / c / zip < prev    next >
Encoding:
Text File  |  1994-08-04  |  970 b   |  43 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.  
  12. #include "ziperr.h" /* for ZE_MEM (and errors[] if ZIPDEBUG defined) */
  13.  
  14. /* Clean error exit: c is a ZE_-class error, *msg is an error message.
  15.    Issue a message for the error, clean up files and memory, and exit */
  16.  
  17. void err(int c, char *msg)
  18. {
  19.  
  20. #ifdef ZIPDEBUG
  21.     if (PERR(c))
  22.         perror("zip error");
  23.     fprintf(stderr, "zip error: %s (%s)\n", errors[c-1], msg);
  24. #endif /* ZIPDEBUG */
  25.  
  26.     /* Complain and return and out of memory error code */
  27.     if(c==ZE_MEM) {
  28.         fprintf( stderr, LANG("\nOut of memory\n") );
  29.         exitPGP( 7 );
  30.     } else {
  31.         fprintf(stderr,LANG("\nCompression/decompression error\n") );
  32.         /* Yuck */
  33.         exitPGP( 23 );
  34.     }
  35. }
  36.  
  37. /* Internal error, should never happen */
  38.  
  39. void error(char *msg)
  40. {
  41.     err(-1, msg);
  42. }
  43.