Whamcloud - gitweb
git://git.whamcloud.com
/
tools
/
e2fsprogs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
e2fsck: clean up xattr checking code
[tools/e2fsprogs.git]
/
debugfs
/
ls.c
diff --git
a/debugfs/ls.c
b/debugfs/ls.c
index
c990a93
..
525f084
100644
(file)
--- a/
debugfs/ls.c
+++ b/
debugfs/ls.c
@@
-54,29
+54,20
@@
static int print_filename(FILE *f, struct ext2_dir_entry *dirent, int options)
if ((options & ENCRYPT_OPT) && !(options & RAW_OPT)) {
if (f)
return fprintf(f, "<encrypted (%d)>", len);
if ((options & ENCRYPT_OPT) && !(options & RAW_OPT)) {
if (f)
return fprintf(f, "<encrypted (%d)>", len);
- else {
- char tmp[1];
- return snprintf(tmp, sizeof(tmp),
- "<encrypted (%d)>", len);
- }
+ else
+ return snprintf(NULL, 0, "<encrypted (%d)>", len);
}
while (len--) {
ch = *cp++;
}
while (len--) {
ch = *cp++;
- if (ch
> 128
) {
+ if (ch
< 32 || ch >= 127 || ch == '\\'
) {
if (f)
if (f)
- fputs("M-", f);
- ch -= 128;
- retlen += 2;
- }
- if ((ch < 32) || (ch == 0x7f)) {
+ fprintf(f, "\\x%02x", ch);
+ retlen += 4;
+ } else {
if (f)
if (f)
- fputc('^', f);
- ch ^= 0x40; /* ^@, ^A, ^B; ^? for DEL */
+ fputc(ch, f);
retlen++;
}
retlen++;
}
- if (f)
- fputc(ch, f);
- retlen++;
}
return retlen;
}
}
return retlen;
}
@@
-122,12
+113,13
@@
static int list_dir_proc(ext2_ino_t dir EXT2FS_ATTR((unused)),
return 0;
} else
memset(&inode, 0, sizeof(struct ext2_inode));
return 0;
} else
memset(&inode, 0, sizeof(struct ext2_inode));
- fprintf(ls->f,"/%u/%06o/%d/%d/%*s/", ino, inode.i_mode,
- inode
.i_uid, inode.i_gid
, thislen, dirent->name);
+ fprintf(ls->f,"/%u/%06o/%d/%d/%
.
*s/", ino, inode.i_mode,
+ inode
_uid(inode), inode_gid(inode)
, thislen, dirent->name);
if (LINUX_S_ISDIR(inode.i_mode))
fprintf(ls->f, "/");
else
if (LINUX_S_ISDIR(inode.i_mode))
fprintf(ls->f, "/");
else
- fprintf(ls->f, "%lld/", EXT2_I_SIZE(&inode));
+ fprintf(ls->f, "%llu/",
+ (unsigned long long) EXT2_I_SIZE(&inode));
fprintf(ls->f, "\n");
} else if (options & LONG_OPT) {
if (ino) {
fprintf(ls->f, "\n");
} else if (options & LONG_OPT) {
if (ino) {
@@
-152,10
+144,8
@@
static int list_dir_proc(ext2_ino_t dir EXT2FS_ATTR((unused)),
fprintf(ls->f, "(%d) %5d %5d ",
ext2fs_dirent_file_type(dirent),
inode_uid(inode), inode_gid(inode));
fprintf(ls->f, "(%d) %5d %5d ",
ext2fs_dirent_file_type(dirent),
inode_uid(inode), inode_gid(inode));
- if (LINUX_S_ISDIR(inode.i_mode))
- fprintf(ls->f, "%5d", inode.i_size);
- else
- fprintf(ls->f, "%5llu", EXT2_I_SIZE(&inode));
+ fprintf(ls->f, "%5llu",
+ (unsigned long long) EXT2_I_SIZE(&inode));
fprintf(ls->f, " %s ", datestr);
print_filename(ls->f, dirent, options);
fputc('\n', ls->f);
fprintf(ls->f, " %s ", datestr);
print_filename(ls->f, dirent, options);
fputc('\n', ls->f);
@@
-189,7
+179,8
@@
static int list_dir_proc(ext2_ino_t dir EXT2FS_ATTR((unused)),
return 0;
}
return 0;
}
-void do_list_dir(int argc, char *argv[])
+void do_list_dir(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
+ void *infop EXT2FS_ATTR((unused)))
{
struct ext2_inode inode;
ext2_ino_t ino;
{
struct ext2_inode inode;
ext2_ino_t ino;
@@
-228,7
+219,7
@@
void do_list_dir(int argc, char *argv[])
if (argc > optind+1) {
print_usage:
if (argc > optind+1) {
print_usage:
- com_err(0, 0, "Usage: ls [-
l] [-d] [-p
] file");
+ com_err(0, 0, "Usage: ls [-
c] [-d] [-l] [-p] [-r
] file");
return;
}
return;
}