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

256 Коммитов

Автор SHA1 Сообщение Дата
Yorhel
cbe24d6c8f Exit ncdu when losing input
Ought to fix https://dev.yorhel.nl/ncdu/bug/115
2018-06-13 17:16:02 +02:00
Yorhel
d15fe8d08e Spelling fixes: "occured" + "an other"
https://dev.yorhel.nl/ncdu/bug/112
2018-03-29 17:32:48 +02:00
Yorhel
fa19095e26 Fix '--color off'
https://dev.yorhel.nl/ncdu/bug/111
2018-03-29 17:20:43 +02:00
Yorhel
14afd92ba2 Year + version bump for 1.13 2018-01-29 11:58:14 +01:00
Yorhel
7ba0f15f80 delete.c: Fix signedness issue in confirmation selection
'char' may be unsigned on some architectures, which will cause the
"overflow check" on decrement to fail.

This would at most result in a confusing UI issue where no confirmation
option appears to be selected.
2018-01-29 11:58:14 +01:00
Yorhel
0e26ea95ef dirlist.c: make sure to include stdlib.h for calloc() 2018-01-23 15:36:27 +01:00
Yorhel
3e6affa73d Display extended information in the info window
It's looking a bit cramped, but I'm lazy.
2018-01-23 14:59:46 +01:00
Yorhel
1165342dcf Don't depend on current color when creating ncurses window
Fixes a minor glitch where A_REVERSE would be set on the information
window if the last item in the dir is selected.
2018-01-23 14:20:10 +01:00
Yorhel
40b127591f Import/export extended information
And stick to the more portable second resolution timestamps for mtime.
2018-01-23 14:11:42 +01:00
Yorhel
47e969cdf3 Add -e flag to enable extended information mode
And document the --color flag that I forgot.
2018-01-23 13:45:16 +01:00
Yorhel
77aca35fce Add support for optional "extended" information for each file/dir entry
Unfortunately, there wasn't a single bit free in struct dir.flags, so I
had to increase its size to 16 bit. This commit is just the initial
preparation, there's still a few things to do:

- Add "extended information" cli flag to enable/disable this
  functionality.
- Export and import extended information when requested
- Do something with the data.

I also did a few memory measurements on a file list with 12769842 items:

  before this commit:    1.239 GiB
  without extended info: 1.318 GiB
  with extended info:    1.698 GiB

It's surprising what adding a single byte to a struct can do to the
memory usage. :(
2018-01-23 13:17:06 +01:00
Yorhel
7338454322 Remove recursion check when importing a file
Fixes https://dev.yorhel.nl/ncdu/bug/103

I don't think a stack overflow as a result of recursion is exploitable
on a modern system. It should just result in an unfortunate write to a
page that is not writable, followed by a crash.
2018-01-21 16:31:48 +01:00
Yorhel
f1112297ca Merge branch 'colors' 2018-01-21 15:42:16 +01:00
Yorhel
6c2ee0d6ab Add --color option, simple theme support, disable colors by default
I've decided not to use ls-like file name coloring for now, instead just
coloring the difference between a (regular) file and a dir.

Still looking for a good color scheme for light backgrounds.
2018-01-21 15:41:54 +01:00
Yorhel
a830f7dfa6 Use C99 flexible array member for struct dir
This should fix https://dev.yorhel.nl/ncdu/bug/99 - with the downside
that this requires a C99 compiler.

I also replaced all occurrences of static allocation of struct dir with
use dynamic allocation, because I wasn't really sure if static
allocation of flexible structs is allowed. In the case of dirlist.c the
dynamic allocation is likely required anyway, because it does store a
few bytes in the name field.
2017-08-17 17:04:48 +02:00
Yorhel
a369a43d94 Add support for colors and sprinkle some colors around
TODO:
- Add (ls-like) colors to the actual file names
  -> Implement full $LS_COLORS handling or something simple and custom?
- Test on a white/black terminal, and provide an alternate color scheme
  if necessary.
- Make colors opt-in?
2017-07-08 16:29:31 +02:00
Yorhel
3b55f8c137 dir_import.c: Restart fread() on EINTR
Fixes https://dev.yorhel.nl/ncdu/bug/95
2017-03-27 17:14:22 +02:00
Yorhel
936a9446a8 Add -rr option to disable shell spawning
Fixes https://dev.yorhel.nl/ncdu/bug/94
2017-01-06 18:35:30 +01:00
Yorhel
e4f211db68 Year + version bump for 1.12 2016-08-24 20:59:58 +02:00
Tillmann Karras
dcf08bd8bb Consistently print errors to stderr 2016-01-12 20:00:24 +01:00
piyo
cf9145a783 Confirm quit action during scan only when --confirm-quit 2015-09-23 15:44:32 +09:00
piyo
bfff5762e0 Confirm quit action during scan (reuse existing scan dialog). 2015-09-23 15:44:32 +09:00
Max Klinger
c035c3859c implement confirmation switch 2015-09-20 07:58:07 +02:00
Max Klinger
5aeb4f9b09 change wording when deleting empty directory 2015-09-20 07:54:43 +02:00
Yorhel
078369b8c5 quit.c: Remove two unused variables 2015-09-20 07:53:05 +02:00
piyo
e96cc36d56 Confirm quit action with a cancellable dialog. 2015-09-19 12:36:38 +09:00
Robin Schneider
682add5eae Added backspace key in browser window to back keys (one directory up). 2015-08-03 21:16:19 +02:00
Øyvind A. Holm
7be85679c5 Check for NCDU_SHELL environment variable when spawning shell
Check if the environment variable NCDU_SHELL is defined before the SHELL
variable is checked. This makes it possible to specify a program to
execute when 'b' is pressed. Setting SHELL to for example "mc" (Midnight
Commander) didn't work because mc already uses SHELL to execute
commands.
2015-06-02 04:06:09 +02:00
Yorhel
29f347c19c shell.c: Include sys/wait.h
Required for the W* macros on OpenBSD. Reported by Brian Callahan.
2015-04-07 10:39:46 +02:00
Yorhel
9e549b0319 Disable shell feature on imported file
Can cause too much confusion otherwise; The imported data may not at all
reflect the filesystem that ncdu has access to.
2015-04-05 10:03:32 +02:00
Yorhel
777db9a5df Minor fixes to new shell feature
The check for the system() exit status is slightly problematic, because
bash returns the status code of the last command it executed. I've set
it to only check for status code 127 now (command not found) in order to
at least provide a message when the $SHELL command can't be found. This
error can still be triggered when executing a nonexistant command within
the shell and then exiting.
2014-12-14 15:13:38 +01:00
Thomas Jarosch
a25e5f80a5 Add ability to spawn shell
Key 'b' in the browse window spawns a shell in the current directoy.

We first check the $SHELL environment variable of the user for the preferred
shell interpreter. If it's not set, we fall back to the compile time
configured default shell (usually /bin/bash).

Signed-off-by: Thomas Jarosch <thomas.jarosch@intra2net.com>
2014-12-14 09:16:27 +01:00
Yorhel
ce18bc392e "Press q to continue" -> "Press q to close"
As per http://dev.yorhel.nl/ncdu/bug/55
2014-08-03 15:15:39 +02:00
Yorhel
79213f0d63 Support building without locale.h
Slightly modified patch from Gianluigi Tiesi.
http://dev.yorhel.nl/ncdu/bug/47
2014-04-13 08:35:46 +02:00
Yorhel
efece12cfe Copyright year update 2014-01-22 15:28:20 +01:00
Yorhel
fe932c7b22 Add support for browsing empty directories
Turns out that being able to open an empty directory actually has its
uses:
- If you delete the last file in a directory, you now won't be directed
  to the parent directory anymore. This allows keeping 'd' pressed
  without worrying that you'll delete stuff outside of the current dir.
  (This is the primary motivation for doing this)
- You can now scan and later refresh an empty directory, as suggested by
  #2 in http://dev.yorhel.nl/ncdu/bug/15
2014-01-22 13:30:51 +01:00
Yorhel
3f29a46f3a Fix offset of parent-dir item 2014-01-22 12:44:51 +01:00
Thomas Klausner
34690e4b51 util.c: Make sure to include stdarg.h
Fixes build on NetBSD.
2013-08-23 13:52:39 +02:00
Yorhel
532c32c884 Add space between file size and unit suffix
As per http://dev.yorhel.nl/ncdu/bug/31
2013-07-23 10:38:37 +02:00
Yorhel
0e9e6d511a Add --si flag for base 10 prefixes
This is a slightly modified patch contributed at

  http://dev.yorhel.nl/ncdu/bug/35
2013-07-23 10:33:24 +02:00
Yorhel
30c0b2db00 browser.c: Fix "Toggle dirs before files when sorting" functionality
This has apparently been broken since version 1.7 (v1.6-7-g5db9c2a to be
precise), yet NOBODY TOLD ME!? :-(

The OSS community has left me in despair!
2013-06-05 16:56:46 +02:00
Yorhel
0a4ad63591 Fix a few compiler warnings
Most of which made sense.
2013-05-09 16:24:15 +02:00
Yorhel
09c444753a Move khash & yopt to deps/
Both microlibraries come from another source, and are not maintained as
part of ncdu. This separation of src/ and deps/ makes the relation more
clear.
2013-04-25 08:11:39 +02:00
Yorhel
bc8ccc959d dir_scan.c: Reset directory sizes when excluded by a CACHEDIR.TAG
Tiny bug fix: The size of an excluded directory entry itself should not
be counted, either. This is consistent with what you'd expect: A cache
directory with thousands of files can easily take up several megabytes
for the dir entry - but from the perspective of a backup system that
recognizes cache dirs - the dir is empty, and therefore shouldn't take
any extra space at all.
2013-04-12 19:43:29 +02:00
Yorhel
01f36e1beb Use /**/ comments + minor style change 2013-04-12 19:37:40 +02:00
Petr Pudlak
dc316e26f5 has_cachedir_tag: Keep statuc allocated buffer for paths. 2013-04-12 18:16:15 +02:00
Petr Pudlak
1b1982e9af Let has_cachedir_tag use malloc instead of a buffer on the stack. 2013-04-12 16:21:16 +02:00
Petr Pudlak
2784d82a9e CACHEDIR.TAG - improve code style and the name of the parameter.
Use a macro instead of the global constant `cachedir_tag_signature`.
Use `memcmp` instead of `strncmp`.
Add `has_cachedir_tag` to exclude.h.

(See http://dev.yorhel.nl/ncdu/bug/30)
2013-04-12 14:53:33 +02:00
Petr Pudlak
3def47c331 Add CACHEDIR.TAG support.
A new command line parameter allows to filter out directories containing
the proper `CACHEDIR.TAG` file.
See http://www.brynosaurus.com/cachedir/
2013-04-10 16:50:57 +02:00
Chris West (Faux)
c4f5f370ac use the locale's thousand seperator, if available 2013-01-13 12:42:28 +00:00