]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
ipcs: make --human really sexy
authorKarel Zak <kzak@redhat.com>
Wed, 19 Dec 2012 14:27:12 +0000 (15:27 +0100)
committerKarel Zak <kzak@redhat.com>
Wed, 19 Dec 2012 14:27:12 +0000 (15:27 +0100)
Align the "size" columns to the right.

Signed-off-by: Karel Zak <kzak@redhat.com>
sys-utils/ipcs.c

index d611354c74a702c11cd7b1e38f2d17a6cfc6adb6..4aecc4134e1f68ff67720e6d86469087ce2bf9ae 100644 (file)
@@ -313,7 +313,12 @@ static void do_shm (char format, int unit)
                        else
                                printf ("%-10d %-10u", shmdsp->shm_perm.id, shmdsp->shm_perm.uid);
                        printf (" %-10o ", shmdsp->shm_perm.mode & 0777);
-                       ipc_print_size(unit, NULL, shmdsp->shm_segsz, NULL, -10);
+
+                       if (unit == IPC_UNIT_HUMAN)
+                               ipc_print_size(unit, NULL, shmdsp->shm_segsz, "    ", 6);
+                       else
+                               ipc_print_size(unit, NULL, shmdsp->shm_segsz, NULL, -10);
+
                        printf (" %-10ld %-6s %-6s\n",
                                shmdsp->shm_nattch,
                                shmdsp->shm_perm.mode & SHM_DEST ? _("dest") : " ",
@@ -530,7 +535,12 @@ static void do_msg (char format, int unit)
                        else
                                printf ("%-10d %-10u", msgdsp->msg_perm.id, msgdsp->msg_perm.uid);
                        printf (" %-10o ", msgdsp->msg_perm.mode & 0777);
-                       ipc_print_size(unit, NULL, msgdsp->q_cbytes, NULL, -12);
+
+                       if (unit == IPC_UNIT_HUMAN)
+                               ipc_print_size(unit, NULL, msgdsp->q_cbytes, "      ", 6);
+                       else
+                               ipc_print_size(unit, NULL, msgdsp->q_cbytes, NULL, -12);
+
                        printf (" %-12ld\n", msgdsp->q_qnum);
                        break;
                }