diff options
author | Aki <please@ignore.pl> | 2022-06-15 18:04:45 +0200 |
---|---|---|
committer | Aki <please@ignore.pl> | 2022-06-15 18:04:45 +0200 |
commit | 59506e56f3c1a1d95e0d465cb43d466c5e7ba49e (patch) | |
tree | 69055c0ba1b698210bb28f9dc3c37655433af8e5 | |
parent | b810fa6ab1d9d3fd7f6ac0b56a1e0e83a5c33b02 (diff) | |
download | coreutils-59506e56f3c1a1d95e0d465cb43d466c5e7ba49e.zip coreutils-59506e56f3c1a1d95e0d465cb43d466c5e7ba49e.tar.gz coreutils-59506e56f3c1a1d95e0d465cb43d466c5e7ba49e.tar.bz2 |
Tweaked parent directory condition
-rw-r--r-- | ls.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -30,7 +30,7 @@ int ls(const char * path, struct options opts) if (opts.skip_dots && is_dot) continue; const unsigned int is_self = is_dot && 0 == entry->d_name[1]; - const unsigned int is_up = is_dot && '.' == entry->d_name[1]; + const unsigned int is_up = is_dot && '.' == entry->d_name[1] && 0 == entry->d_name[2]; if (opts.skip_self_and_up && (is_self || is_up)) continue; printf("%s\n", entry->d_name); @@ -60,7 +60,7 @@ int main(int argc, char * argv[]) int res = 0; if (optind >= argc) res |= ls(".", opts); - for (int i = optind; i < argc; ++i) + else for (int i = optind; i < argc; ++i) res |= ls(argv[i], opts); return res; } |