diff options
-rw-r--r-- | ls.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -112,7 +112,7 @@ static int ls_compare_files(const void *op_a, const void *op_b) int ret = 0; switch (sort) { case SIZE: - ret = a->st.st_size - b->st.st_size; + ret = b->st.st_size - a->st.st_size; break; case CTIME: @@ -353,7 +353,13 @@ static void ls_print_long(size_t n, struct file_info files[static n]) printf("%*ju ", SIZEWIDTH, (uintmax_t)st.st_size); } - printf("%s ", ls_file_time(st.st_mtim)); + if (sort == ATIME) { + printf("%s ", ls_file_time(st.st_atim)); + } else if (sort == CTIME) { + printf("%s ", ls_file_time(st.st_ctim)); + } else { + printf("%s ", ls_file_time(st.st_mtim)); + } char * name = ls_filename(files + i); if (S_ISLNK(st.st_mode)) { |