1
1

205 Коммитов

Автор SHA1 Сообщение Дата
Yorhel
dfbeed9daf Fixing some whitespace issues 2012-08-27 21:51:08 +02:00
Yorhel
21c056f51d Use uint64_t instead of dev_t as well + added comment explaining this 2012-08-27 21:10:07 +02:00
Yorhel
cabb55290d Use uint64_t instead of ino_t
POSIX defines ino_t to be of an unsigned integer type, and searching
around the net didn't tell me of any definitions conflicting that. So
every ino_t can be represented in an uint64_t. (Assuming that is the
largest integer type in use for an inode number, but I'm sure that
assumption will hold for a while)

(dev_t, on the other hand, is a bit messier. Still figuring out what to
do with that.)
2012-08-27 19:12:13 +02:00
Yorhel
a61c784b8c Use int instead of long for struct dir->items
2 billion files should be enough for everyone. You probably won't have
enough memory to scan such a filesystem. int is a better choice than
long, as sizeof(int) is 4 on pretty much any system where ncdu runs.
2012-08-27 18:34:45 +02:00
Yorhel
73690f8f83 Use int64_t instead of off_t
*Should* be equivalent, but having a clearly standardised width is much
better.
2012-08-27 17:20:24 +02:00
Yorhel
44e63ce2e7 Added -u option to change the scan UI
This allows scanning stuff without initializing ncurses. Not too useful
at this point since ncdu will switch to an ncurses environment when it's
done anyway, but this will become more useful when the export-to-file
feature has been implemented.
2012-08-27 14:17:40 +02:00
Yorhel
e380805990 Fixed some compiler warnings and a (rather nonexistent) memory leak
This silences clang and gcc with -O2 -Wall -Wextra
2012-08-26 18:12:13 +02:00
Yorhel
5064b4d651 Re-added scanning UI and improved error handling 2012-08-26 17:08:10 +02:00
Yorhel
0fd7dec7b0 Split calc.c into separate components (dir_(mem|scan|common).c)
The architecture is explained in dir.h. The reasons for these changes is
two-fold:
- calc.c was too complex, it simply did too many things. 399ccdeb is a
  nice example of that: Should have been an easy fix, but it introduced
  a segfault (fixed in 0b49021a), and added a small memory leak.
- This architecture features a pluggable input/output system, which
  should make a file export/import feature relatively simple.

The current commit does not feature any user interface, so there's no
feedback yet when scanning a directory. I'll get to that in a bit.

I've also not tested the new scanning code very well yet, so I might
have introduced some bugs.
2012-08-26 15:29:55 +02:00
Chris West (Faux)
0b49021a6c 399ccdeb caused a crash on non-existent directories on the command line 2012-08-21 17:16:28 +01:00
Yorhel
399ccdeb47 calc.c: Fix path display when scanning an empty directory
http://dev.yorhel.nl/ncdu/bug/15
2012-08-18 09:21:33 +02:00
Yorhel
832b91b033 Make width of scan error screen dynamic as well 2012-08-18 08:55:51 +02:00
Yorhel
a87e90c3c2 main.c: Revert nodelay() status after calling ncresize()
This fixes a bug where ncdu would stop scanning a directory if the
terminal window has been resized to a small enough space that the
warning would show up.
2012-08-18 08:47:39 +02:00
Yorhel
9c9d466752 Make width of the scanning screen dynamic based on terminal width
http://dev.yorhel.nl/ncdu/bug/13
2012-08-18 08:46:48 +02:00
Yorhel
8a55c05e7d Some .gitignore fixes 2012-08-16 15:23:55 +02:00
Yorhel
10e560a9a6 Use top-level automake build + removed AUTHORS, INSTALL and NEWS
A more modern and practical structure.
2012-05-21 15:38:08 +02:00
Yorhel
ae659d5186 doc: Minor fix: "ncdu 1.7" -> "ncdu 1.7 and later" 2012-01-18 11:42:33 +01:00
Yorhel
7fcae11d4d Copyright year bump
Damn, it's 2012 already.
2012-01-18 11:40:50 +01:00
Yorhel
73562d46c5 doc: Use POD as source format and pod2man to generate ncdu.1
POD is somewhat more simple and flexible. I now use ncdu.pod to generate
a nicely formatted manual page on the ncdu homepage, rather than
displaying a rendering of ncdu.1 formatted in a monospace font.

The tarball will still contain an ncdu.1, so there's no extra dependency
on pod2man. (Unless you clone from git, since ncdu.1 isn't in the repo)
2012-01-18 11:36:39 +01:00
Yorhel
fcc871737a Version bump + ChangeLog update for 1.8
I'm now following the same idea from ncdc of using $VERSION+g in the git
repositories.
2011-11-03 13:06:20 +01:00
Yorhel
5243e2daf4 Code cleanup: Use `static' where applicable.
This should also allow compilers to generate better code.
2011-10-31 15:09:49 +01:00
Yorhel
dabe97f9c2 Use hash table when detecting hard links
This should be a *significant* performance increase when scanning a
directory that has many hard links.

I used the khash library written by Attractive Chaos[1]. This library
fits perfectly into ncdu's "use as little memory as possible but still
try to be very fast"-policy. It's API is somewhat quircky in use, but I
guess that is to blame to the lack of generic programming support in C.

Blog: http://attractivechaos.wordpress.com/
Lib: https://github.com/attractivechaos/klib/blob/master/khash.h
2011-10-31 14:47:39 +01:00
Yorhel
00bd015d79 Belated copyright year bump 2011-10-31 14:47:15 +01:00
Yorhel
53e3bcbd2b browser.c: Added [read-only] indication to title bar 2011-10-31 13:10:36 +01:00
Yorhel
260f138d3f util.c: Use KiB instead of kiB (bug #3399279) 2011-09-09 08:57:10 +02:00
Yorhel
76d242dafc doc: Added read-only flag to ncdc.1 2011-09-09 08:51:37 +02:00
Rodolfo Borges
57164c8ca6 read-only flag 2011-09-09 08:47:41 +02:00
Yorhel
46f0334111 ChangeLog update for the 1.7 release 2010-08-13 15:08:20 +02:00
Yorhel
3860ba217b Display size graph by default
This used to be the default before 1.5, but for some reason the default
changed in 1.5 and 1.6. Changing it back now, because the graph really
is useful, and there's still enough space for the filename even in
smaller terminals.
2010-08-13 11:38:27 +02:00
Yorhel
f71b09c5f7 Man page + TODO updates 2010-08-13 11:28:32 +02:00
Yorhel
9f7bc01f11 Fixed segfault when launched on a nonexistant directory
Forgot to check the return value of path_absolute() in path_real(),
path_absolute() would return an error when getcwd() fails.

Fixes bug #3012787.
2010-07-19 12:45:33 +02:00
Yorhel
4d188cb9a2 TODO + ChangeLog update 2010-07-19 12:43:03 +02:00
Yorhel
791612dc4d browser.c: Got rid of the 'line' format string
This solution is far cleaner. Thanks to Ben North for pointing me to the
*-width-specifier that has apparently been built into the printf-family
functions for, well, quite a while, it seems.
2010-07-18 18:58:22 +02:00
Yorhel
d942a0ebc6 Only create the line format once when drawing the browser window
The memory for this format is now statically allocated as well. I
was under the impression its size would depend on wincols, but this is
the format we're talking about, the string does not have to hold the
actual line contents. I must have been sleeping again...

Oh well, this is a slight performance improvement, although it doesn't
seem the be the cause of the browing slowness when running under
valgrind. (Obviously running ncdu with valgrind is supposed to be
slower, but the current performance is rather bad...)
2010-04-28 17:15:46 +02:00
Yorhel
f18bd86ab8 Got rid of segfault when the root dir only contains hidden files
Instead you now get the usual 'no items to display' message when hiding
hidden files in the root directory.
2010-04-28 15:48:57 +02:00
Yorhel
d7d782be1c Reset descending/ascending order when changing sort column
This changes the behaviour back to it was before the dirlist
abstraction, which is the behaviour I prefer.
2010-04-28 15:39:45 +02:00
Yorhel
6fa56c1b38 Store the name of the item in the dir struct itself
Rather than storing a pointer to another memory allocation in the
struct. This saves some memory and improves performance by significantly
decreasing the number of calls to [c|m]alloc() and free().
2010-04-28 15:32:47 +02:00
Yorhel
b7ccf78b90 More intuitive multi-page browsing
Here is the new multi-page listing functionality I promised in
5db9c2aea11052451c7e11bf8eef73393e4a072e.

It may look very easy, but getting this to work right wasn't,
unfortunately.
2010-04-28 13:32:30 +02:00
Yorhel
c68a229e09 Fixed buffer overflow when some directories can't be scanned
Also changed other occurences of the same situation to use the same
checking method (>= rather than a +1) for consistency.

Fixes bug #2981704.
2010-04-28 10:08:45 +02:00
Yorhel
79733f7d64 Determine which item to select after deletion in browser.c
Rather than the ugly hack in delete.c.
2010-04-27 17:58:17 +02:00
Yorhel
eed949d48d Changed directory listings to a doubly linked list
This significantly improves the performance when browsing large
directories. It is somewhat costly on the memory usage, though. :-(
2010-04-27 17:18:56 +02:00
Yorhel
c84e70b627 Properly fixed crash on browsing dirs with a small window size
I was overseeing a stupid mistake in
  a7b7841ac084b21afd85c85c896fe89c441d4062
Obviously, you need to check against wincols and not winrows...
2010-04-27 13:27:57 +02:00
Yorhel
cc15863fcc Updated ChangeLog with the changes on the git repo 2010-04-27 12:55:06 +02:00
Yorhel
f078cb6bc7 Properly free() the pattern in exclude_clear()
Fixes a tiny, insignificant memory leak.
2010-04-27 12:49:12 +02:00
Yorhel
a7b7841ac0 Fixed crash on browsing dirs with a small window size
Fixes bug #2991787
2010-04-27 12:41:01 +02:00
Yorhel
a35f998168 Don't select first item when browsing back using parent dir
The parent directory reference is the same for all directories, so we'll
have to make sure to reset its FF_BSEL flag when opening another
directory.
2010-04-27 12:27:24 +02:00
Yorhel
5db9c2aea1 Abstracted dir list handling from browser.c into dirlist.c
This optimizes a few actions (though not all), and makes the code easier
to understand and expand.

The behaviour of the browser has changed a bit with regards to
multi-page listings. Personally I don't like this change much, so I'd
probably fix that later on.
2010-03-07 11:10:00 +01:00
Yorhel
fe21608e98 Correctly update directory sizes upon removing a hard link 2010-03-03 14:40:56 +01:00
Yorhel
1cc0e5a50f Only count the size of each hard link once for each directory
The displayed directory sizes are now fully correct, although in its
current state it's not all that intuitive because:

  directory size != sum(size of all files and subdirectories)

This should probably be fixed later on by splitting the sizes into a
shared and non-shared part.

Also, the sizes displayed after a recalculation or deletion are
incorrect, I'll fix this later on.
2010-02-28 16:56:45 +01:00
Yorhel
82ec5b9fa8 Misc. minor fixes 2010-02-28 10:13:12 +01:00