website/nginx/site/html/minishell.html
2025-06-03 17:02:01 +02:00

105 lines
7.0 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title></title>
<link href="/css/style.css" rel="stylesheet">
<link href="/css/tailwind.css" rel="stylesheet">
</head>
<body>
<div class="flex flex-col w-full">
<header class="flex flex-col h-48 w-screen text-[#FFF6DA]" style="background-color: rgb(169, 74, 74);">
<h1 class="p-8 grow place-content-center text-center text-5xl">My Personal Website</h1>
<div class="w-screen flex p-1 justify-center px-30 gap-4" style="background-color: #889E73">
<a class="p-4 hover:bg-[#aa9E73ff] rounded-md" href="/">Home</a>
<a class="p-4 hover:bg-[#aa9E73ff] rounded-md" href="/html/minishell.html">Minishell</a>
<a class="p-4 hover:bg-[#aa9E73ff] rounded-md" href="/html/minirt.html">MiniRT</a>
<a class="p-4 hover:bg-[#aa9E73ff] rounded-md" href="/html/emiku.html">emiku</a>
</div>
</header>
<div class="flex flex-col gap-y-6 bg-neutral-200/70 w-[60%] ml-[10%] mr-auto px-16 py-8">
<h2 class="text-4xl font-bold text-gray-800">The Shell</h2>
<div class="space-y-2">
<p class="leading-relaxed text-gray-700 max-w-prose">
The minishell project is part of the common core curriculum at
<a class="underline text-blue-700 hover:text-blue-900" href="https://42vienna.com">ecole42</a> and
is seen as a milestone and one of the biggest jumps in complexity on the way to completing the cursus.
</p>
<p class="leading-relaxed text-gray-700 max-w-prose">
The rules are simple: Create a program that will replicate basic shell behaviour like typically found on posix systems.
</p>
<p class="leading-relaxed text-gray-700 mb-4 max-w-prose">
Some of the requirements are:
</p>
<ul class="list-disc list-inside space-y-2 text-gray-700 ml-4">
<li>Command line parsing</li>
<li>I/O loop to accept continuous commands</li>
<li>Command execution</li>
<li>File Descriptor redirection</li>
<li>Pipe Operators</li>
<li>Environment Variables</li>
<li>Builtin functions (cd, export, exit etc.)</li>
<li>Heredoc</li>
<li>Logical AND ( && )</li>
<li>Logical OR ( || )</li>
<li>and more...</li>
</ul>
<p class="leading-relaxed text-gray-700 mb-4 max-w-prose">
The program has to be written in C, we are working on GNU/Linux machines.
</p>
<p class="leading-relaxed text-gray-700 mb-4 max-w-prose">
We are also required to follow a very strict norm on which you can read more
<a class="underline text-blue-700 hover:text-blue-900" href="/assets/42-norm.pdf">here</a>.
</p>
<p class="leading-relaxed text-gray-700 mb-4 max-w-prose">
What makes the 42 projects stand out in my opinon is that the tools we use are very restricted, essentially only allowing
syscalls to interface with the kernel, some utility functions and memory functions, and in this case we were allowed to use
printf, which is normally forbidden.
This means that all utilty has to be implemented by hand, and all relevant code will be written by the projects authors.
</p>
<p class="leading-relaxed text-gray-700 mb-4 max-w-prose">
We also could use the readline function used in bash to handle the input of the user.<br>
Since memory leaks of any kind are considered an unrecoverable mistake when validating a project, and the readline function would
inevitably leak memory, those leaks were explicitly tolerated by the projects requirements.
</p>
<p class="leading-relaxed text-gray-700 mb-4 max-w-prose">
But, out of cursiousity, we decided to recreate the readline function, removing the dependecy and leaks from our project,
and leanring a lot along the way.<br>
In my opinion, this is one of the more interesting part of our implementation, and I very much enjoyed it!
</p>
<p class="leading-relaxed text-gray-700 mb-4 max-w-prose">
This project was a team effort, and big thanks go out to my team partner<br>and good friend,
<a class="underline text-blue-700 hover:text-blue-900" href="https://github.com/zekmaro">Andrej Arama</a>!
</p>
<p class="leading-relaxed text-gray-700 mb-4 max-w-prose">
The source code for the project can be seen on my
<a class="underline text-blue-700 hover:text-blue-900" href="https://git.victorvobis.org/minishell">git server</a> and
I have also provided a live version of the shell found below.<br/>
Please keep in mind, this is barely a prototype, and serves more as a proof of concept, than a fully implemented shell.
</p>
<p class="leading-relaxed text-gray-700 mb-4 max-w-prose">
Credits and many thanks to
<a class="underline text-blue-700 hover:text-blue-900" href="https://github.com/tsl0922/ttyd">ttyd</a>
for providing the web integeration!<br/>
Have fun!
</p>
<div id="shell-container" class="flex max-w-[800px] min-h-[600px] bg-gray-800 justify-center place-items-center">
<button id="shell-start-button" class="flex p-4 bg-neutral-100/50 place-items-center rounded-md">
Start Shell
</button>
</div>
</div>
<div class="flex justify-between">
<p class="leading-relaxed text-gray-700 mb-4">
After trying out the shell, feel free to check out my other projects!
</p>
<a id="next-project-a" class="underline text-blue-700 hover:text-blue-900" href="/html/minirt.html">Next Project...</a>
</div>
</div>
</div>
<script type="module" src="/js/minishell.js"></script>
</body>
</html>