/* * ErrorBox - show an error message in a dialog box */ void ErrorBox( char *str, ... ) { va_list al; char tmp[MAX_STR]; if( MessageWindow != NO_WINDOW ) { WindowAuxUpdate( MessageWindow, WIND_INFO_TEXT_COLOR, messagew_info.hilight.foreground ); WindowAuxUpdate( MessageWindow, WIND_INFO_BACKGROUND_COLOR, messagew_info.hilight.background ); va_start( al, str ); MyVSprintf( tmp, str, al ); va_end( al ); SourceError( tmp ); Message1Box( "%s", tmp ); WindowAuxUpdate( MessageWindow, WIND_INFO_TEXT_COLOR, messagew_info.text.foreground ); WindowAuxUpdate( MessageWindow, WIND_INFO_BACKGROUND_COLOR, messagew_info.text.background ); MyBeep(); } else { va_start( al, str ); #ifndef __WIN__ MyVPrintf( str, al ); MyPrintf( "\n" ); #endif va_end( al ); } } /* Error */
/* * Die - unusual termination */ void Die( const char *str, ... ) { va_list al; SetPosToMessageLine(); MyPrintf( "Failure: " ); va_start( al, str ); MyVPrintf( str, al ); va_end( al ); MyPrintf( "\n" ); ExitEditor( -1 ); } /* Die */
/* * Quit - print usage messages */ void Quit( const char **usage_msg, const char *str, ... ) { va_list al; usage_msg = usage_msg; #ifdef __WIN__ { char buff[MAX_STR]; if( str != NULL ) { va_start( al, str ); MyVSprintf( buff, str, al ); va_end( al ); } else { buff[0] = 0; } CloseStartupDialog(); UsageDialog( UsageMsg, buff, sizeof( UsageMsg ) / sizeof( char *) ); } #else { int i; int cnt; if( str != NULL ) { va_start( al, str ); MyVPrintf( str, al ); va_end( al ); cnt = 1; } else { cnt = sizeof( UsageMsg ) / sizeof( char *); } for( i = 0; i < cnt; i++ ) { MyPrintf( "%s\n", UsageMsg[i] ); } } #endif // can't do an ExitEditor because we will not have initialized anything // yet (this is always called from checkFlags) // ExitEditor( 0 ); ChangeDirectory( HomeDirectory ); FiniMem(); exit( 0 ); } /* Usage */