i think i never speedran the norm like this before
This commit is contained in:
@ -6,22 +6,22 @@
|
||||
/* By: tomoron <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/04/17 09:12:33 by tomoron #+# #+# */
|
||||
/* Updated: 2024/04/17 10:42:39 by tomoron ### ########.fr */
|
||||
/* Updated: 2024/04/18 20:49:00 by marde-vr ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "minishell.h"
|
||||
|
||||
int wildcard_cmp(char *s1, char *s2, char *order)
|
||||
int wildcard_cmp(char *s1, char *s2, char *order)
|
||||
{
|
||||
while(*s1 && *s2)
|
||||
while (*s1 && *s2)
|
||||
{
|
||||
while(*s1 && !ft_isalnum(*s1))
|
||||
while (*s1 && !ft_isalnum(*s1))
|
||||
s1++;
|
||||
while(*s2 && !ft_isalnum(*s2))
|
||||
while (*s2 && !ft_isalnum(*s2))
|
||||
s2++;
|
||||
if(*s1 != *s2)
|
||||
return ((ft_strchr(order, *s2) - order) - (ft_strchr(order, *s1)\
|
||||
if (*s1 != *s2)
|
||||
return ((ft_strchr(order, *s2) - order) - (ft_strchr(order, *s1)
|
||||
- order));
|
||||
s1++;
|
||||
s2++;
|
||||
@ -31,18 +31,19 @@ int wildcard_cmp(char *s1, char *s2, char *order)
|
||||
|
||||
void sort_wildcards_token(t_token *list)
|
||||
{
|
||||
t_token *tmp;
|
||||
t_token *start;
|
||||
char *swap;
|
||||
|
||||
t_token *tmp;
|
||||
t_token *start;
|
||||
char *swap;
|
||||
|
||||
tmp = list;
|
||||
start = list;
|
||||
while(tmp)
|
||||
while (tmp)
|
||||
{
|
||||
list = start;
|
||||
while(list->next)
|
||||
while (list->next)
|
||||
{
|
||||
if(wildcard_cmp(list->value, list->next->value, "zZyYxXwWvVuUtTsSrRqQpPoOnNmMlLkKjJiIhHgGfFeEdDcCbBaA9876543210") > 0)
|
||||
if (wildcard_cmp(list->value, list->next->value,
|
||||
"zZyYxXwWvVuUtTsSrRqQpPoOnNmMlLkKjJiIhHgGfFeEdDcCbBaA9876543210") > 0)
|
||||
{
|
||||
swap = list->value;
|
||||
list->value = list->next->value;
|
||||
|
Reference in New Issue
Block a user