Fix rsync 42 / 21 and improve name of ft_ltoa_base_len

This commit is contained in:
gbaconni
2022-04-18 09:14:59 +02:00
parent 0cd1d2ef1b
commit 505f5d9912
9 changed files with 28 additions and 83 deletions

4
.gitignore vendored
View File

@@ -1,13 +1,15 @@
42 42
ft_printf ft_printf
build
*.a *.a
*.o *.o
*.out *.out
*.so *.so
*.dSYM/ *.dSYM/
.*.swp .*.swp
.*.git
*~ *~
t t
t? t?
build
.vscode
.DS_Store/ .DS_Store/

View File

@@ -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
}

26
.vscode/launch.json vendored
View File

@@ -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
}
]
}
]
}

30
.vscode/settings.json vendored
View File

@@ -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/**"
]
}

View File

@@ -6,7 +6,7 @@
# By: gbaconni@student.42lausanne.ch +#+ +:+ +#+ # # By: gbaconni@student.42lausanne.ch +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ # # +#+#+#+#+#+ +#+ #
# Created: 2022/01/18 15:11:16 by gbaconni #+# #+# # # 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 @git clone $(GIT_REPO) 42 || true
21: 42 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/ @mv 42/.git .42.git
@make -C 42 sync @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

13
libftprintf/.gitignore vendored Normal file
View File

@@ -0,0 +1,13 @@
*.a
*.o
*.out
*.so
*.dSYM/
.*.swp
.*.git
*~
t
t?
build
.vscode
.DS_Store/

View File

@@ -6,13 +6,13 @@
/* By: gbaconni <gbaconni@42lausanne.ch> +#+ +:+ +#+ */ /* By: gbaconni <gbaconni@42lausanne.ch> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2021/08/16 13:51:16 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" #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) char *ft_ltoa_base(long n, char *base)
{ {
@@ -22,7 +22,7 @@ char *ft_ltoa_base(long n, char *base)
long nbase; long nbase;
nbase = ft_strlen(base); 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) if (s == NULL)
return (NULL); return (NULL);
i = 0; i = 0;
@@ -42,7 +42,7 @@ char *ft_ltoa_base(long n, char *base)
return (ft_strrev(s)); 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; size_t len;

View File

@@ -6,7 +6,7 @@
/* By: gbaconni@student.42lausanne.ch +#+ +:+ +#+ */ /* By: gbaconni@student.42lausanne.ch +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2022/01/20 11:43:52 by gbaconni #+# #+# */ /* 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 */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */

4
main.c
View File

@@ -6,7 +6,7 @@
/* By: baco <baco@student.42.fr> +#+ +:+ +#+ */ /* By: baco <baco@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2022/04/13 06:58:46 by gbaconni #+# #+# */ /* 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; char *s;
void *ptr; 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) if (s == NULL)
return (NULL); return (NULL);
ptr = s; ptr = s;