uboot 中 cli_hush的个人理解

1、cli_loop()是整个shell程序的循环,里面包含了用户输入的检测、字符检查、字符拼接、命令解码、历史输入的维护

2、整个shell的运行一直在维护一个结构体

struct pipe {

    int num_progs;                /* total number of programs in job */
    struct child_prog *progs;    /* array of commands in pipe */
    struct pipe *next;            /* to track background commands */
    pipe_style followup;        /* PIPE_BG, PIPE_SEQ, PIPE_OR, PIPE_AND */
    reserved_style r_mode;        /* supports if, for, while, until */
};

struct child_prog {

    char **argv;                /* program name and arguments */
    /* was quoted when parsed; copy of struct o_string.nonnull field */
    int *argv_nonnull;
    int    argc;                            /* number of program arguments */
    struct pipe *group;            /* if non-NULL, first in group or subshell */
    int sp;                /* number of SPECIAL_VAR_SYMBOL */
    int type;
};

struct p_context {
    struct child_prog *child;
    struct pipe *list_head;
    struct pipe *pipe;
    reserved_style w;
    int old_flag;                /* for figuring out valid reserved words */
    struct p_context *stack;
    int type;            /* define type of parser : ";$" common or special symbol */
    /* How about quoting status? */
};

pipe是一个链表,list_head 是该链表的表头

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值