b63ebe25ee
git-svn-id: svn://kolibrios.org@1862 a494cfbc-eb01-0410-851d-a64ba20cac60
70 lines
1.4 KiB
C
70 lines
1.4 KiB
C
|
||
/// ===========================================================
|
||
|
||
int executable_run(char cmd[], char args[])
|
||
{
|
||
|
||
char exec[256];
|
||
#if LANG_ENG
|
||
char error_starting[]={" No such command '%s'.\n\r"};
|
||
#elif LANG_RUS
|
||
char error_starting[]={" <20>¥â â ª®© ª®¬ ¤ë - '%s'.\n\r"};
|
||
#endif
|
||
int result;
|
||
|
||
if ( '/' == cmd[0]) // ¥á«¨ ¯ãâì ¡á®«îâë©
|
||
{
|
||
strcpy(exec, cmd);
|
||
|
||
if ( !file_check(exec) ) // ¯à®¢¥à塞 áãé¥á⢮¢ ¨¥ ä ©«
|
||
{
|
||
printf(error_starting, cmd);
|
||
return FALSE;
|
||
}
|
||
}
|
||
|
||
else
|
||
{
|
||
strcpy(exec, cur_dir); // ¯à®¢¥à塞 ä ©« ¢ ⥪ã饬 ª â «®£¥
|
||
strcat(exec, "/"); // add slash
|
||
strcat(exec, cmd);
|
||
|
||
if ( !file_check(exec) ) // ¯à®¢¥à塞 áãé¥á⢮¢ ¨¥ ä ©«
|
||
{
|
||
strcpy(exec, "/rd/1/"); // ¯à®¢¥à塞 ä ©« ¢¨àâ㠫쮬 ¤¨áª¥
|
||
strcat(exec, cmd);
|
||
if ( !file_check(exec) ) // ¯à®¢¥à塞 áãé¥á⢮¢ ¨¥ ä ©«
|
||
{
|
||
printf(error_starting, cmd);
|
||
return FALSE;
|
||
}
|
||
}
|
||
}
|
||
|
||
|
||
if ( script_check(exec) )
|
||
{
|
||
return script_run(exec, args);
|
||
}
|
||
|
||
/* § ¯ã᪠¯à®£à ¬¬ë */
|
||
result = program_run(exec, args);
|
||
if (result > 0)
|
||
{
|
||
#if LANG_ENG
|
||
printf (" '%s' started. PID = %d\n\r", cmd, result);
|
||
#elif LANG_RUS
|
||
printf (" '%s' § ¯ãé¥. PID = %d\n\r", cmd, result);
|
||
#endif
|
||
return TRUE;
|
||
}
|
||
else
|
||
{
|
||
printf(error_starting, cmd);
|
||
return FALSE;
|
||
}
|
||
|
||
}
|
||
|
||
/// ===========================================================
|