Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b33d3415 authored by Andy McFadden's avatar Andy McFadden Committed by The Android Open Source Project
Browse files

AI 145220: Added "-d" flag to ls.

  Now you can "ls -l -d <directory>" to see directory perms.

Automated import of CL 145220
parent 89efdc9c
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@
#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) {