2010-10-17 21:50:55 +02:00
|
|
|
|
|
|
|
|
|
/// ===========================================================
|
|
|
|
|
|
|
|
|
|
int executable_run(char cmd[], char args[])
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
char exec[256];
|
2010-10-21 01:58:36 +02:00
|
|
|
|
#if LANG_ENG
|
|
|
|
|
char error_starting[]={" No such command '%s'.\n\r"};
|
|
|
|
|
#elif LANG_RUS
|
2010-10-24 16:32:14 +02:00
|
|
|
|
char error_starting[]={" <20><><EFBFBD> ⠪<><E2A0AA> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> - '%s'.\n\r"};
|
2010-10-21 01:58:36 +02:00
|
|
|
|
#endif
|
2010-10-17 21:50:55 +02:00
|
|
|
|
int result;
|
|
|
|
|
|
2010-10-24 16:32:14 +02:00
|
|
|
|
if ( '/' == cmd[0]) // <20> <20><><EFBFBD><EFBFBD> <20><>᮫<EFBFBD><E1AEAB><EFBFBD><EFBFBD><EFBFBD>
|
2010-10-17 21:50:55 +02:00
|
|
|
|
{
|
|
|
|
|
strcpy(exec, cmd);
|
|
|
|
|
|
2010-10-21 01:58:36 +02:00
|
|
|
|
if ( !file_check(exec) ) // <20><EFBFBD><E0AEA2>塞 <20><><EFBFBD><EFBFBD><EFBFBD>⢮<EFBFBD><E2A2AE><EFBFBD><EFBFBD><EFBFBD> 䠩<><E4A0A9>
|
2010-10-17 21:50:55 +02:00
|
|
|
|
{
|
|
|
|
|
printf(error_starting, cmd);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
else
|
|
|
|
|
{
|
2010-10-21 01:58:36 +02:00
|
|
|
|
strcpy(exec, cur_dir); // <20><EFBFBD><E0AEA2>塞 䠩<> <20> ⥪<>饬 <20><>⠫<EFBFBD><E2A0AB><EFBFBD>
|
2010-10-17 21:50:55 +02:00
|
|
|
|
strcat(exec, cmd);
|
|
|
|
|
|
2010-10-21 01:58:36 +02:00
|
|
|
|
if ( !file_check(exec) ) // <20><EFBFBD><E0AEA2>塞 <20><><EFBFBD><EFBFBD><EFBFBD>⢮<EFBFBD><E2A2AE><EFBFBD><EFBFBD><EFBFBD> 䠩<><E4A0A9>
|
2010-10-17 21:50:55 +02:00
|
|
|
|
{
|
2010-10-21 01:58:36 +02:00
|
|
|
|
strcpy(exec, "/rd/1/"); // <20><EFBFBD><E0AEA2>塞 䠩<> <20><> <20><><EFBFBD><EFBFBD>㠫쭮<E3A0AB> <20><>᪥
|
2010-10-17 21:50:55 +02:00
|
|
|
|
strcat(exec, cmd);
|
2010-10-21 01:58:36 +02:00
|
|
|
|
if ( !file_check(exec) ) // <20><EFBFBD><E0AEA2>塞 <20><><EFBFBD><EFBFBD><EFBFBD>⢮<EFBFBD><E2A2AE><EFBFBD><EFBFBD><EFBFBD> 䠩<><E4A0A9>
|
2010-10-17 21:50:55 +02:00
|
|
|
|
{
|
|
|
|
|
printf(error_starting, cmd);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ( script_check(exec) )
|
|
|
|
|
{
|
|
|
|
|
return script_run(exec, args);
|
|
|
|
|
}
|
|
|
|
|
|
2010-10-21 01:58:36 +02:00
|
|
|
|
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ணࠬ<E0AEA3><E0A0AC> */
|
2010-10-17 21:50:55 +02:00
|
|
|
|
result = program_run(exec, args);
|
|
|
|
|
if (result > 0)
|
|
|
|
|
{
|
2010-10-21 01:58:36 +02:00
|
|
|
|
#if LANG_ENG
|
|
|
|
|
printf (" '%s' started. PID = %d\n\r", cmd, result);
|
|
|
|
|
#elif LANG_RUS
|
|
|
|
|
printf (" '%s' <20><><EFBFBD><EFBFBD>饭. PID = %d\n\r", cmd, result);
|
|
|
|
|
#endif
|
2010-10-17 21:50:55 +02:00
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
printf(error_starting, cmd);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// ===========================================================
|