939f824d96
git-svn-id: svn://kolibrios.org@959 a494cfbc-eb01-0410-851d-a64ba20cac60
61 lines
1.1 KiB
C
61 lines
1.1 KiB
C
|
|
/// ===========================================================
|
|
|
|
int executable_run(char cmd[], char args[])
|
|
{
|
|
|
|
char exec[256];
|
|
char error_starting[]={" No such command '%s'.\n\r"};
|
|
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, 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)
|
|
{
|
|
printf (" '%s' started. PID = %d\n\r", cmd, result);
|
|
return TRUE;
|
|
}
|
|
else
|
|
{
|
|
printf(error_starting, cmd);
|
|
return FALSE;
|
|
}
|
|
|
|
}
|
|
|
|
/// ===========================================================
|