diff --git a/freeglut/freeglut/src/freeglut_init.c b/freeglut/freeglut/src/freeglut_init.c index 36b5b4b..9949138 100644 --- a/freeglut/freeglut/src/freeglut_init.c +++ b/freeglut/freeglut/src/freeglut_init.c @@ -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 */ diff --git a/freeglut/freeglut/src/freeglut_internal.h b/freeglut/freeglut/src/freeglut_internal.h index 91e29e4..eb8def5 100644 --- a/freeglut/freeglut/src/freeglut_internal.h +++ b/freeglut/freeglut/src/freeglut_internal.h @@ -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; }; /* diff --git a/freeglut/freeglut/src/freeglut_main.c b/freeglut/freeglut/src/freeglut_main.c index c28658f..ee20be9 100644 --- a/freeglut/freeglut/src/freeglut_main.c +++ b/freeglut/freeglut/src/freeglut_main.c @@ -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" );