summaryrefslogtreecommitdiffstats
path: root/misc-utils/namei.c
diff options
context:
space:
mode:
authorSami Kerola2013-11-20 01:57:04 +0100
committerKarel Zak2013-12-02 10:59:27 +0100
commitcd80445017fcc845eebed534782c6e7f13ef8480 (patch)
treea0e7eb7b22ca3a45b00eecf6e69ccbad7ad4eaf7 /misc-utils/namei.c
parentlosetup, agetty: remove unnecessary if's before free() (diff)
downloadkernel-qcow2-util-linux-cd80445017fcc845eebed534782c6e7f13ef8480.tar.gz
kernel-qcow2-util-linux-cd80445017fcc845eebed534782c6e7f13ef8480.tar.xz
kernel-qcow2-util-linux-cd80445017fcc845eebed534782c6e7f13ef8480.zip
namei: align missing files with rest of the print out
This change should make namei output more readable when multiple arguments are supplied. The old: $ namei -l /usr/foo f: /usr/foo drwxr-xr-x root root / drwxr-xr-x root root usr foo - No such file or directory The new: $ namei -l /usr/foo f: /usr/foo drwxr-xr-x root root / drwxr-xr-x root root usr foo - No such file or directory Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'misc-utils/namei.c')
-rw-r--r--misc-utils/namei.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/misc-utils/namei.c b/misc-utils/namei.c
index a9c83011f..1152ea764 100644
--- a/misc-utils/namei.c
+++ b/misc-utils/namei.c
@@ -367,6 +367,15 @@ print_namei(struct namei *nm, char *path)
char md[11];
if (nm->noent) {
+ int blanks = 1;
+ if (flags & NAMEI_MODES)
+ blanks += 9;
+ if (flags & NAMEI_OWNERS)
+ blanks += uwidth + gwidth + 2;
+ if (!(flags & NAMEI_VERTICAL))
+ blanks += 1;
+ blanks += nm->level * 2;
+ printf("%*s ", blanks, "");
printf(_("%s - No such file or directory\n"), nm->name);
return -1;
}