src/labels.c
/*
**	Looks for matching label in linked list and returns the cursor. If no label
**	is found, then it outputs an error and safely exits. Unfortunately, as this
**	must happen during the processing stage, the line number can't be output to
**	the command line.
*/
Looks for matching label in linked list and returns the cursor. If no label
is found, then it outputs an error and safely exits. Unfortunately, as this
must happen during the processing stage, the line number can't be output to
the command line.
Looks for matching label in linked list and returns the cursor . If no label is found then it outputs an error and safely exits . Unfortunately as this must happen during the processing stage the line number can ' t be output to the command line .
int		search_label(char *label)
{
	t_label	*result;
	if (g_labels)
	{
		result = g_labels;
		while (result->next && ft_strcmp(label, result->label))
			result = result->next;
		if (!ft_strcmp(label, result->label))
			return (result->cursor);
	}
	ft_putstr("Label \"");
	ft_putstr(label);
	ft_putendl("\" not found.");
	cleanup();
	exit(EXIT_FAILURE);
	return (-1);
}
int search_label ( char * label ) { t_label * result ; if ( g_labels ) { result = g_labels ; while ( result -> next && ft_strcmp ( label , result -> label ) ) result = result -> next ; if ( ! ft_strcmp ( label , result -> label ) ) return ( result -> cursor ) ; } ft_putstr ( " \" " ) ; ft_putstr ( label ) ; ft_putendl ( " \" " ) ; cleanup ( ) ; exit ( EXIT_FAILURE ) ; return ( -1 ) ; }
Looks for matching label in linked list and returns the cursor.
Looks for matching label in linked list and returns the cursor .