97 lines
5.0 KiB
HTML
97 lines
5.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">
|
|
</head>
|
|
<body>
|
|
<header>
|
|
<h1>Minishell - The Shell</h1>
|
|
<nav>
|
|
<a href="/">Home</a>
|
|
<a href="mailto:victor@victorvobis.org">Email</a>
|
|
<a href="https://git.victorvobis.org/victorvobis" target="_blank">Git</a>
|
|
<a href="https://git.victorvobis.org/victorvobis/minishell" target="_blank">Source</a>
|
|
</nav>
|
|
</header>
|
|
<main>
|
|
<section class="content">
|
|
<div>
|
|
<h2 class="text-4xl font-bold text-gray-800">The Shell</h2>
|
|
<div class="space-y-2">
|
|
<p>
|
|
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">42Vienna</a> and
|
|
is seen as a milestone and one of the biggest jumps in complexity on the way to completing the cursus.
|
|
</p>
|
|
<p>
|
|
The rules are simple: Create a program that will replicate basic shell behaviour like typically found on posix systems.
|
|
</p>
|
|
<p>
|
|
Some of the requirements are:
|
|
</p>
|
|
<ul>
|
|
<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>
|
|
The program has to be written in C, we are working on GNU/Linux machines.
|
|
</p>
|
|
<p>
|
|
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>
|
|
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>
|
|
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>
|
|
But, out of cursiousity, we decided to recreate the readline function, removing the dependency and leaks from our project,
|
|
and learning a lot along the way.<br>
|
|
In my opinion, this is one of the more interesting parts of our implementation, and I very much enjoyed it!
|
|
</p>
|
|
<p>
|
|
This project was a team effort, and big thanks go out to my team partner<br>and good friend,
|
|
<a href="https://github.com/zekmaro">Andrej Arama</a>!
|
|
</p>
|
|
|
|
<p>
|
|
The source code for the project can be seen on my
|
|
<a href="https://git.victorvobis.org/victorvobis/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>
|
|
Credits and many thanks to
|
|
<a href="https://github.com/tsl0922/ttyd">ttyd</a>
|
|
for providing the web integeration!<br/>
|
|
Have fun!
|
|
</p>
|
|
<div id="shell-container" style="height: 400px;">
|
|
<iframe sandbox="allow-same-origin allow-scripts" src="/proxy/minishell/" style="width: 100%; height: 100%; border: none; display: block;"></iframe>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
</main>
|
|
</body>
|
|
</html>
|