Recreating infamous printf function as described by standard C99.
Caution
Copying the content of this repository for your own delivery will grade you a
-42
for cheating.
Please refer to the fprintf format specification for information about supported features.
The current implementation follows strictly the C99 compliance, with the following known exceptions:
long double
(IEEE float 80) support has not been implemented.- multibyte character (
wchar_t
) are not supported. %e
as not been kept due to its incorrectness.
Note
Ask requested by the assignment, conversion specifier B
and b
from
c2x standard have been implemented, corresponding to binary format.
In case of invalid format, as specified by C99,our function will treat the given sequence as regular text and continue.
Note
To ensure a consistent development environment and to simplify dependency management, we strongly recommend using Nix. The project is configured to work seamlessly with Nix, providing reproducible builds and a standardized development environment.
If you haven't already, consider installing Nix by following the instructions on nix installation page.
You can use the standard nix flakes commands to clone
, build
, ... this
project.
nix build github:Sigmapitech/myprintf
outputs
libmy.a
containingmy_printf
.
0. Install the required dependencies
Make sure to have the following dependencies available within your environment:
- The
Coreutils
command set, which are expected to exist on every operating system. - a recent version of
Gnu make
~4.x.x GCC
, preferably, version13.x.x
along theGNU C Library
.- The
GNU ar
archive program, provided bybinutils
. - Optionally,
tput
command to support colors within the Makefile. criterion
library to compile tests.gcovr
to retrieve coverage report.
If you want to use the epitest container provided by Epitech, you can use the following command:
docker run -it --rm -v $(pwd):/home/project -w /home/project epitechcontent/epitest-docker:latest /bin/bash
I. Clone the repository
git clone https://github.com/Sigmapitech/myprintf.git myprintf
cd myprintf
II. Compile the library
Tip
you can touch .fast
to use parralel building.
make
To see other available targets, you can use a program such as fzf-make.
if you are using Nix
, you can access a devShell that you can develop
with the project dependencies to build and develop.
nix develop
nix develop github:Sigmapitech/myrpg
You may load the devShell automatically using direnv shell integration.
echo "use flake" | tee .envrc
direnv allow
A tester is provided to compared the implementation along-side printf
from
glibc. Test table only features defined behaviour described by the standard.
To run the tests and get a coverage report:
make cov