home *** CD-ROM | disk | FTP | other *** search
/ rtsi.com / 2014.01.www.rtsi.com.tar / www.rtsi.com / OS9 / OSK / APPS / DVI_MGR / dvimgr_s.lzh / dvimgr / abortrun.h < prev    next >
Text File  |  1993-08-06  |  1KB  |  44 lines

  1. /* -*-C-*- abortrun.h */
  2. /*-->abortrun*/
  3. /**********************************************************************/
  4. /***************************  abortrun  *******************************/
  5. /**********************************************************************/
  6.  
  7. void
  8. abortrun(code)
  9. int code;
  10.  
  11. {
  12.     /*******************************************************************
  13.     This routine  is called  on both  success and  failure to  terminate
  14.     execution.  All open files (except stdin, stdout, stderr) are closed
  15.     before calling EXIT() to quit.
  16.     *******************************************************************/
  17.  
  18.     UNSIGN16 k;
  19.  
  20.     for (k = 0; k < (UNSIGN16)nopen; ++k)
  21.     if (font_files[k].font_id != (FILE*)NULL)
  22.         (void)fclose(font_files[k].font_id);
  23.  
  24.     if (dvifp != (FILE*)NULL)
  25.         (void)fclose(dvifp);
  26.     if (plotfp != (FILE*)NULL)
  27.         (void)fclose(plotfp);
  28.     if (g_dolog && (g_logfp != (FILE *)NULL))
  29.     (void)fclose(g_logfp);
  30.  
  31. #if    (OS_TOPS20 | OS_VAXVMS)
  32.     if (code)
  33.     {
  34.     NEWLINE(stderr);
  35.     (void)fprintf(stderr,"?Aborted with error code %d",code);
  36.     NEWLINE(stderr);
  37.     (void)perror("?perror() says");
  38.     }
  39. #endif
  40.  
  41.     (void)EXIT(code);
  42. }
  43.  
  44.