void fill_in_tab(char *argv, t_env *e) { int fd; char *line; int i; fd = open(argv, O_RDONLY); line = NULL; if (fd == -1) { ft_putstr("Open failed\n"); exit(0); } else { i = 0; e->tab = (int **)malloc(sizeof(int *) * ft_count_line(argv)); while (get_next_line(fd, &line) == 1) { if (ft_strlen(line)) { e->tab[i] = ft_convert(line); i++; } } } e->numline = i; }
char *ft_ftoa(double n, size_t precision) { char *str; str = NULL; str = (char *)malloc(sizeof(char *) * ft_str_size(n, precision) + 1); if (str) ft_convert(str, n, precision); return (str); }
char *ft_itoa(long n) { char *str; str = NULL; str = (char*)malloc(sizeof(*str) * ft_str_size(n) + 1); if (str) ft_convert(str, n, ft_str_size(n)); return (str); }
char *ft_hexadec(va_list ap, char cb) { char *str2; unsigned int carry; carry = va_arg(ap, unsigned int); if (cb == 'x') str2 = ft_convert(carry, 16); else if (cb == 'X') str2 = ft_upper_convert(carry, 16); ft_putstr(str2); return (0); }
char *ft_itoa_base(long long int n, int base, int maj) { char *str; int i; str = ft_strnew(0); i = 0; if (maj == 0) maj = 39; else maj = 7; return (ft_convert(n, base, str, maj)); }
double ft_atof(const char *str) { t_atof res; res.ip = 0; res.fp = 0; res.div = 1; res.sign = 1; res.flag = 0; if (!str || !*str) return (0.0); while (*str == 32 || (*str >= 9 && *str <= 13)) str++; if (*str == '-') { str++; res.sign = -1; } else if (*str == '+') str++; return (ft_convert(str, res)); }
char *ft_itoa_base(int value, int base) { int i; int count; char *s; if (value == -2147483648) return (ft_strdup("-2147483648")); else { count = 0; i = value; while (i > 0) { count++; i = i / base; } s = (char *)malloc(sizeof(char) * count + 1); s = ft_convert(value, s, base, 0); return (s); } }
int main(int ac, char **av) { int fd; t_file file; char **tab; fd = 0; file = ft_init(file); tab = NULL; if (ac != 2) write(1, "usage: ./fillit input_file\n", 27); else { tab = ft_convert(ft_open(av[1], &fd, 0), &file.m, 0, 0); if (tab != NULL && ft_check(tab, file) != -1 && close(fd) != -1) { if (!(ft_resolve(tab, file, NULL))) write(1, "error\n", 6); } else write(1, "error\n", 6); } return (0); }
int main(int argc, char** argv) { ft_putstr(ft_convert(argv[1], argv[2])); return(argc); }