diff --git a/.gitignore b/.gitignore index 3d29e0f..417a433 100644 --- a/.gitignore +++ b/.gitignore @@ -1,13 +1,15 @@ 42 ft_printf -build *.a *.o *.out *.so *.dSYM/ .*.swp +.*.git *~ t t? +build +.vscode .DS_Store/ diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json deleted file mode 100644 index dab2f43..0000000 --- a/.vscode/c_cpp_properties.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "configurations": [ - { - "name": "linux-gcc-x64", - "includePath": [ - "${workspaceFolder}/**" - ], - "compilerPath": "/usr/bin/gcc", - "cStandard": "${default}", - "cppStandard": "${default}", - "intelliSenseMode": "linux-gcc-x64", - "compilerArgs": [] - } - ], - "version": 4 -} \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json deleted file mode 100644 index 711caba..0000000 --- a/.vscode/launch.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "version": "0.2.0", - "configurations": [ - { - "name": "C/C++ Runner: Debug Session", - "type": "cppdbg", - "request": "launch", - "args": [], - "stopAtEntry": false, - "cwd": "/home/baco/ft_printf", - "environment": [], - "program": "/home/baco/ft_printf/build/Debug/outDebug", - "internalConsoleOptions": "openOnSessionStart", - "MIMode": "gdb", - "miDebuggerPath": "/usr/bin/gdb", - "externalConsole": false, - "setupCommands": [ - { - "description": "Enable pretty-printing for gdb", - "text": "-enable-pretty-printing", - "ignoreFailures": true - } - ] - } - ] -} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 862cfc6..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "C_Cpp_Runner.cCompilerPath": "/usr/bin/gcc", - "C_Cpp_Runner.cppCompilerPath": "/usr/bin/g++", - "C_Cpp_Runner.debuggerPath": "/usr/bin/gdb", - "C_Cpp_Runner.cStandard": "", - "C_Cpp_Runner.cppStandard": "", - "C_Cpp_Runner.msvcBatchPath": "", - "C_Cpp_Runner.warnings": [ - "-Wall", - "-Wextra", - "-Wpedantic" - ], - "C_Cpp_Runner.enableWarnings": true, - "C_Cpp_Runner.warningsAsError": false, - "C_Cpp_Runner.compilerArgs": [], - "C_Cpp_Runner.linkerArgs": [], - "C_Cpp_Runner.includePaths": [], - "C_Cpp_Runner.includeSearch": [ - "*", - "**/*" - ], - "C_Cpp_Runner.excludeSearch": [ - "**/build", - "**/build/**", - "**/.*", - "**/.*/**", - "**/.vscode", - "**/.vscode/**" - ] -} \ No newline at end of file diff --git a/Makefile b/Makefile index 313c37d..9774990 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ # By: gbaconni@student.42lausanne.ch +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2022/01/18 15:11:16 by gbaconni #+# #+# # -# Updated: 2022/04/17 20:56:04 by gbaconni ### lausanne.ch # +# Updated: 2022/04/18 09:07:48 by gbaconni ### lausanne.ch # # # # **************************************************************************** # # @@ -136,6 +136,8 @@ config: @git clone $(GIT_REPO) 42 || true 21: 42 - @find libftprintf -maxdepth 2 -type f -name '*.c' -o -name '*.h' -o -name 'Makefile' | sed -r "s|(libftprintf/)|\1./|" | xargs -I {} rsync -SaR {} 42/ - @make -C 42 sync + @mv 42/.git .42.git + @rsync --verbose --archive --delete --include '*.c' --include '*.h' --include 'Makefile' --include '*/' --exclude '*' libftprintf/ 42/ + @mv .42.git 42/.git + @make -C 42 check fclean clean re all sync diff --git a/libftprintf/.gitignore b/libftprintf/.gitignore new file mode 100644 index 0000000..b124b16 --- /dev/null +++ b/libftprintf/.gitignore @@ -0,0 +1,13 @@ +*.a +*.o +*.out +*.so +*.dSYM/ +.*.swp +.*.git +*~ +t +t? +build +.vscode +.DS_Store/ diff --git a/libftprintf/ft_ltoa_base.c b/libftprintf/ft_ltoa_base.c index f560d81..d3edc69 100644 --- a/libftprintf/ft_ltoa_base.c +++ b/libftprintf/ft_ltoa_base.c @@ -6,13 +6,13 @@ /* By: gbaconni +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2021/08/16 13:51:16 by gbaconni #+# #+# */ -/* Updated: 2022/04/16 00:46:32 by gbaconni ### lausanne.ch */ +/* Updated: 2022/04/18 09:13:04 by gbaconni ### lausanne.ch */ /* */ /* ************************************************************************** */ #include "libftprintf.h" -static long ft_longlen_base(long n, long nbase); +static long ft_ltoa_base_len(long n, long nbase); char *ft_ltoa_base(long n, char *base) { @@ -22,7 +22,7 @@ char *ft_ltoa_base(long n, char *base) long nbase; nbase = ft_strlen(base); - s = (char *) ft_calloc((ft_longlen_base(n, nbase) + 1), sizeof(char)); + s = (char *) ft_calloc(ft_ltoa_base_len(n, nbase) + 1, sizeof(char)); if (s == NULL) return (NULL); i = 0; @@ -42,7 +42,7 @@ char *ft_ltoa_base(long n, char *base) return (ft_strrev(s)); } -static long ft_longlen_base(long n, long nbase) +static long ft_ltoa_base_len(long n, long nbase) { size_t len; diff --git a/libftprintf/ft_vprintf.c b/libftprintf/ft_vprintf.c index 95c1125..d4b084e 100644 --- a/libftprintf/ft_vprintf.c +++ b/libftprintf/ft_vprintf.c @@ -6,7 +6,7 @@ /* By: gbaconni@student.42lausanne.ch +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2022/01/20 11:43:52 by gbaconni #+# #+# */ -/* Updated: 2022/04/17 22:45:28 by gbaconni ### lausanne.ch */ +/* Updated: 2022/04/18 09:01:19 by gbaconni ### lausanne.ch */ /* */ /* ************************************************************************** */ diff --git a/main.c b/main.c index 7a19b84..4809a6e 100644 --- a/main.c +++ b/main.c @@ -6,7 +6,7 @@ /* By: baco +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2022/04/13 06:58:46 by gbaconni #+# #+# */ -/* Updated: 2022/04/18 00:50:01 by gbaconni ### lausanne.ch */ +/* Updated: 2022/04/18 09:12:07 by gbaconni ### lausanne.ch */ /* */ /* ************************************************************************** */ @@ -136,7 +136,7 @@ char *ft_unescape(const char *str) char *s; void *ptr; - s = (char *) ft_calloc(ft_unescape_len(str), sizeof(char)); + s = (char *) ft_calloc(ft_unescape_len(str) + 1, sizeof(char)); if (s == NULL) return (NULL); ptr = s;