static void RcIoPrintHelp( void ) /*******************************/ { char progfname[_MAX_FNAME]; int index; char buf[256]; OutPutInfo errinfo; char imageName[_MAX_PATH]; _cmdname( imageName ); InitOutPutInfo( &errinfo ); errinfo.severity = SEV_BANNER; #ifdef __OSI__ if( _Copyright != NULL ) { RcMsgFprintf( stdout, &errinfo, "%s\n", _Copyright ); } #endif _splitpath( imageName, NULL, NULL, progfname, NULL ); strlwr( progfname ); index = USAGE_MSG_FIRST; GetRcMsg( index, buf, sizeof( buf ) ); RcMsgFprintf( stdout, &errinfo, buf, progfname ); RcMsgFprintf( stdout, &errinfo, "\n" ); for( ++index; index <= USAGE_MSG_LAST; index++ ) { GetRcMsg( index, buf, sizeof( buf ) ); RcMsgFprintf( stdout, &errinfo, "%s\n", buf ); } }
static void RcIoPrintBanner( void ) /*********************************/ { OutPutInfo errinfo; InitOutPutInfo( &errinfo ); errinfo.severity = SEV_BANNER; RcMsgFprintf( stderr, &errinfo, BannerText ); }
static void flushPrintf( void ) { /********************************/ OutPutInfo info; if( curBufPos != formatBuffer ) { InitOutPutInfo( &info ); info.severity = SEV_WARNING; RcMsgFprintf( NULL, &info, "\n" ); } }
static void RcMsgV( unsigned errornum, OutputSeverity sev, va_list arglist ) /***************************************************************************/ { const LogicalFileInfo *currfile; OutPutInfo errinfo; InitOutPutInfo( &errinfo ); errinfo.severity = sev; errinfo.flags |= OUTFLAG_ERRID; errinfo.errid = errornum; switch (errornum) { case ERR_CANT_OPEN_FILE: case ERR_READING_TMP: case ERR_WRITTING_TMP: case ERR_OPENING_TMP: case ERR_UNEXPECTED_EOF: case ERR_WRITTING_FILE: case ERR_READING_FILE: case ERR_WRITTING_RES_FILE: case ERR_CANT_FIND_FILE: case ERR_FILENAME_NEEDED: case ERR_NO_OPT_SPECIFIED: case ERR_NOT_BITMAP_FILE: case ERR_NOT_CURSOR_FILE: case ERR_NOT_ICON_FILE: case ERR_NOT_VALID_EXE: case ERR_OUT_OF_MEMORY: case ERR_PARSER_INTERNAL: case ERR_RENAMEING_TMP_FILE: case ERR_TOO_MANY_ARGS: case ERR_UNKNOWN_MULT_OPTION: case ERR_UNKNOWN_OPTION: case ERR_NONNT_RES_TO_NT_EXE: case ERR_NONWIN_RES_TO_WIN_EXE: case ERR_NONOS2_RES_TO_OS2_EXE: case ERR_OLD_RESOURCE_OBJECT: case ERR_READING_EXE: case ERR_READING_ICON: case ERR_READING_CURSOR: case ERR_READING_BITMAP: case ERR_READING_FONT: case ERR_READING_DATA: case ERR_READING_RES: case ERR_BAD_RES_VER: case ERR_INVALID_RES: case ERR_INTERNAL: /* don't print the filename & line number before these errors */ GetRcMsg( errornum, errBuffer, sizeof( errBuffer ) ); vsprintf( rcStrBuf, errBuffer, arglist ); sprintf( errBuffer, "%s", rcStrBuf ); break; case ERR_RCSTR_NOT_FOUND: /* this message means the error strings cannot be obtained from * the exe so its text is hard coded */ sprintf( errBuffer, "Resource strings not found" ); break; case ERR_NO_MSG: /* dont print anything */ return; default: GetRcMsg( errornum, errBuffer, sizeof( errBuffer ) ); vsprintf( rcStrBuf, errBuffer, arglist ); currfile = RcIoGetLogicalFileInfo(); if (currfile != NULL) { errinfo.flags |= OUTFLAG_FILE | OUTFLAG_LINE; errinfo.file = currfile->Filename; errinfo.lineno = currfile->LineNum; } sprintf( errBuffer, "%s", rcStrBuf ); break; } RcMsgFprintf( stdout, &errinfo, "%s\n", errBuffer ); }
static void RcMsgV( unsigned errornum, OutputSeverity sev, va_list arglist ) /***************************************************************************/ { const LogicalFileInfo *currfile; int len; const char *prefix; OutPutInfo errinfo; InitOutPutInfo( &errinfo ); errinfo.severity = sev; errinfo.flags |= OUTFLAG_ERRID; errinfo.errid = errornum; switch( sev ) { case SEV_WARNING: prefix = "Warning!"; break; case SEV_ERROR: prefix = "Error!"; break; case SEV_FATAL_ERR: prefix = "Fatal Error!"; break; default: prefix = ""; break; } switch (errornum) { case ERR_CANT_OPEN_FILE: case ERR_READING_TMP: case ERR_WRITTING_TMP: case ERR_OPENING_TMP: case ERR_UNEXPECTED_EOF: case ERR_WRITTING_FILE: case ERR_READING_FILE: case ERR_WRITTING_RES_FILE: case ERR_CANT_FIND_FILE: case ERR_FILENAME_NEEDED: case ERR_NO_OPT_SPECIFIED: case ERR_NOT_BITMAP_FILE: case ERR_NOT_CURSOR_FILE: case ERR_NOT_ICON_FILE: case ERR_NOT_VALID_EXE: case ERR_OUT_OF_MEMORY: case ERR_PARSER_INTERNAL: case ERR_RENAMEING_TMP_FILE: case ERR_TOO_MANY_ARGS: case ERR_UNKNOWN_MULT_OPTION: case ERR_UNKNOWN_OPTION: case ERR_NONNT_RES_TO_NT_EXE: case ERR_NONWIN_RES_TO_WIN_EXE: case ERR_NONOS2_RES_TO_OS2_EXE: case ERR_OLD_RESOURCE_OBJECT: case ERR_READING_EXE: case ERR_READING_ICON: case ERR_READING_CURSOR: case ERR_READING_BITMAP: case ERR_READING_FONT: case ERR_READING_DATA: case ERR_READING_RES: case ERR_BAD_RES_VER: case ERR_INVALID_RES: case ERR_INTERNAL: /* don't print the filename & line number before these errors */ GetRcMsg( errornum, errBuffer, sizeof( errBuffer ) ); vsprintf( rcStrBuf, errBuffer, arglist ); sprintf( errBuffer, "%s %d: %n%s", prefix, errornum, &len, rcStrBuf ); break; case ERR_RCSTR_NOT_FOUND: /* this message means the error strings cannot be obtained from * the exe so its text is hard coded */ sprintf( errBuffer, "%s %d: %nResource strings not found", prefix, errornum, &len ); break; case ERR_NO_MSG: /* dont print anything */ return; default: GetRcMsg( errornum, errBuffer, sizeof( errBuffer ) ); vsprintf( rcStrBuf, errBuffer, arglist ); currfile = RcIoGetLogicalFileInfo(); if (currfile != NULL) { errinfo.flags |= OUTFLAG_FILE | OUTFLAG_LINE; errinfo.file = currfile->Filename; errinfo.lineno = currfile->LineNum; #if !defined( DLL_COMPILE ) sprintf( errBuffer, "%s(%d): %s %d: %n%s", currfile->Filename, currfile->LineNum, prefix, errornum, &len, rcStrBuf ); #else sprintf( errBuffer, "%s %d: %n%s", prefix, errornum, &len, rcStrBuf ); #endif } else { sprintf( errBuffer, "%s %d: %n%s", prefix, errornum, &len, rcStrBuf ); } break; } #if defined( DLL_COMPILE ) || defined( WR_COMPILED ) RcFprintf( stdout, &errinfo, "%s\n", errBuffer ); #else { int indent; char *start; char *end; indent = 0; start = errBuffer; while( strlen( start ) > MAX_LINE_LEN - indent ) { end = start + MAX_LINE_LEN - indent; while( !isspace( *end ) && end > start ) end--; if( end != start ) { *end = '\0'; } else { break; } RcFprintf( stdout, &errinfo, "%*s%s\n", indent, "", start ); start = end + 1; indent = len; } RcFprintf( stdout, &errinfo, "%*s%s\n", indent, "", start ); } #endif }