This commit is contained in:
Etienne Rey-bethbeder
2023-02-14 13:54:41 +01:00
parent 7b3389c75d
commit afaf34f869
79 changed files with 38 additions and 7 deletions

BIN
utils/ft_getstr.o Normal file

Binary file not shown.

BIN
utils/ft_is_in_quote.o Normal file

Binary file not shown.

BIN
utils/ft_strnchr.o Normal file

Binary file not shown.

BIN
utils/ft_strncpy.o Normal file

Binary file not shown.

View File

@ -1,17 +1,19 @@
#include "utils.h"
char *ft_strreplace(char *str, char *fill, size_t start, size_t stop)
int ft_strreplace(char **str, char *fill, size_t start, size_t stop)
{
char *out;
size_t sum;
out = malloc((ft_strlen(str) + ft_strlen(fill) - (stop - start) + 1 * sizeof(char)));
if (out == NULL)
return (NULL);
return (1);
ft_strncpy(out, str, start);
ft_strncpy(out + start, fill, ft_strlen(fill));
sum = start + ft_strlen(fill);
ft_strncpy(out + sum, str + stop, ft_strlen(str) - stop);
out[sum + ft_strlen(str) - stop] = '\0';
return (out);
free(*str);
*str = out;
return (0);
}

BIN
utils/ft_strreplace.o Normal file

Binary file not shown.