https://github.com/librity/ft_libft
42 São Paulo - Libft
https://github.com/librity/ft_libft
42 42born2code 42saopaulo 42school c cursus ft-libft libft norminette tests
Last synced: 10 months ago
JSON representation
42 São Paulo - Libft
- Host: GitHub
- URL: https://github.com/librity/ft_libft
- Owner: librity
- License: mit
- Created: 2021-02-03T02:30:26.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-30T22:56:53.000Z (about 3 years ago)
- Last Synced: 2023-04-01T06:46:56.773Z (almost 3 years ago)
- Topics: 42, 42born2code, 42saopaulo, 42school, c, cursus, ft-libft, libft, norminette, tests
- Language: C
- Homepage: https://www.42sp.org.br/
- Size: 470 KB
- Stars: 4
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
42 São Paulo - libft






[](https://github.com/librity/ft_libft/actions/workflows/build.yml)
[](https://github.com/librity/ft_libft/actions/workflows/norminette_v3.yml)
A reasonably-complete implementation of stdlib.h,
and much much more.
---
## 📜 Table of Contents
- [About](#about)
- [Getting Started](#getting_started)
- [Usage](#usage)
- [Tests](#tests)
- [To Do](#todo)
- [Github Actions](#github_actions)
- [42 São Paulo](#ft_sp)
This was my first project at 42 São Paulo:
an implementation of many `stdlib.h` functions from scratch.
I've used it on most projects so far.
I learned about memory manipulations, string utilities and linked lists.
As a developer I've been using these functions for years
in some form or another, yet I had no idea how they really work.
Figuring them out was an initiation of sorts.
It has over 300 functions so far,
including a heap-less `printf` that handles `float`s and `long double`s.
All functions have a doxygen-style documentation comment,
and most have an example main.
I prioritize modularity and readability:
small functions with catchy names that do one thing well.
### ⚙️ Prerequisites
All you need is a shell and a C compiler like `gcc` or `clang`.
### 🖥️ Installing
To compile the entire thing just clone the repo and run `make`:
```bash
$ git clone https://github.com/librity/ft_libft.git
$ cd ft_libft
$ make
```
This will generate a `libft.a` archive, which you can compile with
any of the example files:
```bash
$ cp examples/ft_itoa.c examples/example.c
$ gcc -g -I ./includes examples/example.c libft.a
$ ./a.out
```
You can call most `stdlib.h` functions as you normally would
but with the prefix `ft_`:
```c
ft_putstr("Hello, world!\n");
```
This project is partly tested with the
[Unity framework](https://github.com/ThrowTheSwitch/Unity).
To run all tests, run `make`'s `test` rule:
```bash
make tests
```
- [ ] [Implement missing `stdlib.h` functions](https://cplusplus.com/reference/cstdlib/)
- [x] `atof()`
- [x] `atoi()`
- [x] `atol()`
- [x] `atoll()`
- [ ] `strtod()`
- [ ] `strtof()`
- [ ] `strtol()`
- [ ] `strtold()`
- [ ] `strtoll()`
- [ ] `strtoul()`
- [ ] `strtoull()`
- [ ] `rand()`
- [ ] `srand()`
- [x] `calloc()`
- [ ] `free()`
- [ ] `malloc()`
- [ ] `realloc()`
- [ ] `abort()`
- [ ] `atexit()`
- [ ] `at_quick_exit()`
- [ ] `exit()`
- [ ] `getenv()`
- [ ] `quick_exit()`
- [ ] `system()`
- [ ] `_Exit()`
- [ ] `bsearch()`
- [ ] `qsort()`
- [x] `abs()`
- [ ] `div()`
- [ ] `labs()`
- [ ] `ldiv()`
- [ ] `llabs()`
- [ ] `lldiv()`
- [ ] `mblen()`
- [ ] `mbtowc()`
- [ ] `wctomb()`
- [ ] `mbstowcs()`
- [ ] `wcstombs()`
[Norminette Github Action](https://github.com/AdrianWR/libft/blob/master/.github/workflows/norminette.yaml)
by [@AdrianWR](https://github.com/AdrianWR)
Part of the larger [42 Network](https://www.42.fr/42-network/),
[42 São Paulo](https://www.42sp.org.br/) is a software engineering school
that offers a healthy alternative to traditional education:
- It doesn't have any teachers and classes.
- Students learn by cooperating
and correcting each other's work (peer-to-peer learning).
- Its focus is as much on social skills as it is on technical skills.
- It's completely free to anyone that passes its selection process -
[**The Piscine**](https://42.fr/en/admissions/42-piscine/)
It's an amazing school, and I'm grateful for the opportunity.