// debug console function called to determine which player to kick void multi_dcf_kick() { int player_num,idx; // get the callsign of the player to kick dc_get_arg(ARG_STRING); if(strlen(Dc_arg) == 0){ dc_printf("Invalid player callsign!\n"); return ; } player_num = -1; for(idx=0;idx<MAX_PLAYERS;idx++){ if(MULTI_CONNECTED(Net_players[idx]) && (stricmp(Net_players[idx].player->callsign,Dc_arg)==0)){ player_num = idx; break; } } // if we didn't find the player, notify of the results if(player_num == -1){ dc_printf("Could not find player %s to kick!",Dc_arg); } // if we found the guy, then try and kick him else { multi_kick_player(player_num); } }
void debug_do_command(char * command) { int i; int mode = 0; if ( strlen(command) < 1 ) { return; } Dc_debug_on = 0; Dc_command_line = command; scanner_start_command(command); if (setjmp(dc_bad_arg) ) { return; } dc_get_arg( ARG_ANY ); if ( !strcmp( Dc_arg, "debug" ) ) { Dc_debug_on = 1; dc_printf( "Command line: '%s'\n", Dc_command_line ); dc_get_arg( ARG_ANY ); } if ( !stricmp( Dc_arg, "xyzzy" ) ) { dc_printf("Nothing happens.\n"); return; } if ( !strcmp( Dc_arg, "?" ) ) { mode = 1; dc_get_arg( ARG_ANY ); if ( Dc_arg_type&ARG_NONE ) { debug_help(); return; } } if ( !strcmp( Dc_arg, "help" ) || !strcmp( Dc_arg, "man" ) ) { mode = 2; dc_get_arg( ARG_ANY ); if ( Dc_arg_type&ARG_NONE ) { debug_help(); return; } } if ( strstr( Dc_command_line, "?" ) ) { mode = 2; } if ( !(Dc_arg_type&ARG_STRING) ) { dc_printf( "Invalid keyword '%s'\n", Dc_arg ); return; } if (Dc_debug_on) { dc_printf( "Searching for command '%s'\n", Dc_arg ); } for (i=0; i<Num_debug_commands; i++ ) { if ( !stricmp( Debug_command[i]->name, Dc_arg ) ) { if (mode==0) { if (Dc_debug_on) { dc_printf( "Calling function '%s'\n", Dc_arg ); } Dc_command = 1; Dc_help = 0; Dc_status = 1; } else if (mode==1) { if (Dc_debug_on) { dc_printf( "Checking status for '%s'\n", Dc_arg ); } Dc_command = 0; Dc_help = 0; Dc_status = 1; } else { if (Dc_debug_on) { dc_printf( "Doing help for '%s'\n", Dc_arg ); } Dc_command = 0; Dc_help = 1; Dc_status = 0; } (*Debug_command[i]->func)(); if (mode==0) { dc_get_arg(ARG_ANY); if (!(Dc_arg_type&ARG_NONE)) { dc_printf( "Ignoring the unused command line tail '%s %s'\n", Dc_arg_org, Dc_command_line ); } } return; } } dc_printf( "Unknown command '%s'\n", Dc_arg ); }