Changeset ae45201 in mainline for uspace/app/bdsh/exec.c


Ignore:
Timestamp:
2011-06-11T21:32:54Z (13 years ago)
Author:
Martin Sucha <sucha14@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
6ea9a1d
Parents:
28ee877e
Message:

Allow redirecting output of tasks to file in bdsh

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/bdsh/exec.c

    r28ee877e rae45201  
    112112}
    113113
    114 unsigned int try_exec(char *cmd, char **argv)
     114unsigned int try_exec(char *cmd, char **argv, FILE **files)
    115115{
    116116        task_id_t tid;
    117117        task_exit_t texit;
    118118        char *tmp;
    119         int rc, retval;
     119        int rc, retval, i;
     120        fdi_node_t file_nodes[3];
     121        fdi_node_t *file_nodes_p[4];
    120122
    121123        tmp = str_dup(find_command(cmd));
    122124        free(found);
     125       
     126        for (i = 0; i < 3 && files[i] != NULL; i++) {
     127                if (fnode(files[i], &file_nodes[i]) == EOK) {
     128                        file_nodes_p[i] = &file_nodes[i];
     129                }
     130                else {
     131                        file_nodes_p[i] = NULL;
     132                }
     133        }
     134        file_nodes_p[i] = NULL;
    123135
    124         rc = task_spawnv(&tid, tmp, (const char **) argv);
     136        rc = task_spawnvf(&tid, tmp, (const char **) argv, file_nodes_p);
    125137        free(tmp);
    126138
Note: See TracChangeset for help on using the changeset viewer.