diff options
Diffstat (limited to 'dviware/beebe/src/abortrun.h')
-rw-r--r-- | dviware/beebe/src/abortrun.h | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/dviware/beebe/src/abortrun.h b/dviware/beebe/src/abortrun.h new file mode 100644 index 0000000000..a7dba6cde1 --- /dev/null +++ b/dviware/beebe/src/abortrun.h @@ -0,0 +1,43 @@ +/* -*-C-*- abortrun.h */ +/*-->abortrun*/ +/**********************************************************************/ +/*************************** abortrun *******************************/ +/**********************************************************************/ + +void +abortrun(code) +int code; + +{ + /******************************************************************* + This routine is called on both success and failure to terminate + execution. All open files (except stdin, stdout, stderr) are closed + before calling EXIT() to quit. + *******************************************************************/ + + UNSIGN16 k; + + for (k = 0; k < (UNSIGN16)nopen; ++k) + if (font_files[k].font_id != (FILE*)NULL) + (void)fclose(font_files[k].font_id); + + if (dvifp != (FILE*)NULL) + (void)fclose(dvifp); + if (plotfp != (FILE*)NULL) + (void)fclose(plotfp); + if (g_dolog && (g_logfp != (FILE *)NULL)) + (void)fclose(g_logfp); + +#if (OS_TOPS20 | OS_VAXVMS) + if (code) + { + NEWLINE(stderr); + (void)fprintf(stderr,"?Aborted with error code %d",code); + NEWLINE(stderr); + (void)perror("?perror() says"); + } +#endif + + (void)EXIT(code); +} + |