GithubHelp home page GithubHelp logo

4_2_m_i_n_i_s_h_e_l_l's Introduction

MINISHELL

Screen Shot 2024-03-05 at 9 11 07 PM

과제 목표

  • Bash Manual을 참고하여 쉘을 구현한다
  • Recursive descent parser
  • Inter Process Communication

Bash Manual

구현 기능

  • 기본적인 쉘 기능
  • Built-in 명령어
  • 환경변수
  • 상대경로, 절대경로
  • 파이프
  • 리다이렉션
  • 시그널

flow chart

EBNF for recursive descent parser

- <pipe> ::= <group> “ | ” <group> |  <group> “|” <pipe>
- <group> ::= <cmd> | <redir> <cmd>
- <cmd> ::= <ex_cmd> | <cmd> <option>
- <redir> ::= <redirection> | <redir> <redirection>
- <redirection> ::= “<” <file> | “>” <file> | “>>” <file> | “<<” <limiter>

Tree with commands

Screen Shot 2024-03-05 at 9 26 46 PM

Screen Shot 2024-03-05 at 9 25 37 PM

Screen Shot 2024-03-05 at 9 23 25 PM

Built-in

env 환경 변수 목록을 출력
export 환경변수를 설정하거나 환경변수 목록을 출력
unset 환경변수를 삭제
pwd 현재 디렉토리 출력
cd 디렉토리 변경
exit 쉘 종료 (파이프 제외)
echo - n 문자열 출력, n옵션은 줄바꿈을 하지 않음

실행 방법

git clone
make
./minishell

실행 예시

Screen Shot 2024-03-05 at 9 05 43 PM

Screen Shot 2024-03-05 at 9 05 17 PM

Screen Shot 2024-03-05 at 9 06 55 PM

Screen Shot 2024-03-05 at 9 06 12 PM

4_2_m_i_n_i_s_h_e_l_l's People

Contributors

jonique98 avatar cozy-hn avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

jonique98

4_2_m_i_n_i_s_h_e_l_l's Issues

아오

-global 변수 이슈
-^D 커맨드 디폴트 처리
-unset ㅋㅋ pwd segfalut
-exit exitcode 인자없으면 전꺼 받음

\ _ /

테트리스 금지

릭이 나요

int	ft_cd(t_main *main, char **cmd)
{
	char	*home;

	if (cmd[1] == NULL)
	{
		home = get_env_value(main, "HOME");
		if (home == NULL)
			return (throw_error("cd", 0, "HOME not set"));
		if (chdir(home) != 0)
			return (throw_error("cd", home, strerror(errno)));
		return (0);
	}
	if (chdir(cmd[1]) == -1)
		return (throw_error("cd", cmd[1], strerror(errno)));
	return (set_pwd(main));
}

return (throw_error("cd", home, strerror(errno)));
get_env_value가 복사하고 리턴해서 leak이 납니다.

		if (chdir(home) != 0)
			return (throw_error("cd", home, strerror(errno)));
		return (0);

이 두 리턴값에서 home을 free해줘야 할 것 같습니다.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.