• 大小: 1KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-05-28
  • 语言: 其他
  • 标签: shell  

资源简介

linux 命令解释器 实现基本的Shell命令

资源截图

代码片段和文件信息

#include
#include
#include
#include
#include

#define PROMPT_STRING “[myshell~]$“
#define QUIT_STRING “exit\n“

static char inbuf[MAX_CANON];
char* g_ptr;
char* g_lim;

extern void yyles();

int main()
{
while(1){
if(fputs(PROMPT_STRINGstdout)==EOF)
continue;
if(fgets(inbufMAX_CANONstdin)==NULL)
continue;
if(strcmp(inbufQUIT_STRING)==0)
break;
g_ptr=inbuf;
g_lim=inbuf+strlen(inbuf);
yylex();
}
return 0;
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件        155  2010-06-24 17:01  Makefile

     文件        487  2010-06-24 17:01  myshell.c

     文件       1385  2010-06-24 17:01  parse.lex

----------- ---------  ---------- -----  ----

                 2027                    3


评论

共有 条评论