public inbox for util-linux@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/2] namei: align missing files with rest of the print out
       [not found] <1384909024-562-1-git-send-email-kerolasa@iki.fi>
@ 2013-11-20  0:57 ` Sami Kerola
  2013-12-02 10:11   ` Karel Zak
  2013-12-02 10:11 ` [PATCH 1/2] losetup, agetty: remove unnecessary if's before free() Karel Zak
  1 sibling, 1 reply; 3+ messages in thread
From: Sami Kerola @ 2013-11-20  0:57 UTC (permalink / raw)
  To: util-linux; +Cc: kerolasa

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>
---
 misc-utils/namei.c         | 9 +++++++++
 tests/expected/namei/logic | 2 +-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/misc-utils/namei.c b/misc-utils/namei.c
index a9c8301..1152ea7 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;
 		}
diff --git a/tests/expected/namei/logic b/tests/expected/namei/logic
index 9632db0..8e217d9 100644
--- a/tests/expected/namei/logic
+++ b/tests/expected/namei/logic
@@ -10,4 +10,4 @@ f: namei1/namei2/a/b
  d namei1
  d namei2
  - a
-b - No such file or directory
+   b - No such file or directory
-- 
1.8.4.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] losetup, agetty: remove unnecessary if's before free()
       [not found] <1384909024-562-1-git-send-email-kerolasa@iki.fi>
  2013-11-20  0:57 ` [PATCH 2/2] namei: align missing files with rest of the print out Sami Kerola
@ 2013-12-02 10:11 ` Karel Zak
  1 sibling, 0 replies; 3+ messages in thread
From: Karel Zak @ 2013-12-02 10:11 UTC (permalink / raw)
  To: Sami Kerola; +Cc: util-linux

On Wed, Nov 20, 2013 at 12:57:03AM +0000, Sami Kerola wrote:
>  sys-utils/losetup.c | 6 ++----
>  term-utils/agetty.c | 6 ++----
>  2 files changed, 4 insertions(+), 8 deletions(-)

 Applied, thanks.

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 2/2] namei: align missing files with rest of the print out
  2013-11-20  0:57 ` [PATCH 2/2] namei: align missing files with rest of the print out Sami Kerola
@ 2013-12-02 10:11   ` Karel Zak
  0 siblings, 0 replies; 3+ messages in thread
From: Karel Zak @ 2013-12-02 10:11 UTC (permalink / raw)
  To: Sami Kerola; +Cc: util-linux

On Wed, Nov 20, 2013 at 12:57:04AM +0000, Sami Kerola wrote:
>  misc-utils/namei.c         | 9 +++++++++
>  tests/expected/namei/logic | 2 +-
>  2 files changed, 10 insertions(+), 1 deletion(-)

 Applied, thanks.

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-12-02 10:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1384909024-562-1-git-send-email-kerolasa@iki.fi>
2013-11-20  0:57 ` [PATCH 2/2] namei: align missing files with rest of the print out Sami Kerola
2013-12-02 10:11   ` Karel Zak
2013-12-02 10:11 ` [PATCH 1/2] losetup, agetty: remove unnecessary if's before free() Karel Zak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox