Whamcloud - gitweb
Remove support for EVMS 1.x plugin library.
[tools/e2fsprogs.git] / debugfs / ls.c
index 96d2691..72874eb 100644 (file)
@@ -21,9 +21,6 @@
 extern int optind;
 extern char *optarg;
 #endif
-#ifdef HAVE_OPTRESET
-extern int optreset;           /* defined by BSD, but not others */
-#endif
 
 #include "debugfs.h"
 
@@ -43,15 +40,14 @@ struct list_dir_struct {
 static const char *monstr[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun",
                                "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
                                        
-static int list_dir_proc(ext2_ino_t dir,
+static int list_dir_proc(ext2_ino_t dir EXT2FS_ATTR((unused)),
                         int    entry,
                         struct ext2_dir_entry *dirent,
-                        int    offset,
-                        int    blocksize,
-                        char   *buf,
+                        int    offset EXT2FS_ATTR((unused)),
+                        int    blocksize EXT2FS_ATTR((unused)),
+                        char   *buf EXT2FS_ATTR((unused)),
                         void   *private)
 {
-       struct ext2_dir_entry_2 *d2;
        struct ext2_inode       inode;
        ext2_ino_t              ino;
        struct tm               *tm_p;
@@ -90,9 +86,9 @@ static int list_dir_proc(ext2_ino_t dir,
                        strcpy(datestr, "                 ");
                        memset(&inode, 0, sizeof(struct ext2_inode));
                }
-               d2 = (struct dir_entry_2 *) dirent;
                fprintf(ls->f, "%c%6u%c %6o (%d)  %5d  %5d   ", lbr, ino, rbr,
-                       inode.i_mode, d2->file_type, inode.i_uid, inode.i_gid);
+                       inode.i_mode, dirent->name_len >> 8,
+                       inode.i_uid, inode.i_gid);
                if (LINUX_S_ISDIR(inode.i_mode))
                        fprintf(ls->f, "%5d", inode.i_size);
                else
@@ -126,10 +122,7 @@ void do_list_dir(int argc, char *argv[])
        if (check_fs_open(argv[0]))
                return;
 
-       optind = 0;
-#ifdef HAVE_OPTRESET
-       optreset = 1;           /* Makes BSD getopt happy */
-#endif
+       reset_getopt();
        while ((c = getopt (argc, argv, "dl")) != EOF) {
                switch (c) {
                case 'l':