Пример #1
0
t_state			get_link(t_lem *p, char *str)
{
	if (is_link(str) == 1)
	{
		fill_link(p, str);
		return (LINK);
	}
	else if (is_command(str) == 1)
		return (LINK);
	return (END);
}
Пример #2
0
int		insert_first_link(t_list *list, char *data)
{
  t_link	*new_elem;

  new_elem = NULL;
  new_elem = fill_link(new_elem, data);
  new_elem->next = list->tail;
  new_elem->previous = list->head;
  list->tail = new_elem;
  list->head = new_elem;
  list->size++;
  return (0);
}
Пример #3
0
int		insert_end(t_list *list, char *data)
{
  t_link	*new_elem;

  new_elem = NULL;
  if (list->tail == NULL)
    return (insert_first_link(list, data));
  new_elem = fill_link(new_elem, data);
  new_elem->next = NULL;
  new_elem->previous = list->tail;
  list->tail->next = new_elem;
  list->tail = new_elem;
  list->size++;
  return (0);
}
Пример #4
0
int		insert_beginning(t_list *list, char *data)
{
  t_link	*new_elem;

  new_elem = NULL;
  if (list->head == NULL)
    return (insert_first_link(list, data));
  new_elem = fill_link(new_elem, data);
  new_elem->previous = NULL;
  new_elem->next = list->head;
  list->head->previous = new_elem;
  list->head = new_elem;
  list->size++;
  return (0);
}