Changeset 6ea9a1d in mainline for uspace/app/bdsh/cmds


Ignore:
Timestamp:
2011-06-11T22:32:24Z (14 years ago)
Author:
Martin Sucha <sucha14@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
36ab7c7
Parents:
ae45201
Message:

Allow shell builtins to be redirected too

Location:
uspace/app/bdsh/cmds
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/bdsh/cmds/builtin_cmds.c

    rae45201 r6ea9a1d  
    3838#include "cmds.h"
    3939#include "builtin_aliases.h"
     40#include "scli.h"
    4041
    4142extern volatile unsigned int cli_interactive;
     
    101102}
    102103
    103 int run_builtin(int builtin, char *argv[], cliuser_t *usr)
     104int run_builtin(int builtin, char *argv[], cliuser_t *usr, iostate_t *new_iostate)
    104105{
     106        int rc;
    105107        builtin_t *cmd = builtins;
    106108
    107109        cmd += builtin;
     110       
     111        iostate_t *old_iostate = get_iostate();
     112        set_iostate(new_iostate);
     113       
     114        if (NULL != cmd->entry) {
     115                rc = ((int)cmd->entry(argv, usr));
     116        }
     117        else {
     118                rc = CL_ENOENT;
     119        }
     120       
     121        set_iostate(old_iostate);
    108122
    109         if (NULL != cmd->entry)
    110                 return((int)cmd->entry(argv, usr));
    111 
    112         return CL_ENOENT;
     123        return rc;
    113124}
  • uspace/app/bdsh/cmds/cmds.h

    rae45201 r6ea9a1d  
    5959extern char *alias_for_module(const char *);
    6060extern int help_module(int, unsigned int);
    61 extern int run_module(int, char *[]);
     61extern int run_module(int, char *[], iostate_t *);
    6262
    6363/* Prototypes for builtin launchers */
     
    6767extern char *alias_for_builtin(const char *);
    6868extern int help_builtin(int, unsigned int);
    69 extern int run_builtin(int, char *[], cliuser_t *);
     69extern int run_builtin(int, char *[], cliuser_t *, iostate_t *);
    7070
    7171#endif
  • uspace/app/bdsh/cmds/mod_cmds.c

    rae45201 r6ea9a1d  
    124124/* Invokes the module entry point modules[module], passing argv[] as an argument
    125125 * stack. */
    126 int run_module(int module, char *argv[])
     126int run_module(int module, char *argv[], iostate_t *new_iostate)
    127127{
     128        int rc;
    128129        module_t *mod = modules;
    129130
    130131        mod += module;
     132       
     133        iostate_t *old_iostate = get_iostate();
     134        set_iostate(new_iostate);
    131135
    132         if (NULL != mod->entry)
    133                 return ((int)mod->entry(argv));
     136        if (NULL != mod->entry) {
     137                rc = ((int)mod->entry(argv));
     138        }
     139        else {
     140                rc = CL_ENOENT;
     141        }
     142       
     143        set_iostate(old_iostate);
    134144
    135         return CL_ENOENT;
     145        return rc;
    136146}
Note: See TracChangeset for help on using the changeset viewer.