/* * libetc.c * Creation date: Nov 14 2000 * Author: Y.Nakaune */ #include #include #include #include "daq.h" /*---------------------------------------------------------- exit_err ---------------------------------------------------------*/ void exit_err( char *mess ) { if( errno > 0 && errno < sys_nerr ){ fprintf( stderr, "%s: %s\n", mess, sys_errlist[errno] ); } else{ fprintf( stderr, "%s\n", mess ); } exit(-1); } /*--------------------------------------------------------- read_flag Read Flag from fp -------------------------------------------------------*/ unsigned int read_flag( FILE *fp ) { unsigned int flag; if( fread( &flag, 1, sizeof(int), fp ) != sizeof(int) ){ perror( "Read flag" ); return ERR_FLG; } clearerr( fp ); return flag; } /*--------------------------------------------------------- terminate Termination Process for SIGTERM -------------------------------------------------------*/ void terminate( int sig ) { fprintf( stderr, " INT/TERM signal \n"); signal_term_flag = 1; signal( sig, (void(*)())terminate ); } /*-----------End of File-----------------------------------------------------*/