1
1
Граф коммитов

231 Коммитов

Автор SHA1 Сообщение Дата
Yorhel
eba9a7f8ef Version bump + Changelog update for 1.9 2012-09-27 11:45:09 +02:00
Yorhel
5183e7633b Don't make ncdu.1 depend on Makefile
Makefile is generated by configure, and thus guaranteed to be newer than
ncdu.1, causing make to regenerate ncdu.1 regardless of whether pod2man
is installed or not. That kinda defeats the purpose of including ncdu.1
in the distribution.
2012-09-27 11:40:00 +02:00
Yorhel
31491d1e2c Add some examples to the man page 2012-09-08 18:23:39 +02:00
Yorhel
b1059cafc4 Update man page with new options 2012-09-08 17:30:29 +02:00
Yorhel
7feaeb1483 Abstracted option parsing from option handling
This also adds the possibility to combine short options that expect an
argument, e.g. "-xo <file>" or even "-xo<file>".
2012-09-08 14:38:15 +02:00
Yorhel
eeff908b0c dir_export.c: Add timestamp to meta-data 2012-09-07 09:37:20 +02:00
Yorhel
b6e4092ea7 cli: Use -0,-1,-2 instead of "-u n"
I've no idea for what other purpose I'd use numbered options. This is
much shorter, and can easily be combined with other options (e.g. -rx1).
2012-09-06 14:11:44 +02:00
Yorhel
c29f318128 Removed the TODO file
I have a bug tracker for that.
2012-09-06 13:20:52 +02:00
Yorhel
aad479a19a Disallow refresh/delete after import + provide visual feedback
It's kinda annoying how you need to confirm the messages. I'd prefer
having some status bar where messages are automatically removed after a
short timeout or something. But that's more work, and for the few
cases where feedback is necessary this'll work fine, too.
2012-09-06 13:16:54 +02:00
Yorhel
267de619ba dir_import.c: Only call input_handle() once every 32 read items
Some measurements importing a gzip-compressed file (zcat .. | ncdu -f -)
containing a bit under 6 million items and a few choices of how often to
call input_handle():

Called on every item:

  real    0m13.745s
  user    0m12.576s
  sys     0m4.566s

Called on every 8 items:

  real    0m7.932s
  user    0m9.636s
  sys     0m1.623s

Called on every 16 items:

  real    0m7.559s
  user    0m9.553s
  sys     0m1.323s

Called on every 32 items:

  real    0m7.279s
  user    0m9.353s
  sys     0m1.277s

Called on every 64 items:

  real    0m7.166s
  user    0m9.389s
  sys     0m1.117s

Called on every 256 items:

  real    0m7.073s
  user    0m9.439s
  sys     0m1.027s

32 seemed like a good compromise.
2012-09-06 12:49:20 +02:00
Yorhel
fdc614126a browser.c: Display [imported] indication in title 2012-09-06 12:32:41 +02:00
Yorhel
37f390d241 dir_import.c: Don't throw an error when user aborted import 2012-09-06 09:47:00 +02:00
Yorhel
7d2cb84e70 Display "Loading..." instead of "Scanning..." when importing a file 2012-09-06 09:45:52 +02:00
Yorhel
c298e32942 Check that stdin is a tty when initializing ncurses 2012-09-06 09:33:58 +02:00
Yorhel
38b2c8f012 dir_import.c: Various fixes
- errors in item() didn't propagate properly
- empty [] and {} values weren't allowed
- fractional numbers weren't allowed
- parsing of escaped characters didn't ensure that enough data was in
  the buffer
- E() didn't propagate errors properly in all cases

I'll do some more testing later on, but the current code seems to be
working quite well already.
2012-09-05 17:46:44 +02:00
Yorhel
e6eaec30ba dir_import.c: Put a limit on the recursion depth 2012-09-05 14:15:28 +02:00
Yorhel
10dca5503a Added -f option to import an exported directory structure
This is the first working version. There's a few TODO's left.
2012-09-05 13:52:12 +02:00
Yorhel
ef4abec6cf path.c: Don't throw away remaining components after a symlink
This is a quick hack to fix http://dev.yorhel.nl/ncdu/bug/18.
path_real() is both rather unreadable, fragile, hard to maintain and a
bit inefficient. It wouldn't be too surprising if I introduced a new bug
with this commit...

*makes a note to do a proper rewrite of that code later on*
2012-08-29 22:06:43 +02:00
Yorhel
f83ed07fcf Don't include "notreg" field for excluded/error'd files in export
+ some comment fixes.
2012-08-29 11:52:52 +02:00
Yorhel
968471f602 Omit "dev" field in export when same as parent dir + "excluded" fix 2012-08-29 11:43:10 +02:00
Yorhel
c4616ff186 Added simple error checking & handling when exporting 2012-08-29 10:27:12 +02:00
Yorhel
7ccb98006a Support exporting to stdout while still allowing -u 2 to work 2012-08-29 10:26:37 +02:00
Yorhel
9d341950ff dir_common.c: Don't display total size when it's not known
The total size isn't calculated when exporting to a file.
2012-08-29 09:23:32 +02:00
Yorhel
59a9c6b877 Added -o option to export dir structure to a JSON-encoded file
!WARNING! The export option is experimental, and the file format is not
final. I make no promise that a future version of ncdu will be able to
read the current format. There's also quite a few TODO's left.
2012-08-28 17:22:33 +02:00
Yorhel
f4fa1f299c configure: Removed a few useless checks
There's no need to check -lncursesw twice, for example.
2012-08-28 11:24:01 +02:00
Yorhel
2e1838d890 Get rid of padding in dir struct + use offsetof() to calc needed size
There used to be four bytes of padding in the struct on systems with
32bit pointers. Moving the pointers down so that they are in between the
64bit and 32bit fields means that there'll never be any padding.

There may, however, be some extra padding at the end of the struct to
make the size a multiple of 8. Since we use the name field as a sort of
"flexible array member", we don't particularly care about that padding
and just want to allocate enough memory to hold the struct and the name
field. offsetof() allows us to do that without relying on compiler
support for flexible array members.
2012-08-28 09:22:46 +02:00
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