1
1

Add -e flag to enable extended information mode

And document the --color flag that I forgot.
Этот коммит содержится в:
Yorhel 2018-01-23 13:40:12 +01:00
родитель 77aca35fce
Коммит 47e969cdf3
4 изменённых файлов: 23 добавлений и 3 удалений

Просмотреть файл

@ -54,6 +54,19 @@ directory with many files. 10.000 files will get you an export in the order of
gzip. This scales linearly, so be prepared to handle a few tens of megabytes
when dealing with millions of files.
=item -e
Enable extended information mode. This will, in addition to the usual file
information, also read the ownership, permissions and last modification time
for each file. This will result in higher memory usage (by roughly ~30%) and in
a larger output file when exporting.
When using the file export/import function, this flag will need to be added
both when exporting (to make sure the information is added to the export), and
when importing (to read this extra information in memory). This flag has no
effect when importing a file that has been exported without the extended
information.
=back
=head2 Interface options

Просмотреть файл

@ -123,11 +123,11 @@ static int item(struct dir *dir, const char *name, struct dir_ext *ext) {
if(!root && orig)
name = orig->name;
/* TODO: Don't allocate ext if -e flag is not given */
item = malloc(dir->flags & FF_EXT ? dir_ext_memsize(name) : dir_memsize(name));
int extended = extended_info && (dir->flags & FF_EXT);
item = malloc(extended ? dir_ext_memsize(name) : dir_memsize(name));
memcpy(item, dir, offsetof(struct dir, name));
strcpy(item->name, name);
if(dir->flags & FF_EXT)
if(extended)
memcpy(dir_ext_ptr(item), ext, sizeof(struct dir_ext));
item_add(item);

Просмотреть файл

@ -101,6 +101,8 @@ extern long update_delay;
extern int cachedir_tags;
/* flag if we should ask for confirmation when quitting */
extern int confirm_quit;
/* flag whether we want to enable use of struct dir_ext */
extern int extended_info;
/* handle input from keyboard and update display */
int input_handle(int);

Просмотреть файл

@ -40,6 +40,7 @@ int pstate;
int read_only = 0;
long update_delay = 100;
int cachedir_tags = 0;
int extended_info = 0;
static int min_rows = 17, min_cols = 60;
static int ncurses_init = 0;
@ -120,6 +121,7 @@ static void argv_parse(int argc, char **argv) {
{ 'q', 0, "-q" },
{ 'v', 0, "-v" },
{ 'x', 0, "-x" },
{ 'e', 0, "-e" },
{ 'r', 0, "-r" },
{ 'o', 1, "-o" },
{ 'f', 1, "-f" },
@ -148,6 +150,7 @@ static void argv_parse(int argc, char **argv) {
printf(" -q Quiet mode, refresh interval 2 seconds\n");
printf(" -v Print version\n");
printf(" -x Same filesystem\n");
printf(" -e Enable extended information\n");
printf(" -r Read only\n");
printf(" -o FILE Export scanned directory to FILE\n");
printf(" -f FILE Import scanned directory from FILE\n");
@ -157,12 +160,14 @@ static void argv_parse(int argc, char **argv) {
printf(" -X, --exclude-from FILE Exclude files that match any pattern in FILE\n");
printf(" --exclude-caches Exclude directories containing CACHEDIR.TAG\n");
printf(" --confirm-quit Confirm quitting ncdu\n");
printf(" --color SCHEME Set color scheme\n");
exit(0);
case 'q': update_delay = 2000; break;
case 'v':
printf("ncdu %s\n", PACKAGE_VERSION);
exit(0);
case 'x': dir_scan_smfs = 1; break;
case 'e': extended_info = 1; break;
case 'r': read_only++; break;
case 's': si = 1; break;
case 'o': export = val; break;