Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <unistd.h>
- #include "include/my_head.h"
- int my_strlen_x(char *str)
- {
- int i;
- i = 0;
- while (str[i] != '\n' && str[i] != '\0')
- i++;
- return (i);
- }
- int my_strlen_y(char *str)
- {
- int i;
- int j;
- i = 0;
- j = 0;
- while (str[i] != '\0')
- {
- if (str[i] == '\n')
- j++;
- i++;
- }
- return (j);
- }
- void my_aff_coord(int colle, int x, int y, int i)
- {
- if (i > 0)
- my_putstr(" || ");
- my_putstr("[colle1-");
- my_put_nbr(colle);
- my_putstr("] [");
- my_put_nbr(x);
- my_putstr("] [");
- my_put_nbr(y);
- my_putchar(']');
- }
- void what_is_this_glue(char *str)
- {
- int x;
- int y;
- int i;
- i = 0;
- x = my_strlen_x(str);
- y = my_strlen_y(str);
- if (my_colle1(str) == 1)
- my_aff_coord(1, x, y, i++);
- if (i == 0)
- {
- if (my_colle2(str, x ,y) == 1)
- my_aff_coord(2, x, y, i++);
- if (my_colle3(str, x, y) == 1)
- my_aff_coord(3, x, y, i++);
- if (my_colle4(str, x, y))
- my_aff_coord(4, x, y, i++);
- if (my_colle5(str, x, y))
- my_aff_coord(5, x, y, i++);
- }
- }
- int main(int ac, char **av)
- {
- char buff[BUFF_SIZE + 1];
- int len;
- while ((len = read(0, buff, BUFF_SIZE)) > 0)
- {
- if (len != 0)
- {
- buff[len] = '\0';
- what_is_this_glue(buff);
- my_putchar('\n');
- }
- }
- return (0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement