Skip to content

backslash-zero/42-Minishell

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Minishell 42

About

Minishell is simple shell with similar behaviours as bash. Following builtins were self made: echo, cd, pwd, export, unset, env and exit; while other calls are made via execve and path lookup.

Functionalities

', ", ;, |, >, >>, $?, $VARIABLES, ctrl+C, ctrl+D, ctrl+\

Minishell example

Basic Concepts

  • Processes
  • Fork, wait, exec functions
  • Dup & FD handling
  • Pipes
  • Parsing
  • Errno & strerror

Allowed External Functions:

malloc, free, write, open, read, close, fork, wait, waitpid, wait3, wait4, signal, kill, exit, getcwd, chdir, stat, lstat, fstat, execve, dup, dup2, pipe, opendir, readdir, closedir, strerror, errno

External self coded libraries:

Libft: Self-made basic functions of C default libraries.
Printf_fd: Self-made library with similar behaviour as printf with custome file descriptor.

Project Structure

├── Makefile
├── incs
│   ├── builtin.h
│   ├── env.h
│   ├── error.h
│   ├── ft_printf.h
│   ├── libft.h
│   ├── minishell.h
│   ├── parsing.h
│   └── pipe.h
└── src
    ├── builtins
    │   ├── builtins_nametab.c
    │   ├── cd.c
    │   ├── echo.c
    │   ├── env.c
    │   ├── exit.c
    │   ├── export.c
    │   ├── export_2.c
    │   ├── export_next.c
    │   ├── export_next_2.c
    │   ├── pwd.c
    │   └── unset.c
    ├── execs
    │   ├── path.c
    │   ├── path_2.c
    │   ├── reads.c
    │   ├── reads_2.c
    │   ├── reads_3.c
    │   ├── redirections.c
    │   ├── redirections2.c
    │   └── sort_redir.c
    ├── ft_printf_fd
    │   └── libftprintf.a
    ├── libft
    │   └── libft.a
    ├── minishell.c
    ├── parsing
    │   ├── append.c
    │   ├── cleanup
    │   │   ├── cleanup.c
    │   │   ├── cleanup_bs_quote.c
    │   │   ├── cleanup_gret.c
    │   │   └── cleanup_var.c
    │   ├── parsing.c
    │   └── utils
    │       ├── is_funcs
    │       │   ├── is_funcs_1.c
    │       │   ├── is_funcs_2.c
    │       │   └── is_funcs_3.c
    │       ├── parsing_utils_1.c
    │       └── tools
    │           ├── backslash_tools_1.c
    │           ├── backslash_tools_2.c
    │           ├── gret_tools.c
    │           ├── quote_tools.c
    │           ├── redir_pipe_tools.c
    │           ├── semicolon_tools.c
    │           ├── var_tools_1.c
    │           └── var_tools_2.c
    ├── pipe
    │   ├── pipe.c
    │   ├── pipe2.c
    │   ├── pipe3.c
    │   └── pipe4.c
    └── utils
        ├── arg.c
        ├── error.c
        ├── free.c
        ├── ft_strncpy.c
        ├── prints.c
        └── semicolon.c

Ressources

Création d'un minisystème
Exit Codes
Write a shell in C
Single quote vs Double quotes

42's norm and principles

The projet must conform to 42's norm.

The project cannot leak. All errors must be handled carefully. In no way can the projet quit in an unexpected manner (Segmentation fault, bus error, double free, etc).

Project is therefore check with valgrind and/or fsanitize.

About

Selfmade Shell written in C

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published