35 lines
1.2 KiB
C
35 lines
1.2 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* ft_char_case.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: pbonilla <eirodeis.lepnj@gmail.com> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2021/03/03 16:34:32 by pbonilla #+# #+# */
|
|
/* Updated: 2021/03/19 21:53:46 by pbonilla ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#include "../includes/ft_printf.h"
|
|
|
|
char *ft_char_case(t_param *param, int i)
|
|
{
|
|
int len;
|
|
int pos;
|
|
char *s;
|
|
|
|
len = 1;
|
|
pos = 0;
|
|
if (param->width > len)
|
|
len = param->width;
|
|
if (!param->minus)
|
|
pos = len - 1;
|
|
if (!(s = malloc(sizeof(char) * (len + 1))))
|
|
return (NULL);
|
|
s[len] = 0;
|
|
ft_memset(s, ' ', len);
|
|
s[pos] = i;
|
|
param->len = len;
|
|
return (s);
|
|
}
|