summaryrefslogtreecommitdiffstats
path: root/toolbox
diff options
context:
space:
mode:
authorAndy McFadden <>2009-04-08 19:26:45 -0700
committerThe Android Open Source Project <initial-contribution@android.com>2009-04-08 19:26:45 -0700
commit33d50dc785b9985031f025802e4b0f3ee39d5743 (patch)
tree4914c5a92d64ea6eea44ac32126439b8032fd349 /toolbox
parent83eb023a09d2f5782bf9153d761cbdda4ce45b22 (diff)
parentb33d3415b6c63f7b22e0863a2ac594feab9171cf (diff)
downloadsystem_core-33d50dc785b9985031f025802e4b0f3ee39d5743.zip
system_core-33d50dc785b9985031f025802e4b0f3ee39d5743.tar.gz
system_core-33d50dc785b9985031f025802e4b0f3ee39d5743.tar.bz2
Merge branch 'readonly-p4-master'
Diffstat (limited to 'toolbox')
-rw-r--r--toolbox/ls.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/toolbox/ls.c b/toolbox/ls.c
index f609df2..087e4d5 100644
--- a/toolbox/ls.c
+++ b/toolbox/ls.c
@@ -15,9 +15,10 @@
#include <linux/kdev_t.h>
// bits for flags argument
-#define LIST_LONG (1 << 0)
-#define LIST_ALL (1 << 1)
-#define LIST_RECURSIVE (1 << 2)
+#define LIST_LONG (1 << 0)
+#define LIST_ALL (1 << 1)
+#define LIST_RECURSIVE (1 << 2)
+#define LIST_DIRECTORIES (1 << 3)
// fwd
static int listpath(const char *name, int flags);
@@ -238,7 +239,7 @@ static int listpath(const char *name, int flags)
return -1;
}
- if (S_ISDIR(s.st_mode)) {
+ if ((flags & LIST_DIRECTORIES) == 0 && S_ISDIR(s.st_mode)) {
if (flags & LIST_RECURSIVE)
printf("\n%s:\n", name);
return listdir(name, flags);
@@ -269,6 +270,8 @@ int ls_main(int argc, char **argv)
flags |= LIST_ALL;
} else if (!strcmp(argv[i], "-R")) {
flags |= LIST_RECURSIVE;
+ } else if (!strcmp(argv[i], "-d")) {
+ flags |= LIST_DIRECTORIES;
} else {
listed++;
if(listpath(argv[i], flags) != 0) {