Rev 8827 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1665 | Nasarus | 1 | |
8827 | rgimad | 2 | char exec[FILENAME_MAX]; |
3 | int result; |
||
4 | |||
1665 | Nasarus | 5 | |
8827 | rgimad | 6 | { |
7 | strcpy(exec, cmd); |
||
8 | if (!file_check(exec) ) // check file existense |
||
9 | { |
||
10 | file_not_found(cmd); |
||
11 | return FALSE; |
||
12 | } |
||
13 | } else { |
||
14 | strcpy(exec, cur_dir); // check file in current directory |
||
15 | if (exec[strlen(exec)-1] != '/') |
||
16 | strcat(exec, "/"); // add slash |
||
17 | strcat(exec, cmd); |
||
18 | |||
19 | |||
20 | { |
||
21 | strcpy(exec, "/sys/"); // check file on virtual disk |
||
9587 | vitalkrilo | 22 | strcat(exec, cmd); |
8827 | rgimad | 23 | if ( !file_check(exec) ) // check file existense |
24 | { |
||
25 | file_not_found(cmd); |
||
26 | return FALSE; |
||
27 | } |
||
28 | } |
||
29 | } |
||
30 | |||
1665 | Nasarus | 31 | |
8827 | rgimad | 32 | |
1665 | Nasarus | 33 | |
8827 | rgimad | 34 | result = program_run(exec, args); |
35 | if (result > 0) { |
||
36 | if ( !program_console(result) ) { |
||
37 | LAST_PID = result; |
||
38 | printf (EXEC_STARTED_FMT, cmd, result); |
||
39 | } |
||
40 | return TRUE; |
||
41 | } else { |
||
42 | if ( script_check(exec) ) // if file is a valid script |
||
43 | { |
||
44 | return script_run(exec, args); |
||
45 | } else |
||
46 | { |
||
47 | printf (EXEC_SCRIPT_ERROR_FMT, cmd); |
||
48 | return FALSE; |
||
49 | } |
||
50 | } |
||
51 | |||
1665 | Nasarus | 52 | |
53 |