Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/bin/sh print the flag too next to the units like bash does.



details:   https://anonhg.NetBSD.org/src/rev/c84ca5e797d9
branches:  trunk
changeset: 770296:c84ca5e797d9
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Oct 11 15:27:11 2011 +0000

description:
print the flag too next to the units like bash does.

diffstat:

 bin/sh/miscbltin.c |  34 ++++++++++++++++++----------------
 1 files changed, 18 insertions(+), 16 deletions(-)

diffs (92 lines):

diff -r 44c2793d2e66 -r c84ca5e797d9 bin/sh/miscbltin.c
--- a/bin/sh/miscbltin.c        Tue Oct 11 15:19:09 2011 +0000
+++ b/bin/sh/miscbltin.c        Tue Oct 11 15:27:11 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: miscbltin.c,v 1.39 2011/06/18 21:18:46 christos Exp $  */
+/*     $NetBSD: miscbltin.c,v 1.40 2011/10/11 15:27:11 christos Exp $  */
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)miscbltin.c        8.4 (Berkeley) 5/4/95";
 #else
-__RCSID("$NetBSD: miscbltin.c,v 1.39 2011/06/18 21:18:46 christos Exp $");
+__RCSID("$NetBSD: miscbltin.c,v 1.40 2011/10/11 15:27:11 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -302,6 +302,7 @@
 
 struct limits {
        const char *name;
+       const char *unit;
        int     cmd;
        int     factor; /* multiply by to get rlim_{cur,max} values */
        char    option;
@@ -309,42 +310,42 @@
 
 static const struct limits limits[] = {
 #ifdef RLIMIT_CPU
-       { "time(seconds)",              RLIMIT_CPU,        1, 't' },
+       { "time",       "seconds",      RLIMIT_CPU,        1, 't' },
 #endif
 #ifdef RLIMIT_FSIZE
-       { "file(blocks)",               RLIMIT_FSIZE,    512, 'f' },
+       { "file",       "blocks",       RLIMIT_FSIZE,    512, 'f' },
 #endif
 #ifdef RLIMIT_DATA
-       { "data(kbytes)",               RLIMIT_DATA,    1024, 'd' },
+       { "data",       "kbytes",       RLIMIT_DATA,    1024, 'd' },
 #endif
 #ifdef RLIMIT_STACK
-       { "stack(kbytes)",              RLIMIT_STACK,   1024, 's' },
+       { "stack",      "kbytes",       RLIMIT_STACK,   1024, 's' },
 #endif
 #ifdef  RLIMIT_CORE
-       { "coredump(blocks)",           RLIMIT_CORE,     512, 'c' },
+       { "coredump",   "blocks",       RLIMIT_CORE,     512, 'c' },
 #endif
 #ifdef RLIMIT_RSS
-       { "memory(kbytes)",             RLIMIT_RSS,     1024, 'm' },
+       { "memory",     "kbytes",       RLIMIT_RSS,     1024, 'm' },
 #endif
 #ifdef RLIMIT_MEMLOCK
-       { "locked memory(kbytes)",      RLIMIT_MEMLOCK, 1024, 'l' },
+       { "locked memory","kbytes",     RLIMIT_MEMLOCK, 1024, 'l' },
 #endif
 #ifdef RLIMIT_NPROC
-       { "process(processes)",         RLIMIT_NPROC,      1, 'p' },
+       { "process",    "processes",    RLIMIT_NPROC,      1, 'p' },
 #endif
 #ifdef RLIMIT_NOFILE
-       { "nofiles(descriptors)",       RLIMIT_NOFILE,     1, 'n' },
+       { "nofiles",    "descriptors",  RLIMIT_NOFILE,     1, 'n' },
 #endif
 #ifdef RLIMIT_VMEM
-       { "vmemory(kbytes)",            RLIMIT_VMEM,    1024, 'v' },
+       { "vmemory",    "kbytes",       RLIMIT_VMEM,    1024, 'v' },
 #endif
 #ifdef RLIMIT_SWAP
-       { "swap(kbytes)",               RLIMIT_SWAP,    1024, 'w' },
+       { "swap",       "kbytes",       RLIMIT_SWAP,    1024, 'w' },
 #endif
 #ifdef RLIMIT_SBSIZE
-       { "sbsize(bytes)",              RLIMIT_SBSIZE,     1, 'b' },
+       { "sbsize",     "bytes",        RLIMIT_SBSIZE,     1, 'b' },
 #endif
-       { (char *) 0,                   0,                 0,  '\0' }
+       { NULL,         NULL,           0,                 0,  '\0' }
 };
 
 int
@@ -406,7 +407,8 @@
                        else if (how & HARD)
                                val = limit.rlim_max;
 
-                       out1fmt("%-20s ", l->name);
+                       out1fmt("%-13s (-%c %-11s) ", l->name, l->option,
+                           l->unit);
                        if (val == RLIM_INFINITY)
                                out1fmt("unlimited\n");
                        else



Home | Main Index | Thread Index | Old Index