]> git.ipfire.org Git - thirdparty/e2fsprogs.git/blobdiff - misc/lsattr.c
ext2fs: rename "s_overhead_blocks" to "s_overhead_clusters"
[thirdparty/e2fsprogs.git] / misc / lsattr.c
index e5e59690f493c7f2c5b7b119ae77d1f1ec865248..0d95437622752e39d294626964d336c6e5edbbeb 100644 (file)
@@ -43,8 +43,8 @@ extern char *optarg;
 #include "et/com_err.h"
 #include "e2p/e2p.h"
 
+#include "support/nls-enable.h"
 #include "../version.h"
-#include "nls-enable.h"
 
 #ifdef __GNUC__
 #define EXT2FS_ATTR(x) __attribute__(x)
@@ -60,6 +60,7 @@ static unsigned pf_options;
 static int recursive;
 static int verbose;
 static int generation_opt;
+static int project_opt;
 
 #ifdef _LFS64_LARGEFILE
 #define LSTAT          lstat64
@@ -71,7 +72,7 @@ static int generation_opt;
 
 static void usage(void)
 {
-       fprintf(stderr, _("Usage: %s [-RVadlv] [files...]\n"), program_name);
+       fprintf(stderr, _("Usage: %s [-RVadlpv] [files...]\n"), program_name);
        exit(1);
 }
 
@@ -79,12 +80,22 @@ static int list_attributes (const char * name)
 {
        unsigned long flags;
        unsigned long generation;
+       unsigned long project;
 
        if (fgetflags (name, &flags) == -1) {
                com_err (program_name, errno, _("While reading flags on %s"),
                         name);
                return -1;
        }
+       if (project_opt) {
+               if (fgetproject(name, &project) == -1) {
+                       com_err (program_name, errno,
+                                _("While reading project on %s"),
+                                name);
+                       return -1;
+               }
+               printf ("%5lu ", project);
+       }
        if (generation_opt) {
                if (fgetversion (name, &generation) == -1) {
                        com_err (program_name, errno,
@@ -92,7 +103,7 @@ static int list_attributes (const char * name)
                                 name);
                        return -1;
                }
-               printf ("%5lu ", generation);
+               printf ("%-10lu ", generation);
        }
        if (pf_options & PFOPT_LONG) {
                printf("%-28s ", name);
@@ -171,7 +182,7 @@ int main (int argc, char ** argv)
 #endif
        if (argc && *argv)
                program_name = *argv;
-       while ((c = getopt (argc, argv, "RVadlv")) != EOF)
+       while ((c = getopt (argc, argv, "RVadlvp")) != EOF)
                switch (c)
                {
                        case 'R':
@@ -192,6 +203,9 @@ int main (int argc, char ** argv)
                        case 'v':
                                generation_opt = 1;
                                break;
+                       case 'p':
+                               project_opt = 1;
+                               break;
                        default:
                                usage();
                }