-
Notifications
You must be signed in to change notification settings - Fork 0
Subject
γμλ§νΌμ΄λ μλ¦λ€μ΄ κ·Έκ²
Summary: This project is about creating a simple shell. Yes, your own little bash. You will learn a lot about processes and file descriptors. Version: 6
γμμ½: μ΄λ² νλ‘μ νΈμ λͺ©νλ κ°λ¨ν μμ λ§λλ κ²μ λλ€. λ§μμ, λΉμ λ§μ μμ bash. νλ‘μΈμ€ κ·Έλ¦¬κ³ νμΌ λμ€ν¬λ¦½ν°μ λν΄ μμ£Ό λ§μ΄ λ°°μ°κ² λ κ²λλ€. v6
Chapter | Contents | page |
---|---|---|
I | Introduction | 2 |
II | Common Instructions | 3 |
III | Mandatory part | 4 |
IV | Bonus part | 6 |
The existence of shells is linked to the very existence of IT. At the time, all coders agreed that communicating with a computer using aligned 1/0 switches was seriously irritating
. It was only logical that they came up with the idea of creating a software to communicate with a computer using interactive lines of commands in a language somewhat close to the human language.
γμμ ITμ νμ΄λΆν° ν¨κ»νμ΅λλ€. κ·Έ λΉμ, λͺ¨λ κ°λ°μλ€μ 1κ³Ό 0μΌλ‘λ§ μ΄λ£¨μ΄μ§ μ€μμΉλ‘ μ»΄ν¨ν°μ ν΅μ νλ κ²μ κ΅μ₯ν μ±κ°μλ€
λ μ μ λμνμ΄μ. κ·Έλ€μ΄ μΈκ°μ μΈμ΄μ μ΄λ μ λ κ°κΉμ΄ μΈμ΄λ‘ λ λνν λͺ
λ Ή λΌμΈμ μ¬μ©νμ¬ μ»΄ν¨ν°μ ν΅μ νλ μννΈμ¨μ΄λ₯Ό λ§λλ μμ΄λμ΄λ₯Ό λ΄λμ κ²μ λΉμ°ν μμμ΄μμ΅λλ€.
Thanks to Minishell, youβll be able to travel through time and come back to problems people faced when Windows didnβt exist.
γMinishell
λλΆμ, Windows
κ° μ‘΄μ¬νμ§ μμμ μμ μ¬λλ€μ΄ κ²ͺμλ λ¬Έμ λ₯Ό λ§μ£Όν΄λ³Ό μ μμ΅λλ€.
-
Your project must be written in C.
γνλ‘μ νΈλ λ°λμ Cλ‘ μμ±λμ΄μΌ ν©λλ€. -
Your project must be written in accordance with the Norm. If you have bonus files/functions, they are included in the norm check and you will receive a 0 if there is a norm error inside.
γνλ‘μ νΈλ Normμ μ€μνμ¬ μμ±λμ΄μΌ ν©λλ€. λ§μΌ 보λμ€ νμΌμ΄λ ν¨μκ° μλκ²½μ°, μ΄ λν norm κ²μ¬μ ν¬ν¨λλ©° norm errorκ° μλ κ²½μ° 0μ μ λ°κ² λλ€. -
Your functions should not quit unexpectedly (segmentation fault, bus error, double free, etc) apart from undefined behaviors. If this happens, your project will be considered non functional and will receive a 0 during the evaluation.
γμ μλμ§ μμ νλ(undefined behaviors)μ μ μΈνκ³ ν¨μλ μμμΉ λͺ»νκ² μ’ λ£λλ©΄ μλλ€.(segmentation fault, bus error, double free, etc) μ΄ κ²½μ° νλ‘μ νΈκ° μλνμ§ μλ κ²μΌλ‘ κ°μ£Όνλ©° νκ° μ€μ 0μ μ λ°κ² λλ€. -
All heap allocated memory space must be properly freed when necessary. No leaks will be tolerated.
γνμν κ²½μ° heapμ ν λΉλ λ©λͺ¨λ¦¬ 곡κ°μ μ μ νκ² ν΄μ ν΄μΌ ν©λλ€. λ©λͺ¨λ¦¬ λμλ νμ©λμ§ μμ΅λλ€. -
If the subject requires it, you must submit a Makefile which will compile your source files to the required output with the flags -Wall, -Wextra and -Werror, use cc, and your Makefile must not relink.
γκ³Όμ μμ νμν κ²½μ°, κ²°κ³Όλ¬Όμ λ§λ€κΈ° μν΄ μμ€ νμΌμ -Wall -Wextra -Werror νλκ·Έμ ccλ₯Ό μ¬μ©νμ¬ μ»΄νμΌν Makefileμ μ μΆ ν΄μΌνκ³ μ΄λ 리λ§ν¬κ° λλ©΄ μλ©λλ€. -
Your Makefile must at least contain the rules $(NAME), all, clean, fclean and re.
γMakefileμ μ΅μν $(NAME), all, clean, fclean, re κ·μΉμ ν¬ν¨ν΄μΌ ν©λλ€. -
To turn in bonuses to your project, you must include a rule bonus to your Makefile, which will add all the various headers, librairies or functions that are forbidden on the main part of the project. Bonuses must be in a different file
_bonus.
{c/h} if the subject does not specify anything else. Mandatory and bonus part evaluation is done separately.
γνλ‘μ νΈμ 보λμ€λ₯Ό μ μΆνλ €λ©΄ Makefileμ bonus κ·μΉμ ν¬ν¨ν΄μΌ ν©λλ€. bonusμμλ νλ‘μ νΈμ mandatory partμμ κΈμ§λ λͺ¨λ λ€μν ν€λ, λΌμ΄λΈλ¬λ¦¬ λλ ν¨μλ₯Ό μΆκ°ν©λλ€. κ³Όμ μμ νΉλ³νκ² λ€λ₯Έ νλͺ©μ μ§μ νμ§ μμ κ²½μ° bonusλ_bonus.
{c/h}λ‘ λλλ λ€λ₯Έ νμΌμ μμ΄μΌν©λλ€. Mandatoryμ bonus part νκ°λ λ³λλ‘ μνλ©λλ€. -
If your project allows you to use your libft, you must copy its sources and its associated Makefile in a libft folder with its associated Makefile. Your projectβs Makefile must compile the library by using its Makefile, then compile the project.
γλ§μ½ νλ‘μ νΈκ° libftμ μ¬μ©μ νμ©νλ€λ©΄, libftμ μμ€νμΌκ³Ό Makefileμ libft ν΄λ μμ 볡μ¬ν΄μΌ ν©λλ€. νλ‘μ νΈμ Makefileμ libftμ Makefileμ μ¬μ©νμ¬ λΌμ΄λΈλ¬λ¦¬λ₯Ό μ»΄νμΌ ν λ€μμ νλ‘μ νΈλ₯Ό μ»΄νμΌν΄μΌ ν©λλ€. -
We encourage you to create test programs for your project even though this work wonβt have to be submitted and wonβt be graded. It will give you a chance to easily test your work and your peersβ work. You will find those tests especially useful during your defence. Indeed, during defence, you are free to use your tests and/or the tests of the peer you are evaluating.
γμ΄ νλ‘μ νΈλ₯Ό μ μΆν νμκ° μκ³ μ μκ° λ§€κ²¨μ§μ§ μλλΌλ νλ‘μ νΈλ₯Ό μν ν μ€νΈ νλ‘κ·Έλ¨μ λ§λ€μ΄ λ³Ό κ²μ κΆμ₯ν©λλ€. μ΄λ μ¬λ¬λΆμ κ²°κ³Όλ¬Όκ³Ό λλ£λ€μ κ²°κ³Όλ¬Όμ μ½κ² ν μ€νΈν μ μλ κΈ°νλ₯Ό μ€ κ²μ λλ€. μ¬λ¬λΆμ μ΄ ν μ€νΈλ€μ΄ λνμ€ μ€μ νΉν μ μ©νλ€λ κ²μ μκ² λ κ² μ λλ€. μ€μ λ‘, λνμ€λ₯Ό νλ λμ μ¬λ¬λΆμ΄λ νκ° μ€μΈ λλ£μ ν μ€νΈλ₯Ό μμ λ‘κ² μ¬μ©ν μ μμ΅λλ€. -
Submit your work to your assigned git repository. Only the work in the git repository will be graded. If Deepthought is assigned to grade your work, it will be done after your peer-evaluations. If an error happens in any section of your work during Deepthoughtβs grading, the evaluation will stop.
γν λΉλ Git μ μ₯μμ κ²°κ³Όλ¬Όμ μ μΆν©λλ€. Git μ μ₯μμ μλ κ²°κ³Όλ¬Όλ§ μ±μ λ©λλ€. λ§μ½ Deepthoughtκ° μ¬λ¬λΆμ μμ μ μ±μ νλλ‘ μ§μ λλ€λ©΄, μ΄λ λλ£νκ° μ’ λ£ νμ μ΄λ€μ§ κ²μ λλ€. Deepthoughtκ° μ±μ νλ λμ μ€λ₯κ° λ°μνλ©΄ νκ°κ° μ’ λ£λ©λλ€.
νλ‘κ·Έλ¨ μ΄λ¦ | minishell |
μ μΆν νμΌ | Makefile, *.h, *.c |
Makefile | NAME, all, clean, fclean, re |
μΈμ | |
μ¬μ©κ°λ₯ν Β μΈλΆ ν¨μ Β Β Β Β Β Β | readline, rl_clear_history, rl_on_new_line, rl_replace_line, rl_redisplay, add_history, printf, malloc, free, write, access, open, read, close, fork, wait, waitpid, wait3, wait4, signal, sigaction, sigemptyset, sigaddset, kill, exit, getcwd, chdir, stat, lstat, fstat, unlink, execve, dup, dup2, pipe, opendir, readdir, closedir, strerror, perror, isatty, ttyname, ttyslot, ioctl, getenv, tcsetattr, tcgetattr, tgetent, tgetflag, tgetnum, tgetstr, tgoto, tputs |
μ§μ λ§λ libft | μ¬μ© κ°λ₯ |
μ€λͺ | μμ μμ±νμΈμ |
λΉμ μ μμ:
-
μ λͺ λ Ήμ κΈ°λ€λ¦΄ λ ν둬ννΈλ₯Ό νμν΄μΌ ν©λλ€.
-
μμ νμ€ν 리λ₯Ό κ°κ³ μμ΄μΌ ν©λλ€.
-
Search and launch the right executable (based on the PATH variable or using a relative or an absolute path).
(PATH λ³μλ μλ, μ λ κ²½λ‘λ₯Ό νμ©νμ¬) μ¬λ°λ₯Έ μ€ν νμΌμ μ°Ύμ μ€νν μ μμ΄μΌ ν©λλ€.
-
μ΅λ 1κ°μ μ μ λ³μλ₯Ό μ¬μ©ν΄μΌ ν©λλ€. μ μ μ λ³μλ₯Ό μ¬μ©νλμ§ μκ°ν΄λ³΄κ³ κ·Έ λͺ©μ μ μ€λͺ ν μ μμ΄μΌ ν©λλ€.
-
Not interpret unclosed quotes or special characters which are not required by the subject such as \ (backslash) or ; (semicolon).
λ«νμ§ μμ λ°μ΄νλ (λ°±μ¬λμ) λ ;(μΈλ―Έμ½λ‘ )κ³Ό κ°μ΄ κ³Όμ μ νμνμ§ μμ νΉμλ¬Έμλ₯Ό ν΄μνμ§ μμμΌ ν©λλ€.
-
Handle β (single quote) which should prevent the shell from interpreting the metacharacters in the quoted sequence.
μμ΄ quoted sequence μμ μλ metacharactersλ₯Ό ν΄μνμ§ λͺ»νλλ‘ νλ β(single quote)λ₯Ό μ²λ¦¬ν΄μΌ ν©λλ€.
-
Handle " (double quote) which should prevent the shell from interpreting the metacharacters in the quoted sequence except for $ (dollar sign).
μμ΄ $(λ¬λ¬ κΈ°νΈ)λ₯Ό μ μΈν quoted sequence μμ μλ metacharactersλ₯Ό ν΄μνμ§ λͺ»νλλ‘ νλ β(double quote)λ₯Ό μ²λ¦¬ν΄μΌ ν©λλ€.
-
-
< should redirect input.
γ<
λ μ λ ₯μ 리λ€μ΄λ νΈ ν΄μΌ ν©λλ€. -
> should redirect output.
γ>
λ μΆλ ₯μ 리λ€μ΄λ νΈ ν΄μΌ ν©λλ€. -
<< should be given a delimiter, then read the input until a line containing the delimiter is seen. However, it doesnβt have to update the history!
γ<<
λ delimiterλ₯Ό μ§μ ν λ€μ delimiterλ₯Ό ν¬ν¨ν μ€μ λ§λκΈ° μ κΉμ§ μ λ ₯κ°μ μ½μ΅λλ€. κ·Έλ¬λ, νμ€ν 리λ₯Ό μ λ°μ΄νΈ ν νμλ μμ΅λλ€. -
>> should redirect output in append mode.
γ>>
λ append modeλ‘ μΆλ ₯μ 리λ€μ΄λ νΈ ν©λλ€.
-
γνμ΄ν (|
λ¬Έμ) ꡬν κ° νμ΄νλΌμΈλ§λ€ λͺ
λ Ήμ΄μ μΆλ ₯μ νμ΄νλ₯Ό ν΅ν΄ λ€μ λͺ
λ Ήμ΄μ μ
λ ₯μΌλ‘ λ€μ΄κ°μΌ ν©λλ€.
γ νκ²½ λ³μ
($ λ€μ μΌλ ¨μ λ¬Έμμ΄μ΄ μ€λ νμ)μ΄ κ·Έλ€μ κ°μΌλ‘ νμ₯λ μ μλλ‘ μ²λ¦¬ν΄μΌ ν©λλ€.
γ $?
λ κ°μ₯ μ΅κ·Όμ μ€νν foreground νμ΄νλΌμΈμ μ’
λ£ μνλ₯Ό νμ₯νλλ‘ μ²λ¦¬ν΄μΌ ν©λλ€.
γ ctrl-C
, ctrl-D
, ctrl-\
λ bashμ²λΌ λμνλλ‘ μ²λ¦¬ν΄μΌ ν©λλ€.
γλνν λͺ¨λμμ:
-
Your shell must implement the following builtins:
γμ¬λ¬λΆμ μμ λ€μ λ΄μ₯ κΈ°λ₯μ ꡬνν΄μΌ ν©λλ€.The readline() function can cause memory leaks. You donβt have to fix them. But that doesnβt mean your own code, yes the code you wrote, can have memory leaks.
readline() ν¨μλ‘ μΈν΄ λ©λͺ¨λ¦¬ λμκ° λ°μν μ μμ§λ§ μ΄κ²μ κ³ μΉ νμλ μμ΅λλ€. νμ§λ§ μ΄κ²μ΄ μ¬λ¬λΆμ΄ μμ±ν μ½λκ° λ©λͺ¨λ¦¬ λμκ° μμ΄λ λλ€λ κ²μ μλλλ€.
βΉοΈ You should limit yourself to the subject description. Anything that is not asked is not required. If you have any doubt about a requirement, take bash as a reference.
κ³Όμ μμ μꡬν μ€λͺ μ μ¬λ¬λΆμ μ νν΄μΌ ν©λλ€. μꡬνμ§ μμ κ²μ νμνμ§ μμ΅λλ€. μꡬμ¬νμ λν΄ μλ¬Έμ μ΄ μκΈ΄λ€λ©΄ [bash] λ₯Ό μ°Έκ³ νμΈμ.
μ¬λ¬λΆμ νλ‘κ·Έλ¨μ λ€μμ ꡬνν΄μΌ ν©λλ€:
-
γκ΄νΈλ₯Ό μ΄μ©ν΄ μ°μ μμλ₯Ό ννν
&&, ||
-
γμμΌλμΉ΄λ
*
κ° νμ¬ μμ λλ ν 리μ λν΄ λμνμ¬μΌ ν©λλ€.
π« The bonus part will only be assessed if the mandatory part is PERFECT. Perfect means the mandatory part has been integrally done and works without malfunctioning. If you have not passed ALL the mandatory requirements, your bonus part will not be evaluated at all.
bonus partλ mandatory partκ° μλ²½ν κ²½μ°μλ§ νκ°λ©λλ€. μλ²½νλ€λ κ²μ mandatory partκ° μ€λ₯ μμ΄ μμ νκ² μλνλ κ²μ μλ―Έν©λλ€. mandatory partμ μꡬμ¬νμ λͺ¨λ ν΅κ³Όνμ§ λͺ»νλ€λ©΄, bonus partλ μ ν νκ°λμ§ μμ΅λλ€.
Turn in your assignment in your Git repository as usual. Only the work inside your repository will be evaluated during the defense. Donβt hesitate to double check the names of your files to ensure they are correct.
νμμ²λΌ Git μ μ₯μμ κ³Όμ λ₯Ό μ μΆνμΈμ. λνμ€ μ€μλ μ μ₯μ λ΄λΆμ μμ λ¬Όλ§ νκ°λ©λλ€. λ€μ κ²μ¬νλ κ²μ λ§μ€μ΄μ§ λ§κ³ νμΌ μ΄λ¦μ΄ μ¬λ°λ₯Έμ§ νμΈνμΈμ.