please help

This commit is contained in:
LinlyBoi
2023-08-20 23:08:19 +03:00
parent 0df9b1789c
commit ac332f48ac

View File

@@ -18,22 +18,18 @@ int _printf(const char *format, ...)
va_start(args, format); va_start(args, format);
identifiers = _contains(format, '%'); identifiers = _contains(format, '%');
BUFF_SIZE = _strlen(format) - (identifiers * 2); BUFF_SIZE = _strlen(format) - (identifiers * 2);
if (!format) /* No string. No laundry */ if (!format) /* No string. No laundry */
return (0); return (0);
i = 0; /*TODO:gotta rename those*/ i = 0; /*TODO:gotta rename those*/
j = 0; j = 0;
buffer = "";
while (format) while (format)
{ {
if ((*format == '%') && (*(format + 1))) if ((*format == '%') && (*(format + 1)))
{ {
switch (*(format + 1)) switch (*(format + 1)) /*this needs to shrink*/
{ {
case 's': case 's':
next = va_arg(args, char*); /*Store string temporarily*/ next = va_arg(args, char*); /*Store string temporarily*/
@@ -42,24 +38,11 @@ int _printf(const char *format, ...)
BUFF_SIZE += _strlen(next); BUFF_SIZE += _strlen(next);
break; break;
case 'c': case 'c': /* add 1 byte and i++ */
/*
* You don't add 1Byte because %c becomes a single char so less to reallocate
* Increment i by 1
*/
break; break;
case '%': case '%': /*add 1 byte*/
/*
* Something add 1B, shove %, realloc
* increment i by 1
*/
break; break;
} }
/*
* something something increment i
* by size of argument value
* also no forgor about realloc
*/
} }
else else
{ {