#include #include #include #include "os.h" #include "msg_priv.h" int msg_severity( int error_code ) { return ( error_code & 0xF0000000 ); } int msg_facility( int error_code ) { return ( error_code & 0xFFF000 ); } int msg_code( int error_code ) { return ( error_code & 0xFFF ); } void msg_get_text( int error_code, char *sym_code, char *error_text ) { FILE *msg_file; char string[127+1]; char *str; int i, first, code, stat; stat = os_get_filespec( "util_err_msg_file", string ); if ( stat != OS_SUCCESS ) { strcpy( sym_code, "???" ); strcpy( error_text, "Message file does not exist!" ); return; } msg_file = fopen( string, "r" ); if ( !msg_file ) { strcpy( sym_code, "???" ); strcpy( error_text, "Message file cannot be opened!" ); return; } while ( !feof(msg_file) ) { fscanf( msg_file, "%x %s %[^\n]", &code, sym_code, string ); if ( code == error_code ) { if ( string[0] == '~' ) first = 1; else first = 0; strcpy( error_text, &string[first] ); str = strstr( error_text, "\\n" ); while ( str ) { for ( i=0; i 0 ) { printf( "%s\n", string ); } } }