[프로그램소스]linux shell 기능 구현
- 최초 등록일
- 2006.06.24
- 최종 저작일
- 2006.06
- 19페이지/ 압축파일
- 가격 1,500원
소개글
시스템프로그래밍 과제 / 리눅스 쉘기능을 구현한 프로그램소스입니다.
구현기능 조건은 pdf파일로, 하드카피용 한글문서도 포함되어있습니다.
컴파일 실행환경
linux
본문내용
#include"mysh.h"
static char inpbuf[MAXBUF], tokbuf[MAXBUF], *history[MAXBUF];
static char *ptr=inpbuf, *tok=tokbuf, **hptr=history;
static char special[11] = {` `,`\t`,`&`,`;`,`\n`,`|`,`<`,`>`,`\0`};
struct CmdBox{
char *arg[MAXARG+1];
int where;
int isafter;
int isbefore;
int isleft;
int isright;
};
struct CmdBox cmd[MAXBUF*10];
int cmdindex;
/* save cmd boundary info */
struct CmdInfo{
int cmdstartpos[MAXBUF];
int cmdendpos[MAXBUF];
int posindex;
int hisindex;
}cinfo;
void addHistory(){
int len;
len=strlen(inpbuf)+1;
*hptr=(char*)malloc(sizeof(char)*len);
strcpy(*hptr++, inpbuf);
}
void showHistory(){
int i;
char **showptr=history;
for(i=0; *showptr; i++)
printf("[%d] : %s", i+1, *showptr++);
}
void showPrompt(){
char prompt[MAXBUF];
char *username;
int i;
int len;
int lastslashpos;
username=getlogin();
getcwd(prompt, MAXBUF);
lastslashpos=0;
len=strlen(prompt);
/* ex)/home/.../dirname -> get just dirname */
for(i=0; i<len; i++){
if(prompt[i]==`/`)
lastslashpos=i;
}
압축파일 내 파일목록
fall40915.pdf
makefile
mysh
mysh.c
mysh.h
myshell programming.hwp
참고 자료
없음