Module Name:    src
Committed By:   christos
Date:           Tue Oct 11 15:27:12 UTC 2011

Modified Files:
        src/bin/sh: miscbltin.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/bin/sh/miscbltin.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/sh/miscbltin.c
diff -u src/bin/sh/miscbltin.c:1.39 src/bin/sh/miscbltin.c:1.40
--- src/bin/sh/miscbltin.c:1.39	Sat Jun 18 17:18:46 2011
+++ src/bin/sh/miscbltin.c	Tue Oct 11 11:27:11 2011
@@ -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 @@ umaskcmd(int argc, char **argv)
 
 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 @@ struct limits {
 
 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 @@ ulimitcmd(int argc, char **argv)
 			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

Reply via email to