int main() { char c; c = '9'; while (c >= '0') ft_putchar2(c--); ft_putchar2('\n'); return (0); }
void saute_espace(int j) { while (j < 16) { ft_putchar2(' '); ft_putchar2(' '); if (j && j % 2 == 0) ft_putchar2(' '); j++; } }
void print_memory(const void *addr, size_t size) { unsigned int i; i = 0; while (addr && i < size) { print_bin(addr, i, size); ft_putchar2(' '); print_dump(addr, i, size); ft_putchar2('\n'); i += 16; } }
void hidenp(char *tofind, char *phrase) { int y; int x; x = 0; y = 0; while (phrase[y] != '\0') { if (tofind[x] == phrase[y]) x++; y++; } if (tofind[x] == '\0') ft_putchar2('1', '\n'); else ft_putchar2('0', '\n'); }
void print_bin(const void *addr, unsigned i, size_t size) { int j; const void *p; unsigned char *c; char tab[16] = "0123456789abcdef"; p = addr + i; j = 0; while (j < 16 && (i + j) < size) { if (j && (j % 2 == 0)) ft_putchar2(' '); c = (unsigned char *)(p + j); ft_putchar2(tab[*c / 16]); ft_putchar2(tab[*c % 16]); j++; } saute_espace(j); }
void print_dump(const void *addr, unsigned i, size_t size) { int j; const void *p; unsigned char *c; p = addr + i; j = 0; while (j < 16 && (i + j) < size) { c = (unsigned char *)(p + j); ft_putchar2(printable(*c)); j++; } }