accidentally applied wrong (old) patch, fixing up...
[oweals/busybox.git] / e2fsprogs / e2fs_lib.c
index cdf97352a48856c0c9445f330e4455f6c996beda..ea5c8026cb2592f7c3201ca9be30323dafb58f12 100644 (file)
@@ -143,31 +143,31 @@ int fgetsetflags(const char *name, unsigned long *get_flags, unsigned long set_f
 /* Print file attributes on an ext2 file system */
 struct flags_name {
        unsigned long   flag;
-       const char      *short_name;
+       char            short_name;
        const char      *long_name;
 };
 
 static const struct flags_name flags_array[] = {
-       { EXT2_SECRM_FL, "s", "Secure_Deletion" },
-       { EXT2_UNRM_FL, "u" , "Undelete" },
-       { EXT2_SYNC_FL, "S", "Synchronous_Updates" },
-       { EXT2_DIRSYNC_FL, "D", "Synchronous_Directory_Updates" },
-       { EXT2_IMMUTABLE_FL, "i", "Immutable" },
-       { EXT2_APPEND_FL, "a", "Append_Only" },
-       { EXT2_NODUMP_FL, "d", "No_Dump" },
-       { EXT2_NOATIME_FL, "A", "No_Atime" },
-       { EXT2_COMPR_FL, "c", "Compression_Requested" },
+       { EXT2_SECRM_FL, 's', "Secure_Deletion" },
+       { EXT2_UNRM_FL, 'u' , "Undelete" },
+       { EXT2_SYNC_FL, 'S', "Synchronous_Updates" },
+       { EXT2_DIRSYNC_FL, 'D', "Synchronous_Directory_Updates" },
+       { EXT2_IMMUTABLE_FL, 'i', "Immutable" },
+       { EXT2_APPEND_FL, 'a', "Append_Only" },
+       { EXT2_NODUMP_FL, 'd', "No_Dump" },
+       { EXT2_NOATIME_FL, 'A', "No_Atime" },
+       { EXT2_COMPR_FL, 'c', "Compression_Requested" },
 #ifdef ENABLE_COMPRESSION
-       { EXT2_COMPRBLK_FL, "B", "Compressed_File" },
-       { EXT2_DIRTY_FL, "Z", "Compressed_Dirty_File" },
-       { EXT2_NOCOMPR_FL, "X", "Compression_Raw_Access" },
-       { EXT2_ECOMPR_FL, "E", "Compression_Error" },
+       { EXT2_COMPRBLK_FL, 'B', "Compressed_File" },
+       { EXT2_DIRTY_FL, 'Z', "Compressed_Dirty_File" },
+       { EXT2_NOCOMPR_FL, 'X', "Compression_Raw_Access" },
+       { EXT2_ECOMPR_FL, 'E', "Compression_Error" },
 #endif
-       { EXT3_JOURNAL_DATA_FL, "j", "Journaled_Data" },
-       { EXT2_INDEX_FL, "I", "Indexed_direcctory" },
-       { EXT2_NOTAIL_FL, "t", "No_Tailmerging" },
-       { EXT2_TOPDIR_FL, "T", "Top_of_Directory_Hierarchies" },
-       { 0, NULL, NULL }
+       { EXT3_JOURNAL_DATA_FL, 'j', "Journaled_Data" },
+       { EXT2_INDEX_FL, 'I', "Indexed_directory" },
+       { EXT2_NOTAIL_FL, 't', "No_Tailmerging" },
+       { EXT2_TOPDIR_FL, 'T', "Top_of_Directory_Hierarchies" },
+       { 0, '\0', NULL }
 };
 
 void print_flags(FILE *f, unsigned long flags, unsigned options)
@@ -176,7 +176,7 @@ void print_flags(FILE *f, unsigned long flags, unsigned options)
 
        if (options & PFOPT_LONG) {
                int first = 1;
-               for (fp = flags_array; fp->flag != 0; fp++) {
+               for (fp = flags_array; fp->short_name; fp++) {
                        if (flags & fp->flag) {
                                if (!first)
                                        fputs(", ", f);
@@ -187,11 +187,11 @@ void print_flags(FILE *f, unsigned long flags, unsigned options)
                if (first)
                        fputs("---", f);
        } else {
-               for (fp = flags_array; fp->flag != 0; fp++) {
-                       const char *p = "-";
+               for (fp = flags_array; fp->short_name; fp++) {
+                       char c = '-';
                        if (flags & fp->flag)
-                               p = fp->short_name;
-                       fputs(p, f);
+                               c = fp->short_name;
+                       fputc(c, f);
                }
        }
 }