Rev 3155 | Rev 3190 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3155 | Rev 3174 | ||
---|---|---|---|
Line 80... | Line 80... | ||
80 | return true; |
80 | return true; |
81 | } |
81 | } |
82 | 82 | ||
83 | static void spawn(char *fname) |
83 | static void spawn(char *fname) |
84 | { |
84 | { |
- | 85 | char *argv[2]; |
|
- | 86 | ||
85 | printf(NAME ": Spawning %s\n", fname); |
87 | printf(NAME ": Spawning %s\n", fname); |
86 | 88 | ||
- | 89 | argv[0] = fname; |
|
- | 90 | argv[1] = NULL; |
|
- | 91 | ||
87 | if (task_spawn_ex(fname, NULL) != 0) { |
92 | if (task_spawn_ex(fname, argv) != 0) { |
88 | /* Success */ |
93 | /* Success */ |
89 | sleep(1); |
94 | sleep(1); |
90 | } |
95 | } |
91 | return; |
- | |
92 | - | ||
93 | int fd = open(fname, O_RDONLY); |
- | |
94 | if (fd >= 0) { |
- | |
95 | - | ||
96 | ssize_t rd; |
- | |
97 | size_t len = 0; |
- | |
98 | - | ||
99 | // FIXME: cannot do long reads yet |
- | |
100 | do { |
- | |
101 | rd = read(fd, buf + len, 1024); |
- | |
102 | if (rd > 0) |
- | |
103 | len += rd; |
- | |
104 | - | ||
105 | } while (rd > 0); |
- | |
106 | - | ||
107 | if (len > 0) { |
- | |
108 | task_spawn(buf, len); |
- | |
109 | sleep(1); // FIXME |
- | |
110 | } |
- | |
111 | - | ||
112 | close(fd); |
- | |
113 | } |
- | |
114 | } |
96 | } |
115 | 97 | ||
116 | int main(int argc, char *argv[]) |
98 | int main(int argc, char *argv[]) |
117 | { |
99 | { |
118 | info_print(); |
100 | info_print(); |