From ad5130290834957a2637e899ffa847420d0510fe Mon Sep 17 00:00:00 2001 From: /dev/humancontroller Date: Mon, 8 Jun 2015 17:44:55 +0200 Subject: add missing trailing '\n's from strings to execute; add double quotes around substituted argument strings also transform trailing ';'s to '\n's --- src/cgame/cg_consolecmds.c | 2 +- src/client/cl_main.c | 2 +- src/game/g_admin.c | 4 ++-- src/game/g_maprotation.c | 2 +- src/sdl/sdl_input.c | 2 +- src/server/sv_main.c | 4 ++-- src/ui/ui_atoms.c | 2 +- src/ui/ui_main.c | 32 ++++++++++++++++---------------- src/ui/ui_shared.c | 2 +- 9 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/cgame/cg_consolecmds.c b/src/cgame/cg_consolecmds.c index c54d51fb..adae40a8 100644 --- a/src/cgame/cg_consolecmds.c +++ b/src/cgame/cg_consolecmds.c @@ -168,7 +168,7 @@ void CG_ClientList_f( void ) static void CG_UIMenu_f( void ) { - trap_SendConsoleCommand( va( "menu %s\n", CG_Argv( 1 ) ) ); + trap_SendConsoleCommand( va( "menu \"%s\"\n", CG_Argv( 1 ) ) ); } static consoleCommand_t commands[ ] = diff --git a/src/client/cl_main.c b/src/client/cl_main.c index b9c20d34..16253921 100644 --- a/src/client/cl_main.c +++ b/src/client/cl_main.c @@ -3074,7 +3074,7 @@ void CL_Frame ( int msec ) { COM_StripExtension(mapName, mapName, sizeof(mapName)); Cbuf_ExecuteText( EXEC_NOW, - va( "record %s-%s-%s", nowString, serverName, mapName ) ); + va( "record \"%s-%s-%s\"\n", nowString, serverName, mapName ) ); } else if( clc.state != CA_ACTIVE && clc.demorecording ) { // Recording, but not CA_ACTIVE, so stop recording diff --git a/src/game/g_admin.c b/src/game/g_admin.c index f15f3469..3b8dcdab 100644 --- a/src/game/g_admin.c +++ b/src/game/g_admin.c @@ -2021,7 +2021,7 @@ qboolean G_admin_changemap( gentity_t *ent ) admin_log( map ); admin_log( layout ); - trap_SendConsoleCommand( EXEC_APPEND, va( "map %s", map ) ); + trap_SendConsoleCommand( EXEC_APPEND, va( "map \"%s\"\n", map ) ); level.restarted = qtrue; AP( va( "print \"^3changemap: ^7map '%s' started by %s^7 %s\n\"", map, ( ent ) ? ent->client->pers.netname : "console", @@ -2724,7 +2724,7 @@ qboolean G_admin_restart( gentity_t *ent ) !Q_stricmp( teampref, "keepteamslock" ) ) trap_Cvar_Set( "g_lockTeamsAtStart", "1" ); - trap_SendConsoleCommand( EXEC_APPEND, "map_restart" ); + trap_SendConsoleCommand( EXEC_APPEND, "map_restart\n" ); AP( va( "print \"^3restart: ^7map restarted by %s %s %s\n\"", ( ent ) ? ent->client->pers.netname : "console", diff --git a/src/game/g_maprotation.c b/src/game/g_maprotation.c index 082815b9..e9f87b37 100644 --- a/src/game/g_maprotation.c +++ b/src/game/g_maprotation.c @@ -869,7 +869,7 @@ static void G_IssueMapChange( int index, int rotation ) trap_Cvar_Set( "g_layouts", map->layouts ); } - trap_SendConsoleCommand( EXEC_APPEND, va( "map %s\n", map->name ) ); + trap_SendConsoleCommand( EXEC_APPEND, va( "map \"%s\"\n", map->name ) ); // Load up map defaults if g_mapConfigs is set G_MapConfigs( map->name ); diff --git a/src/sdl/sdl_input.c b/src/sdl/sdl_input.c index bb6403de..2cbdfe9a 100644 --- a/src/sdl/sdl_input.c +++ b/src/sdl/sdl_input.c @@ -886,7 +886,7 @@ static void IN_ProcessEvents( void ) break; case SDL_QUIT: - Cbuf_ExecuteText(EXEC_NOW, "quit Closed window\n"); + Cbuf_ExecuteText(EXEC_NOW, "quit \"Closed window\"\n"); break; case SDL_WINDOWEVENT: diff --git a/src/server/sv_main.c b/src/server/sv_main.c index 16bae3ab..6082c998 100644 --- a/src/server/sv_main.c +++ b/src/server/sv_main.c @@ -1081,13 +1081,13 @@ void SV_Frame( int msec ) { // 2giga-milliseconds = 23 days, so it won't be too often if ( svs.time > 0x70000000 ) { SV_Shutdown( "Restarting server due to time wrapping" ); - Cbuf_AddText( va( "map %s\n", Cvar_VariableString( "mapname" ) ) ); + Cbuf_AddText( va( "map \"%s\"\n", Cvar_VariableString( "mapname" ) ) ); return; } // this can happen considerably earlier when lots of clients play and the map doesn't change if ( svs.nextSnapshotEntities >= 0x7FFFFFFE - svs.numSnapshotEntities ) { SV_Shutdown( "Restarting server due to numSnapshotEntities wrapping" ); - Cbuf_AddText( va( "map %s\n", Cvar_VariableString( "mapname" ) ) ); + Cbuf_AddText( va( "map \"%s\"\n", Cvar_VariableString( "mapname" ) ) ); return; } diff --git a/src/ui/ui_atoms.c b/src/ui/ui_atoms.c index c6135dd7..6f99c604 100644 --- a/src/ui/ui_atoms.c +++ b/src/ui/ui_atoms.c @@ -187,7 +187,7 @@ static void UI_Me_f( void ) UI_ConcatArgs( 1, buf, sizeof( buf ) ); - trap_Cmd_ExecuteText( EXEC_APPEND, va( "say \"/me %s\"", buf ) ); + trap_Cmd_ExecuteText( EXEC_APPEND, va( "say \"/me %s\"\n", buf ) ); } struct uicmd diff --git a/src/ui/ui_main.c b/src/ui/ui_main.c index 95aed52b..9f7aacc7 100644 --- a/src/ui/ui_main.c +++ b/src/ui/ui_main.c @@ -2862,7 +2862,7 @@ static void UI_RunMenuScript( char **args ) if( Q_stricmp( name, "StartServer" ) == 0 ) { trap_Cvar_SetValue( "dedicated", Com_Clamp( 0, 2, ui_dedicated.integer ) ); - trap_Cmd_ExecuteText( EXEC_APPEND, va( "wait ; wait ; map %s\n", + trap_Cmd_ExecuteText( EXEC_APPEND, va( "wait ; wait ; map \"%s\"\n", uiInfo.mapList[ui_selectedMap.integer].mapLoadName ) ); } else if( Q_stricmp( name, "resetDefaults" ) == 0 ) @@ -3036,19 +3036,19 @@ static void UI_RunMenuScript( char **args ) if( uiInfo.previewMovie >= 0 ) trap_CIN_StopCinematic( uiInfo.previewMovie ); - trap_Cmd_ExecuteText( EXEC_APPEND, va( "cinematic %s.roq 2\n", uiInfo.movieList[uiInfo.movieIndex] ) ); + trap_Cmd_ExecuteText( EXEC_APPEND, va( "cinematic \"%s.roq\" 2\n", uiInfo.movieList[uiInfo.movieIndex] ) ); } else if( Q_stricmp( name, "RunMod" ) == 0 ) { trap_Cvar_Set( "fs_game", uiInfo.modList[uiInfo.modIndex].modName ); - trap_Cmd_ExecuteText( EXEC_APPEND, "vid_restart;" ); + trap_Cmd_ExecuteText( EXEC_APPEND, "vid_restart\n" ); } else if( Q_stricmp( name, "RunDemo" ) == 0 ) - trap_Cmd_ExecuteText( EXEC_APPEND, va( "demo %s\n", uiInfo.demoList[uiInfo.demoIndex] ) ); + trap_Cmd_ExecuteText( EXEC_APPEND, va( "demo \"%s\"\n", uiInfo.demoList[uiInfo.demoIndex] ) ); else if( Q_stricmp( name, "Tremulous" ) == 0 ) { trap_Cvar_Set( "fs_game", "" ); - trap_Cmd_ExecuteText( EXEC_APPEND, "vid_restart;" ); + trap_Cmd_ExecuteText( EXEC_APPEND, "vid_restart\n" ); } else if( Q_stricmp( name, "closeJoin" ) == 0 ) { @@ -3124,7 +3124,7 @@ static void UI_RunMenuScript( char **args ) } } else if( Q_stricmp( name, "Quit" ) == 0 ) - trap_Cmd_ExecuteText( EXEC_APPEND, "quit" ); + trap_Cmd_ExecuteText( EXEC_APPEND, "quit\n" ); else if( Q_stricmp( name, "Leave" ) == 0 ) { trap_Cmd_ExecuteText( EXEC_APPEND, "disconnect\n" ); @@ -3160,7 +3160,7 @@ static void UI_RunMenuScript( char **args ) { if( ui_selectedMap.integer >= 0 && ui_selectedMap.integer < uiInfo.mapCount ) { - trap_Cmd_ExecuteText( EXEC_APPEND, va( "callvote map %s\n", + trap_Cmd_ExecuteText( EXEC_APPEND, va( "callvote map \"%s\"\n", uiInfo.mapList[ui_selectedMap.integer].mapLoadName ) ); } } @@ -3168,7 +3168,7 @@ static void UI_RunMenuScript( char **args ) { if( ui_selectedMap.integer >= 0 && ui_selectedMap.integer < uiInfo.mapCount ) { - trap_Cmd_ExecuteText( EXEC_APPEND, va( "callvote nextmap %s\n", + trap_Cmd_ExecuteText( EXEC_APPEND, va( "callvote nextmap \"%s\"\n", uiInfo.mapList[ui_selectedMap.integer].mapLoadName ) ); } } @@ -3179,9 +3179,9 @@ static void UI_RunMenuScript( char **args ) char buffer[ MAX_CVAR_VALUE_STRING ]; trap_Cvar_VariableStringBuffer( "ui_reason", buffer, sizeof( buffer ) ); - trap_Cmd_ExecuteText( EXEC_APPEND, va( "callvote kick %d %s\n", + trap_Cmd_ExecuteText( EXEC_APPEND, va( "callvote kick %d%s\n", uiInfo.clientNums[ uiInfo.playerIndex ], - buffer ) ); + ( buffer[ 0 ] ? va( " \"%s\"", buffer ) : "" ) ) ); trap_Cvar_Set( "ui_reason", "" ); } } @@ -3192,9 +3192,9 @@ static void UI_RunMenuScript( char **args ) char buffer[ MAX_CVAR_VALUE_STRING ]; trap_Cvar_VariableStringBuffer( "ui_reason", buffer, sizeof( buffer ) ); - trap_Cmd_ExecuteText( EXEC_APPEND, va( "callvote mute %d %s\n", + trap_Cmd_ExecuteText( EXEC_APPEND, va( "callvote mute %d%s\n", uiInfo.clientNums[ uiInfo.playerIndex ], - buffer ) ); + ( buffer[ 0 ] ? va( " \"%s\"", buffer ) : "" ) ) ); trap_Cvar_Set( "ui_reason", "" ); } } @@ -3213,9 +3213,9 @@ static void UI_RunMenuScript( char **args ) char buffer[ MAX_CVAR_VALUE_STRING ]; trap_Cvar_VariableStringBuffer( "ui_reason", buffer, sizeof( buffer ) ); - trap_Cmd_ExecuteText( EXEC_APPEND, va( "callteamvote kick %d %s\n", + trap_Cmd_ExecuteText( EXEC_APPEND, va( "callteamvote kick %d%s\n", uiInfo.teamClientNums[ uiInfo.teamPlayerIndex ], - buffer ) ); + ( buffer[ 0 ] ? va( " \"%s\"", buffer ) : "" ) ) ); trap_Cvar_Set( "ui_reason", "" ); } } @@ -3226,9 +3226,9 @@ static void UI_RunMenuScript( char **args ) char buffer[ MAX_CVAR_VALUE_STRING ]; trap_Cvar_VariableStringBuffer( "ui_reason", buffer, sizeof( buffer ) ); - trap_Cmd_ExecuteText( EXEC_APPEND, va( "callteamvote denybuild %d %s\n", + trap_Cmd_ExecuteText( EXEC_APPEND, va( "callteamvote denybuild %d%s\n", uiInfo.teamClientNums[ uiInfo.teamPlayerIndex ], - buffer ) ); + ( buffer[ 0 ] ? va( " \"%s\"", buffer ) : "" ) ) ); trap_Cvar_Set( "ui_reason", "" ); } } diff --git a/src/ui/ui_shared.c b/src/ui/ui_shared.c index b027b513..1ba758ad 100644 --- a/src/ui/ui_shared.c +++ b/src/ui/ui_shared.c @@ -1840,7 +1840,7 @@ void Script_Exec( itemDef_t *item, char **args ) const char *val; if( String_Parse( args, &val ) ) - DC->executeText( EXEC_APPEND, va( "%s ; ", val ) ); + DC->executeText( EXEC_APPEND, va( "%s\n", val ) ); } void Script_Play( itemDef_t *item, char **args ) -- cgit