Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEAT, HELP : pwd 또는 env no option 어떻게 해결 할 것인지? #39

Open
Giromi opened this issue Sep 14, 2022 · 5 comments
Open
Assignees
Labels
HELP 여기 좀 봐주세요
Milestone

Comments

@Giromi
Copy link
Collaborator

Giromi commented Sep 14, 2022

image

int	builtin_pwd(void)

-L -p 들어오면 어떻게 작동할 지 회의 필요

env argu 해결 예시

Screen Shot 2022-09-14 at 11 28 28 PM

next 토큰 널이어야 함?

@Giromi Giromi added the HELP 여기 좀 봐주세요 label Sep 14, 2022
@Giromi Giromi added this to the Excute milestone Sep 14, 2022
@Oris482
Copy link
Owner

Oris482 commented Sep 15, 2022

PWD는 인자 다 무시하고 뱉는 애라 다음 토큰을 볼 필요가 없음
옵션 없으면 어짜피 -L 이런 애들도 그냥 인자라서

@Oris482
Copy link
Owner

Oris482 commented Sep 15, 2022

env는 옵션, 인자 둘 다 안받는다고 되어있으니까 next있으면 오류메시지 띄워주고 나가면 될 듯??

@Giromi
Copy link
Collaborator Author

Giromi commented Sep 15, 2022

그럼 우리가 세운 규칙은

no argument는 next token이 무조건 NULL이어야 하고

no option은 next token이 -L -p으로 와도 기능이 없다는거지?

근데 나는 no option이라도 다음 토큰 확인해서 첫 글자가 '-' 대쉬이면 옵션 에러를 내뱉어야 하니깐
다음 토큰 들고 들어 가야하지 않을까?
예를들면 pwd -L으로 오면 에러 뱉어야 하니깐 아래 처럼 오류 뱉어야 되는거라고 생각하긴 해유

bash 예시

bash-3.2$ pwd -q
bash: pwd: -q: invalid option
pwd: usage: pwd [-LP]

내가 생각하는 미니쉘

미니쉘$> pwd -L
minishell: pwd: -L: invalid option
pwd: usage: pwd [no option]

@Giromi
Copy link
Collaborator Author

Giromi commented Sep 15, 2022

다음 인자의 '-'가 인지 아닌지로 no argument 에러를 체크해야 할거 같아용

예를 들면
env -q
env hello

두개의 에러는 달라야 하니깐 그냥 다음토큰이 널인걸로 체크하면 에러 구분이 안되겠느뎅

@Oris482
Copy link
Owner

Oris482 commented Sep 15, 2022

둘 다 사용 문법 에러로 띄워주면 되는거아닌가?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
HELP 여기 좀 봐주세요
Projects
None yet
Development

No branches or pull requests

2 participants