Changeset 3d36920e in mainline
- Timestamp:
- 2021-08-10T13:11:39Z (3 years ago)
- Children:
- 4518991
- Parents:
- 82570ff
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/bdsh/input.c
r82570ff r3d36920e 251 251 } 252 252 253 for (unsigned p = 0; p < pipe_count; p++) {253 for (unsigned p = 0; p <= pipe_count; p++) { 254 254 /* Convert tokens of the command to string array */ 255 255 unsigned int cmd_pos = 0; … … 259 259 } 260 260 } 261 cmd[cmd_pos ++] = NULL;261 cmd[cmd_pos] = NULL; 262 262 263 263 if (cmd[0] == NULL) { … … 282 282 } 283 283 284 285 if (p < pipe_count - 1) { 284 if (p < pipe_count) { 286 285 new_iostate.stdout = to; 287 } else { 286 } 287 if (p && p == pipe_count) { 288 fseek(to, 0, SEEK_SET); 288 289 new_iostate.stdin = to; 289 290 } … … 302 303 cmd_token_start = cmd_token_end + 1; 303 304 cmd_token_end = (p < pipe_count - 1) ? pipe_pos[p + 1] : tokens_length; 304 }305 306 unsigned int cmd_pos = 0;307 for (i = cmd_token_start; i < cmd_token_end; i++) {308 if (tokens[i].type != TOKTYPE_SPACE) {309 cmd[cmd_pos++] = tokens[i].text;310 }311 }312 cmd[cmd_pos++] = NULL;313 314 if (cmd[0] == NULL) {315 printf("Command not found.\n");316 rc = ENOTSUP;317 goto finit;318 }319 320 alias_t *data = NULL;321 rc = find_alias(cmd, alias_hups, &data);322 if (rc != EOK) {323 goto finit;324 }325 326 if (data != NULL) {327 rc = replace_alias(tokens, cmd_token_start, tokens_length, data, cmd, &usr->line);328 if (rc == EOK) {329 /* reprocess input after string replace */330 rc = process_input_nohup(usr, alias_hups, count_executed_hups + 1);331 }332 goto finit;333 }334 335 if (pipe_count) {336 fseek(to, 0, SEEK_SET);337 new_iostate.stdin = to;338 }339 340 341 if (run_command(cmd, usr, &new_iostate) == 0) {342 rc = EOK;343 } else {344 rc = EINVAL;345 305 } 346 306
Note:
See TracChangeset
for help on using the changeset viewer.