Rev 4537 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4537 | Rev 4668 | ||
---|---|---|---|
Line 71... | Line 71... | ||
71 | return id; |
71 | return id; |
72 | } |
72 | } |
73 | 73 | ||
74 | int main(int argc, char *argv[]) |
74 | int main(int argc, char *argv[]) |
75 | { |
75 | { |
- | 76 | task_exit_t texit; |
|
- | 77 | int retval; |
|
- | 78 | ||
76 | if (argc < 3) { |
79 | if (argc < 3) { |
77 | usage(); |
80 | usage(); |
78 | return -1; |
81 | return -1; |
79 | } |
82 | } |
80 | 83 | ||
81 | closeall(); |
84 | closeall(); |
82 | 85 | ||
83 | stdin = fopen(argv[1], "r"); |
86 | stdin = fopen(argv[1], "r"); |
84 | stdout = fopen(argv[1], "w"); |
87 | stdout = fopen(argv[1], "w"); |
85 | stderr = fopen(argv[1], "w"); |
88 | stderr = fopen(argv[1], "w"); |
- | 89 | ||
- | 90 | /* |
|
- | 91 | * FIXME: fopen() should actually detect that we are opening a console |
|
- | 92 | * and it should set line-buffering mode automatically. |
|
- | 93 | */ |
|
- | 94 | setvbuf(stdout, NULL, _IOLBF, BUFSIZ); |
|
86 | 95 | ||
87 | if ((stdin == NULL) |
96 | if ((stdin == NULL) |
88 | || (stdout == NULL) |
97 | || (stdout == NULL) |
89 | || (stderr == NULL)) |
98 | || (stderr == NULL)) |
90 | return -2; |
99 | return -2; |
91 | 100 | ||
92 | version_print(argv[1]); |
101 | version_print(argv[1]); |
93 | task_id_t id = spawn(argv[2]); |
102 | task_id_t id = spawn(argv[2]); |
94 | task_wait(id); |
103 | task_wait(id, &texit, &retval); |
95 | 104 | ||
96 | return 0; |
105 | return 0; |
97 | } |
106 | } |
98 | 107 | ||
99 | /** @} |
108 | /** @} |