[운영체제]운영체제(UNIX 시스템 프로그램)
- 최초 등록일
- 2003.11.27
- 최종 저작일
- 2003.11
- 20페이지/ 압축파일
- 가격 21,000원
소개글
유닉스 프로그램 smallsh 입니다.
유닉스에서 실행가능합니다. 컴파일해서 사용가능합니다.
파이브라인, 리다이렉션, 내부명령어,외부명령어
모두 유닉스 환경에서 사용가능합니다.
완벽구현 했습니다. 스몰쉘~!
-주석처리 되어 있습니다-
프로젝트때 개발하였습니다.
< 완벽 구현입니다.>
컴파일 실행환경
<파일목록>
procline.c
prompt.c
redirection.c
runcommand.c
smallsh.c
smallsh.h
gettok.c
inarg.c
본문내용
#include "smallsh.h"
int runcommand(char **cline, int where, int pos)
{
pid_t pid;
int status, i = 0;
if(strcmp(*cline, "cd") == 0)
{
if(*(cline+1) == NULL || strcmp(*(cline+1), "~") == 0)
chdir(en);
else
{
if(chdir(*(++cline)) == -1)
printf("cd error!\n");
}
setprompt();
return 0;
}
switch(pid = fork())
{
// fork Error
case -1:
perror("smallsh");
return(-1);
case 0:
.
if(strcmp(*(cline+pos), ">") == 0)
{
redirout(cline, pos+1);
exit(1);
}
else if(strcmp(*(cline+pos), "<") == 0)
{
redirin(cline, pos+1);
exit(1);
}
execvp(*cline, cline);
perror(*cline);
exit(1);
}
압축파일 내 파일목록
procline.c
prompt.c
redirection.c
runcommand.c
smallsh.c
smallsh.h
gettok.c
inarg.c
참고 자료
UNIX 시스템 프로그램밍
리눅스 프로그램밍