int main(int argc, char **argv) { int k; if (argc != 2) { ft_putchar('\n'); } else { k = ft_count(argv[1]); while(argv[1][k] == ' ') { k--; } while (argv[1][k] != ' ' && argv[1][k] != '\t' && argv[1][k] != 0) { *ft_strcpy(argv[1]); ft_rev(argv[1]); k--; } } ft_putchar('\n'); return (0); }
int ft_putnbr1(int n, t_numb *e) { int i; int r1; i = 0; r1 = 0; i = ft_count(n); if (n < 0) { if (e->indzero == 1 && e->w > i && e->pr == 0 && e->indminus == 0) { } n = -n; } if (n >= 10) { r1 = r1 + ft_putnbr(n / 10, e); r1 = r1 + ft_putnbr(n % 10, e); } else { ft_putchar(n + '0'); r1++; } return (r1); }
char *ft_strtrim(char const *s) { int i; int j; int max; char *tab; j = 0; if (s != NULL) { max = ft_count(s); if (max <= 0) return (tab = (char *)malloc(sizeof(tab))); tab = (char *)malloc(sizeof(tab) * (max + 1)); i = 0; while (s[i] == ' ' || s[i] == '\n' || s[i] == '\t') i++; while (j < max) { tab[j] = s[i]; i++; j++; } tab[j] = '\0'; return (tab); } return (NULL); }
char *ft_itoa(int n) { char *chaine; int count; int myn; int negativ; negativ = 0; count = 0; myn = n; if (n == 0 || n == -2147483648) return (myreturn(n)); if (n < 0) { negativ = 1; n = -n; count++; myn = n; } count = ft_count(n, count); chaine = (char *)malloc(sizeof(char) * (count + 1)); if (chaine == NULL) return (NULL); mystr(chaine, negativ, count, myn); chaine[count] = '\0'; return (chaine); }
int ft_checkd(t_numb *e) { int cnt; int i; cnt = 0; i = ft_count(e->d); if (e->d == 0) e->valzero = 1; if (e->indminus == 1) cnt = cnt + ft_checkd1(e); else if (e->indminus == 0) { if (e->valzero == 1) { cnt = cnt + ft_putnbr(e->d, e); } else { cnt = cnt + ft_countd(e, e->d); cnt = cnt + ft_putnbr(e->d, e); } } ft_initialize(e); return (cnt); }
char *ft_strtrim(char const *s) { char *trim; int i; int j; int k; if (s == NULL) return (NULL); i = 0; j = ft_strlen(s) - 1; k = 0; ft_count(s, &i, &j); if (j - i < -1) j = i - 1; trim = (char *)malloc(sizeof(char) * (j - i + 2)); if (trim == NULL) return (NULL); while (i <= j) { trim[k] = s[i]; i++; k++; } trim[k] = 0; return (trim); }
int ft_checkd1(t_numb *e) { int cnt; int i; cnt = 0; i = ft_count(e->d); if (e->d < 0) { ft_putchar('-'); cnt++; } if ((e->indplus == 1 && e->indminus == 0 && e->d < 0) || (e->indplus == 1 && e->indminus == 1 && e->d > 0)) e->w--; if ((e->indplus == 1 && e->indminus == 0 && e->d < 0) || (e->indplus == 1 && e->indminus == 1 && e->d > 0)) { ft_putchar('+'); cnt++; } if (e->indpr == 1) cnt = cnt + ft_checkd1a(e); cnt = cnt + ft_putnbr(e->d, e); cnt = cnt + ft_checkd1b(e); return (cnt); }
int ft_format_d(va_list ap, int n) { int len; len = 0; n = va_arg(ap, int); ft_putnbr(n); len = ft_count(n); return (len); }
int ft_checkd1a1(t_numb *e) { int cnt; int i; int j; cnt = 0; i = ft_count(e->d); j = 0; return (cnt); }
int ft_retet(char **tetriminos) { int i; int size; size = ft_count(tetriminos) * 2; i = 0; while ((i * i) < size) i++; return (i); }
void ft_rev(char *str) { int i; int j; char *dest; i = 0; j = ft_count(dest[i]); while (j != 0) { ft_putchar(dest[j]); j--; } }
t_l *ft_deal(t_l *lst) { t_l *lst2; int nb; nb = ft_count(lst); if (nb <= 20) { lst2 = ft_lstcpy(lst); lst2 = ft_insert(lst, lst2); } else { lst2 = ft_lstncpy(lst, nb); lst2 = ft_trif(lst2, nb); } return (lst2->first); }
int main(int ac, char **av) { char **tab; t_copy tab2; if (ac == 1 && av[0]) { tab = ft_read_file(); if (tab[0][0]) { tab2 = ft_count(tab); ft_test(tab, tab2); } } else ft_error("No arguments needed"); write(1, "\n", 1); return (0); }
char *ft_itoa_unsint(unsigned int n) { char *ret; int count; count = 0; count += ft_count(n); ret = (char *)malloc(sizeof(char) * (count + 1)); ret[count] = '\0'; while (n > 0) { ret[count - 1] = n % 10 + '0'; n = n / 10; count--; } if (count == 1) ret[0] = '-'; return (ret); }
int ft_checkd1a(t_numb *e) { int cnt; int i; int j; cnt = 0; i = ft_count(e->d); j = 0; if (i > e->pr) cnt = cnt + ft_checkd1a1(e); else if (i <= e->pr) { while (j < (e->pr - i)) { ft_putchar('0'); cnt++; j++; } } return (cnt); }
int ft_checkd1b(t_numb *e) { int cnt; int i; int j; cnt = 0; i = ft_count(e->d); if (i > e->pr) cnt = cnt + ft_checkd1b1(e); else if (i <= e->pr) { j = 0; while (j < e->w - e->pr) { ft_putchar(' '); j++; cnt++; } } return (cnt); }
int ft_open(char *str, t_point ***t) { int fd; char *line; int q; int count; count = ft_count(str); if (count == -1 || count == 0) return (-1); line = NULL; (*t) = (t_point **)malloc(sizeof(t_point *) * count); q = 0; if ((fd = open(str, O_RDONLY)) == -1) return (-1); while (get_next_line(fd, &line)) { (*t)[q] = ft_getnbr(line, q); q++; } (*t)[0][0].y = count; return (0); }