38 src/option_print.c 100644 → 100755
@@ -6,7 +6,7 @@
/* By: mallard <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/04/04 13:37:10 by mallard #+# #+# */
/* Updated: 2017/04/18 13:54:49 by mallard ### ########.fr */
/* Updated: 2017/04/21 20:03:34 by mallard ### ########.fr */
/* */
/* ************************************************************************** */

@@ -68,15 +68,7 @@ char **info_time(char *str, char **tab, t_opt env)
i = 0;
if (!(tmp = newtab(tablen(tab))))
return (0);
if (env.opt_u == 1)
while (tab[i] != NULL)
{
lstat(double_path(str, tab[i]), &buf);
tmp[i] = ft_strsub(ctime(&(buf.st_mtime)), 4, 12);
tmp[i] = ft_strjoin_f(tmp[i], " ", 0);
i++;
}
//info_time_bonus(str, tab, env, tmp);
info_time_bonus(str, tab, env, tmp);
return (tmp);
}

@@ -86,23 +78,38 @@ void info_time_bonus(char *str, char **tab, t_opt env, char **tmp)
struct stat buf;

i = 0;
if (env.opt_maj_u == 1)
if (env.opt_u == 1)
while (tab[i] != NULL)
{
lstat(double_path(str, tab[i]), &buf);
tmp[i] = ft_strsub(ctime(&(buf.st_atime)), 4, 12);
tmp[i] = ft_strjoin_f(tmp[i], " ", 0);
i++;
}
i = 0;
if (env.opt_c == 1)
else if (env.opt_maj_u == 1)
while (tab[i] != NULL)
{
lstat(double_path(str, tab[i]), &buf);
tmp[i] = ft_strsub(ctime(&(buf.st_birthtime)), 4, 12);
tmp[i] = ft_strjoin_f(tmp[i], " ", 0);
i++;
}
else if (env.opt_c == 1)
while (tab[i] != NULL)
{
lstat(double_path(str, tab[i]), &buf);
tmp[i] = ft_strsub(ctime(&(buf.st_ctime)), 4, 12);
tmp[i] = ft_strjoin_f(tmp[i], " ", 0);
i++;
}
else
while (tab[i] != NULL)
{
lstat(double_path(str, tab[i]), &buf);
tmp[i] = ft_strsub(ctime(&(buf.st_mtime)), 4, 12);
tmp[i] = ft_strjoin_f(tmp[i], " ", 0);
i++;
}
}

void info_link(char *str, char **tab, char ***info)
@@ -167,7 +174,7 @@ void info_user(char *str, char **tab, char ***info)
}
}

void opt_l(char *str, char **tab, t_opt env)
void opt_l(char *str, char **tab, t_opt env, int t)
{
char ***tmp;
int i;
@@ -180,7 +187,8 @@ void opt_l(char *str, char **tab, t_opt env)
tmp[4] = info_time(str, tab, env);
tmp[5] = tab;
tmp[6] = NULL;
l_total(str, tab);
if (t == 1)
l_total(str, tab);
while (i < tablen(tab))
{
mode_file(double_path(str, tab[i]));
0 src/option_sort.c 100644 → 100755
Empty file.
2 src/path.c 100644 → 100755
@@ -22,7 +22,7 @@ char *double_path(char *s1, char *s2)
return (s2);
if (!s2)
return (s1);
//if (ft_strcmp(s1, "/"))
if (ft_strcmp(s1, "/"))
str = ft_strjoin(s1, "/");
str = ft_strjoin(str, s2);
return (str);
5 src/tab.c 100644 → 100755
@@ -6,7 +6,7 @@
/* By: mallard <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/04/02 10:35:43 by mallard #+# #+# */
/* Updated: 2017/04/18 12:01:31 by mallard ### ########.fr */
/* Updated: 2017/04/21 19:30:43 by mallard ### ########.fr */
/* */
/* ************************************************************************** */

@@ -53,6 +53,8 @@ char **add_str_to_tab(char **tab, char *str)
int i;

i = tablen(tab);
if (tab[0] == NULL)
i = 1;
if (!(tmp = newtab(i + 1)))
return (0);
i = 0;
@@ -62,6 +64,7 @@ char **add_str_to_tab(char **tab, char *str)
i++;
}
tmp[i] = ft_strdup(str);
tabdel(tab);
return (tmp);
}