aboutsummaryrefslogtreecommitdiff
path: root/e2fsprogs/lsattr.c
diff options
context:
space:
mode:
Diffstat (limited to 'e2fsprogs/lsattr.c')
-rw-r--r--e2fsprogs/lsattr.c32
1 files changed, 21 insertions, 11 deletions
diff --git a/e2fsprogs/lsattr.c b/e2fsprogs/lsattr.c
index 91205ff65..9b035f584 100644
--- a/e2fsprogs/lsattr.c
+++ b/e2fsprogs/lsattr.c
@@ -21,38 +21,48 @@
21//kbuild:lib-$(CONFIG_LSATTR) += lsattr.o e2fs_lib.o 21//kbuild:lib-$(CONFIG_LSATTR) += lsattr.o e2fs_lib.o
22 22
23//usage:#define lsattr_trivial_usage 23//usage:#define lsattr_trivial_usage
24//usage: "[-Radlv] [FILE]..." 24//usage: "[-Radlpv] [FILE]..."
25//usage:#define lsattr_full_usage "\n\n" 25//usage:#define lsattr_full_usage "\n\n"
26//usage: "List ext2 file attributes\n" 26//usage: "List ext2 file attributes\n"
27//usage: "\n -R Recurse" 27//usage: "\n -R Recurse"
28//usage: "\n -a Don't hide entries starting with ." 28//usage: "\n -a Include names starting with ."
29//usage: "\n -d List directory entries instead of contents" 29//usage: "\n -d List directory names, not contents"
30// -a,-d text should match ls --help
30//usage: "\n -l List long flag names" 31//usage: "\n -l List long flag names"
32//usage: "\n -p List project ID"
31//usage: "\n -v List version/generation number" 33//usage: "\n -v List version/generation number"
32 34
33#include "libbb.h" 35#include "libbb.h"
34#include "e2fs_lib.h" 36#include "e2fs_lib.h"
35 37
36enum { 38enum {
37 OPT_RECUR = 0x1, 39 OPT_RECUR = 1 << 0,
38 OPT_ALL = 0x2, 40 OPT_ALL = 1 << 1,
39 OPT_DIRS_OPT = 0x4, 41 OPT_DIRS_OPT = 1 << 2,
40 OPT_PF_LONG = 0x8, 42 OPT_PF_LONG = 1 << 3,
41 OPT_GENERATION = 0x10, 43 OPT_GENERATION = 1 << 4,
44 OPT_PROJID = 1 << 5,
42}; 45};
43 46
44static void list_attributes(const char *name) 47static void list_attributes(const char *name)
45{ 48{
46 unsigned long fsflags; 49 unsigned long fsflags;
47 unsigned long generation;
48 50
49 if (fgetflags(name, &fsflags) != 0) 51 if (fgetflags(name, &fsflags) != 0)
50 goto read_err; 52 goto read_err;
51 53
54 if (option_mask32 & OPT_PROJID) {
55 uint32_t p;
56 if (fgetprojid(name, &p) != 0)
57 goto read_err;
58 printf("%5lu ", (unsigned long)p);
59 }
60
52 if (option_mask32 & OPT_GENERATION) { 61 if (option_mask32 & OPT_GENERATION) {
62 unsigned long generation;
53 if (fgetversion(name, &generation) != 0) 63 if (fgetversion(name, &generation) != 0)
54 goto read_err; 64 goto read_err;
55 printf("%5lu ", generation); 65 printf("%-10lu ", generation);
56 } 66 }
57 67
58 if (option_mask32 & OPT_PF_LONG) { 68 if (option_mask32 & OPT_PF_LONG) {
@@ -111,7 +121,7 @@ static void lsattr_args(const char *name)
111int lsattr_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 121int lsattr_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
112int lsattr_main(int argc UNUSED_PARAM, char **argv) 122int lsattr_main(int argc UNUSED_PARAM, char **argv)
113{ 123{
114 getopt32(argv, "Radlv"); 124 getopt32(argv, "Radlvp");
115 argv += optind; 125 argv += optind;
116 126
117 if (!*argv) 127 if (!*argv)