X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=blobdiff_plain;f=dus.c;h=338b69b5685913b8a4b85513c93951eff8bcb7c8;hb=054abc1c6c091414c49ce18a88de51d6dd1a276d;hp=d83f9309f0355061c52bf7d056de4aa453304efd;hpb=76bfccae753814ab4a46224fa4ded68a4966a107;p=dus.git diff --git a/dus.c b/dus.c index d83f930..338b69b 100644 --- a/dus.c +++ b/dus.c @@ -1,9 +1,9 @@ /* - * dus is a simple utility designed to display the list of files and - * directories with disk occupancy, sorted according to it. + * dus is a simple utility to display the files and directories + * according to their total disk occupancy. * - * Copyright (c) 2009 Francois Fleuret + * Copyright (c) 2010 Francois Fleuret * Written by Francois Fleuret * * This file is part of dus. @@ -34,10 +34,12 @@ #include #include -#define BUFFER_SIZE 1024 +#define BUFFER_SIZE 4096 typedef int64_t size_sum_t; +/********************************************************************/ + size_sum_t file_or_dir_size(char *name) { DIR *dir; struct dirent *dir_e; @@ -121,7 +123,6 @@ int compare_files(const void *x1, const void *x2) { } } - void print_sorted(struct file_with_size *root, int height) { struct file_with_size *node; struct file_with_size **nodes; @@ -184,6 +185,8 @@ int main(int argc, char **argv) { root = 0; + setlocale (LC_ALL, ""); + if(argc > 1) { for(k = 1; k < argc; k++) { root = create(argv[k], root);