kolibrios/programs/system/shell/modules/module_executable.c

68 lines
1.4 KiB
C
Raw Normal View History

/// ===========================================================
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><><EFBFBD><><E2A0AA> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> - '%s'.\n\r"};
#endif
int result;
if ( '/' == cmd[0]) // <20><20><><EFBFBD><EFBFBD> <20><><EFBFBD><E1AEAB><EFBFBD><EFBFBD><EFBFBD>
{
strcpy(exec, cmd);
if ( !file_check(exec) ) // <20><EFBFBD><E0AEA2><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E2A2AE><EFBFBD><EFBFBD><EFBFBD><><E4A0A9>
{
printf(error_starting, cmd);
return FALSE;
}
}
else
{
strcpy(exec, cur_dir); // <20><EFBFBD><E0AEA2>塞 䠩<> <20><><20><><EFBFBD><E2A0AB><EFBFBD>
// strcat(exec, "/"); // add slash
strcat(exec, cmd);
if ( !file_check(exec) ) // <20><EFBFBD><E0AEA2><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E2A2AE><EFBFBD><EFBFBD><EFBFBD><><E4A0A9>
{
strcpy(exec, "/rd/1/"); // <20><EFBFBD><E0AEA2>塞 䠩<> <20><> <20><><EFBFBD><EFBFBD>㠫쭮<E3A0AB> <20><>
strcat(exec, cmd);
if ( !file_check(exec) ) // <20><EFBFBD><E0AEA2><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E2A2AE><EFBFBD><EFBFBD><EFBFBD><><E4A0A9>
{
printf(error_starting, cmd);
return FALSE;
}
}
}
if ( script_check(exec) )
return script_run(exec, args);
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ணࠬ<E0AEA3><E0A0AC> */
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' <20><><EFBFBD><EFBFBD>饭. PID = %d\n\r", cmd, result);
#endif
return TRUE;
}
else
{
printf(error_starting, cmd);
return FALSE;
}
}
/// ===========================================================