예제 #1
0
/** Reduce any %xx escape sequences to the characters they represent. **/
void unescape_url(LString& url)
{
    register int i,j;

    for(i=0,j=0; j<url.size(); ++i,++j)
    {
        if((url.at(i) = url[j]) == '%')
        {
            url.at(i) = x2c(url.at(j+1), url.at(j+2));
            j+= 2 ;
        }
    }
    if (i < url.size())
        url.at(i) = '\0' ;
}
예제 #2
0
void clConsole::ExecC( const LString& Param )
{
	guard();

	LString Parameter = Param;
	LStr::TrimSpaces( &Parameter );

	if ( Parameter.empty() )
	{
		DisplayInfoTip( "Usage: EXEC <File Name>" );
		return;
	}

	LString FName = LStr::GetToken( Parameter, 1 );

	Env->Logger->LogP( L_DEBUG, "Exec: %s", FName.c_str() );

	if ( Env->FileSystem->FileExists( FName ) )
	{
		iIStream* FCFGStream = Env->FileSystem->CreateFileReader( FName );

		while ( !FCFGStream->Eof() )
		{
			LString Cmd = FCFGStream->ReadLine();
			LStr::TrimSpaces( &Cmd );

			if ( !Cmd.empty() && Cmd.at( 0 ) != ';' )
			{
				SendCommand( Cmd );
			}
		}

		delete( FCFGStream );
	}
	else
	{
		Env->Logger->LogP( L_WARNING, "Config file %s not found", FName.c_str() );

		DisplayError( "Config file \"" + FName + "\" not found" );
	}

	unguard();
}