Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
4973 | right-hear | 1 | #include |
2 | #include |
||
3 | #include |
||
4 | #include |
||
5 | #include |
||
6 | #include |
||
7 | #include |
||
8 | |||
9 | int _dos_exec(const char *program, const char *args, char * const envp[]) |
||
10 | { |
||
11 | return -1; |
||
12 | } |
||
13 | |||
14 | |||
15 | int _is_unixy_shell (const char *shellpath) |
||
16 | { |
||
17 | return -1; |
||
18 | } |
||
19 | |||
20 | int _is_dos_shell (const char *shellpath) |
||
21 | { |
||
22 | return -1; |
||
23 | } |
||
24 | |||
25 | int __dosexec_command_exec(const char *program, char **argv, char **envp) |
||
26 | { |
||
27 | return -1; |
||
28 | } |
||
29 | |||
30 | char * __dosexec_find_on_path(const char *program, char *envp[], char *buf) |
||
31 | { |
||
32 | return NULL; |
||
33 | } |
||
34 | |||
35 | |||
36 | static void build_args(char * dstbuf,char * const argv[],int argc) |
||
37 | { |
||
38 | int i,j; |
||
39 | for(i=0;i |
||
40 | { |
||
41 | j=strlen(argv[i]); |
||
42 | if(i==(argc-1)) |
||
43 | sprintf(dstbuf,"%s",argv[i]); |
||
44 | else |
||
45 | sprintf(dstbuf,"%s ",argv[i]); |
||
46 | dstbuf+=j; |
||
47 | } |
||
48 | } |
||
49 | |||
50 | int __spawnve(int mode, const char *path, char *const argv[], char *const envp[]) |
||
51 | { |
||
52 | char * buffer_for_args; |
||
53 | int ap,asz; |
||
54 | struct systree_info st_info; |
||
55 | int res; |
||
56 | fflush(stdout); |
||
57 | if(!path) |
||
58 | { |
||
59 | errno=EINVAL; |
||
60 | return -1; |
||
61 | } |
||
62 | if(strlen(path)>FILENAME_MAX-1) |
||
63 | { |
||
64 | errno = ENAMETOOLONG; |
||
65 | return -1; |
||
66 | } |
||
67 | for(ap=0,asz=10;argv[ap]!=NULL;ap++) |
||
68 | { |
||
69 | asz+=strlen(argv[ap])+1; |
||
70 | } |
||
71 | if(ap) |
||
72 | { |
||
73 | buffer_for_args=malloc(asz); |
||
74 | if(!buffer_for_args) |
||
75 | { |
||
76 | errno=ENOMEM; |
||
77 | return -1; |
||
78 | } |
||
79 | memset(buffer_for_args,0,asz); |
||
80 | build_args(buffer_for_args,argv,ap); |
||
81 | } else buffer_for_args=NULL; |
||
82 | st_info.command = 7; |
||
83 | st_info.file_offset_low = 0; |
||
84 | st_info.file_offset_high = (__u32)buffer_for_args; |
||
85 | st_info.size = 0; |
||
86 | st_info.data_pointer = 0; |
||
87 | st_info._zero = 0; |
||
88 | //_fix_path(path,st_info.name); |
||
89 | st_info.nameptr = path; |
||
90 | res = __kolibri__system_tree_access(&st_info); |
||
91 | if (res == -5) |
||
92 | errno = ENOENT; |
||
93 | else if (res == -31) |
||
94 | errno = ENOEXEC; |
||
95 | else if (res == -30 || res == -32) |
||
96 | errno = ENOMEM; |
||
97 | else if (res < 0) |
||
98 | errno = EINVAL; |
||
99 | free(buffer_for_args); |
||
100 | if(mode==0x1BADB002) exit(0); |
||
101 | return (res>0)?res:-1; |
||
102 | }> |