~csurbhi/ubuntu/maverick/e2fsprogs/e2fsprogs.fix-505719

« back to all changes in this revision

Viewing changes to debugfs/ls.c

  • Committer: Bazaar Package Importer
  • Author(s): Steve Langasek
  • Date: 2008-08-08 20:32:11 UTC
  • mfrom: (1.1.11 upstream)
  • Revision ID: james.westby@ubuntu.com-20080808203211-w72lpsd9q7o3bw6x
Tags: 1.41.0-3ubuntu1
* Merge from Debian unstable (LP: #254152, #246461), remaining changes:
  - Do not build-depend on dietlibc-dev, which is in universe.

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
 
31
31
#define LONG_OPT        0x0001
32
32
#define DELETED_OPT     0x0002
 
33
#define PARSE_OPT       0x0004
33
34
 
34
35
struct list_dir_struct {
35
36
        FILE    *f;
72
73
        } else {
73
74
                lbr = rbr = ' ';
74
75
        }
75
 
        if (ls->options & LONG_OPT) {
 
76
        if (ls->options & PARSE_OPT) {
 
77
                if (ino && debugfs_read_inode(ino, &inode, name)) return 0;
 
78
                fprintf(ls->f,"/%u/%06o/%d/%d/%s/",ino,inode.i_mode,inode.i_uid, inode.i_gid,name);
 
79
                if (LINUX_S_ISDIR(inode.i_mode))
 
80
                        fprintf(ls->f, "/");
 
81
                else
 
82
                        fprintf(ls->f, "%lld/", inode.i_size | ((__u64)inode.i_size_high << 32));
 
83
                fprintf(ls->f, "\n");
 
84
        }
 
85
        else if (ls->options & LONG_OPT) {
76
86
                if (ino) {
77
87
                        if (debugfs_read_inode(ino, &inode, name))
78
88
                                return 0;
123
133
                return;
124
134
 
125
135
        reset_getopt();
126
 
        while ((c = getopt (argc, argv, "dl")) != EOF) {
 
136
        while ((c = getopt (argc, argv, "dlp")) != EOF) {
127
137
                switch (c) {
128
138
                case 'l':
129
139
                        ls.options |= LONG_OPT;
131
141
                case 'd':
132
142
                        ls.options |= DELETED_OPT;
133
143
                        break;
 
144
                case 'p':
 
145
                        ls.options |= PARSE_OPT;
 
146
                        break;
134
147
                default:
135
148
                        goto print_usage;
136
149
                }
138
151
 
139
152
        if (argc > optind+1) {
140
153
        print_usage:
141
 
                com_err(0, 0, "Usage: ls [-l] [-d] file");
 
154
                com_err(0, 0, "Usage: ls [-l] [-d] [-p] file");
142
155
                return;
143
156
        }
144
157