|
|
1.1 ! root 1: static char ID[] = "@(#) hist.c: 1.2 6/29/82"; ! 2: #include <stdio.h> ! 3: #include "sdp.h" ! 4: #include "define3.h" ! 5: ! 6: ! 7: #ifdef SHORT ! 8: #define HI01 "HI01 " ! 9: #define HI02 "HI02 " ! 10: #define HI03 "HI03 " ! 11: #define HIAU "HIAU " ! 12: #else ! 13: #define HI01 "HI01 -- unable to close stream\n%o\n",hist_fp ! 14: #define HI02 "HI02 -- unable to close previous stream\n%o\n%s\n",hist_fp,name ! 15: #define HI03 "HI03 -- unable to open history file\n%s\n",name ! 16: #define HIAU "%s","HIAU -- audit failed in sdp_hist\n" ! 17: #endif ! 18: ! 19: #ifdef SWEET ! 20: #define PROLOG ! 21: #define EPILOG ! 22: #else ! 23: #define PROLOG if( (aud_flag == AUDITON) && (aud_check() == ERROR) )\ ! 24: ERR_RET(HIAU,NULL) ! 25: #define EPILOG if(aud_flag == AUDITON)\ ! 26: aud_set() ;\ ! 27: if(hist_fp != NULL)\ ! 28: fprintf(hist_fp,"HI\t%s\n",name) ; ! 29: #endif ! 30: ! 31: extern int aud_flag ; ! 32: extern struct LIBFILE *Glib_file ; ! 33: extern FILE *hist_fp ; ! 34: ! 35: extern aud_set() ; ! 36: extern int aud_check() ; ! 37: extern FATAL() ; ! 38: ! 39: MY_FILE * /* FILE pointer */ ! 40: sdp_hist(name) ! 41: char *name ; ! 42: { ! 43: ! 44: PROLOG ! 45: ! 46: if(name == NULL) ! 47: { ! 48: if(fclose(hist_fp) == EOF) ! 49: ERR_RET(HI01,NULL) ! 50: hist_fp = NULL ; ! 51: } ! 52: else ! 53: { ! 54: if( (hist_fp != NULL) && (fclose(hist_fp) == EOF) ) ! 55: ERR_RET(HI02,NULL) ! 56: if( (hist_fp = fopen(name,"w")) == NULL ) ! 57: ERR_RET(HI03,NULL) ! 58: } ! 59: ! 60: EPILOG ! 61: return((MY_FILE *)hist_fp) ; ! 62: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.