#include <stdlib.h>
//#include "mylist.h"                                                           

typedef struct s_list
{
  void  *data;
  struct s_list *next;
} t_list;

void    my_putchar(char c)
{
  write(1, &c, 1);
}

int     my_putstr(char *str)
{
  int   i;

  i = 0;
  while (str[i] != '\0')
    {
      my_putchar(str[i]);
      i++;
    }
  return (str[i]);
}

int     my_show(t_list *dbt)
{
  while (dbt != 0)
    {
      my_putstr(dbt->data);
      my_putchar('\n');
      dbt = dbt->next;
    }
  return (0);
}

int     my_put_in_list(t_list **dbt, char *data)
{
  t_list        *new_elem;

  new_elem = malloc(sizeof(*new_elem));
  if (new_elem == NULL)
    return (0);
  new_elem->data = data;
  new_elem->next = *dbt;
  *dbt = new_elem;
  return (0);
}

t_list  *my_params_in_list(int ac, char **av)
{
  t_list        *dbt;
  int   i;

  dbt = 0;
  i = 0;
  while (i < ac)
    {
      my_put_in_list(&dbt, av[i]);
      i++;
    }
  return (dbt);
}

int     main(int ac, char **av)
{
  t_list        *test;
  t_list        **test2;

  test = my_params_in_list(ac, av);
  test2 = &test;
  my_show(test);
  return (0);