Exemple #1
0
int		main(int ac, char **av)
{
	t_option	*opt;
	t_lst_db	*db;
	int			i;
	char		*dot;

	db = NULL;
	opt = init(&dot, &i);
	while (av[1] != NULL && av[i] != NULL && av[i][0] == '-' && opt->end_opt)
	{
		if (av[i][1] == '-' && av[i][2] == '\0')
			opt->end_opt = 0;
		else
		{
			ft_recup_arg(av[i], opt, 1);
			i++;
		}
	}
	if (ac == 1)
	{
		av[0] = dot;
		i = 0;
	}
	while (i != ac && opt->no_option == 1)
	{
		ls_simple(av[i]);
		i++;
	}
	if (opt->no_option == 0)
		usearg(opt, av, db);
	return (0);
}
Exemple #2
0
void	display_file(t_opt arg, t_elem *files, int fileordir)
{
	t_elem	*cur;

	cur = files;
	cur = sort_elem(cur, arg);
	(arg.l == 1 || arg.g == 1) ? \
			ls_long(arg, cur, fileordir) : ls_simple(arg, cur);
	arg.upper_r == 1 ? recursion(arg, cur) : NULL;
}