int ft_putwstr_pf(va_list ap, int nbb) { size_t i; wchar_t *str; i = 0; str = va_arg(ap, wchar_t *); printf("\n%S\n\n", str); exit(-1); while (i++ < nbb - ft_wcslen(str)) ft_putchar(' '); if (str) { ft_putwstr(str); return (ft_wcslen(str) + i); } else { ft_putstr("(null)"); return (6 + i); } }
size_t ft_strwlen(const wchar_t *s) { size_t len; size_t strlen; len = 0; strlen = 0; while (s[len] != '\0') { strlen += ft_wcslen(s[len]); len++; } return (strlen); }
char *handle_cap_s(va_list vlst, t_mods mods) { int fmtl_len; int cnt; char *out_str; wchar_t *wcs; fmtl_len = ft_strlen(mods.fmtl); cnt = 0; if (fmtl_len > 1) return ("ERROR: 'S' does not take any length modifier\n"); wcs = va_arg(vlst, wchar_t *); out_str = (char *)malloc(sizeof(char) * ft_wcslen(wcs)); while (*wcs != '\0') { out_str[cnt] = (char)*wcs; cnt++; wcs++; } out_str[cnt] = '\0'; return (fmt_s(mods, out_str)); }