summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2020-06-07 10:01:31 +0200
committerYorhel <git@yorhel.nl>2020-06-07 10:03:11 +0200
commita389443c9a1f3b2b68fe9b9fccef1f0b6569b632 (patch)
treeb0f56b045ff053cd7f6df410e34cbe1c7dad9470 /src
parentc340980b80b9ef0c957fe832e93e5ef430b216ac (diff)
Add --exclude-firmlinks and follow firmlinks by default
What a mess. https://code.blicky.net/yorhel/ncdu/issues/153#issuecomment-764
Diffstat (limited to 'src')
-rw-r--r--src/main.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/main.c b/src/main.c
index 44da3d1..6e85c52 100644
--- a/src/main.c
+++ b/src/main.c
@@ -42,7 +42,7 @@ long update_delay = 100;
int cachedir_tags = 0;
int extended_info = 0;
int follow_symlinks = 0;
-int follow_firmlinks = 0;
+int follow_firmlinks = 1;
int confirm_quit = 0;
static int min_rows = 17, min_cols = 60;
@@ -139,7 +139,8 @@ static void argv_parse(int argc, char **argv) {
{ 'L', 0, "-L,--follow-symlinks" },
{ 'C', 0, "--exclude-caches" },
{ 2, 0, "--exclude-kernfs" },
- { 3, 0, "--follow-firmlinks" },
+ { 3, 0, "--follow-firmlinks" }, /* undocumented, this behavior is the current default */
+ { 4, 0, "--exclude-firmlinks" },
{ 's', 0, "--si" },
{ 'Q', 0, "--confirm-quit" },
{ 'c', 1, "--color" },
@@ -173,7 +174,7 @@ static void argv_parse(int argc, char **argv) {
printf(" --exclude-kernfs Exclude Linux pseudo filesystems (procfs,sysfs,cgroup,...)\n");
#endif
#if HAVE_SYS_ATTR_H && HAVE_GETATTRLIST && HAVE_DECL_ATTR_CMNEXT_NOFIRMLINKPATH
- printf(" --follow-firmlinks Follow firmlinks on macOS\n");
+ printf(" --exclude-firmlinks Exclude firmlinks on macOS\n");
#endif
printf(" --confirm-quit Confirm quitting ncdu\n");
printf(" --color SCHEME Set color scheme (off/dark)\n");
@@ -204,20 +205,27 @@ static void argv_parse(int argc, char **argv) {
cachedir_tags = 1;
break;
- case 2 :
+ case 2 : /* --exclude-kernfs */
#if HAVE_LINUX_MAGIC_H && HAVE_SYS_STATFS_H && HAVE_STATFS
exclude_kernfs = 1; break;
#else
fprintf(stderr, "This feature is not supported on your platform\n");
exit(1);
#endif
- case 3 :
+ case 3 : /* --follow-firmlinks */
#if HAVE_SYS_ATTR_H && HAVE_GETATTRLIST && HAVE_DECL_ATTR_CMNEXT_NOFIRMLINKPATH
follow_firmlinks = 1; break;
#else
fprintf(stderr, "This feature is not supported on your platform\n");
exit(1);
#endif
+ case 4 : /* --exclude-firmlinks */
+#if HAVE_SYS_ATTR_H && HAVE_GETATTRLIST && HAVE_DECL_ATTR_CMNEXT_NOFIRMLINKPATH
+ follow_firmlinks = 0; break;
+#else
+ fprintf(stderr, "This feature is not supported on your platform\n");
+ exit(1);
+#endif
case 'c':
if(strcmp(val, "off") == 0) { uic_theme = 0; }
else if(strcmp(val, "dark") == 0) { uic_theme = 1; }