Fixed the buglet about failing to report the program's name on error-

messages.  Please test.  (Modified glutInit(), the state structure,
and the warn/err functions.)


git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@238 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
rkrolib 2003-10-26 04:39:27 +00:00
parent fb3db77b9a
commit 04c6d13777
3 changed files with 9 additions and 5 deletions

View File

@ -379,6 +379,10 @@ void FGAPIENTRY glutInit( int* pargc, char** argv )
char* displayName = NULL;
int i, j, argc = *pargc;
if (pargc && *pargc && argv && *argv && **argv)
fgState.ProgramName = strdup (*argv);
else
fgState.ProgramName = strdup ("");
/*
* Do not allow multiple initialization of the library
*/

View File

@ -244,9 +244,9 @@ struct tagSFG_State
int GameModeDepth; /* The pixel depth for game mode */
int GameModeRefresh; /* The refresh rate for game mode */
int ActionOnWindowClose ; /* Action when user clicks "x" on window header bar */
fgExecutionState ExecState ; /* Current state of the GLUT execution */
int ActionOnWindowClose; /* Action when user clicks "x" on window header bar */
fgExecutionState ExecState; /* Current state of the GLUT execution */
char *ProgramName;
};
/*

View File

@ -396,7 +396,7 @@ void fgError( const char *fmt, ... )
va_start( ap, fmt );
fprintf( stderr, "freeglut: ");
fprintf( stderr, "freeglut (%s): ", fgState.ProgramName || "");
vfprintf( stderr, fmt, ap );
fprintf( stderr, "\n" );
@ -411,7 +411,7 @@ void fgWarning( const char *fmt, ... )
va_start( ap, fmt );
fprintf( stderr, "freeglut: ");
fprintf( stderr, "freeglut (%s): ", fgState.ProgramName || "");
vfprintf( stderr, fmt, ap );
fprintf( stderr, "\n" );