aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/jls
diff options
context:
space:
mode:
authorJamie Gritton <jamie@FreeBSD.org>2009-07-08 15:57:22 +0000
committerJamie Gritton <jamie@FreeBSD.org>2009-07-08 15:57:22 +0000
commit4d4d88790712018b7af49920e73a48bdda80df3e (patch)
tree6282baf43ab408cff47975b59fc634dce786f805 /usr.sbin/jls
parentf9bc4dcb56b88064e9269a6f63d89a226e97dae4 (diff)
downloadsrc-4d4d88790712018b7af49920e73a48bdda80df3e.tar.gz
src-4d4d88790712018b7af49920e73a48bdda80df3e.zip
Notes
Diffstat (limited to 'usr.sbin/jls')
-rw-r--r--usr.sbin/jls/jls.815
-rw-r--r--usr.sbin/jls/jls.c14
2 files changed, 18 insertions, 11 deletions
diff --git a/usr.sbin/jls/jls.8 b/usr.sbin/jls/jls.8
index c0eed8df9454..2107405f710d 100644
--- a/usr.sbin/jls/jls.8
+++ b/usr.sbin/jls/jls.8
@@ -25,7 +25,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd May 27, 2009
+.Dd July 8, 2009
.Dt JLS 8
.Os
.Sh NAME
@@ -54,6 +54,8 @@ for a description of some core parameters.
.Pp
If no
.Ar parameters
+or any of the options
+.Fl hns
are given, the following four columns will be printed:
jail identifier (jid), IP address (ip4.addr), hostname (host.hostname),
and path (path).
@@ -66,17 +68,20 @@ List
as well as active jails.
.It Fl h
Print a header line containing the parameters listed.
-If no parameters are given on the command line, the default output always
-contains a header.
+If no parameters are given on the command line,
+.Va all
+is assumed.
.It Fl n
Print parameters in
.Dq name=value
format, where each parameter is preceded by its name.
-This option is ignored for the default four-column output.
+If no parameters are given on the command line,
+.Va all
+is assumed.
.It Fl q
Put quotes around parameters if they contain spaces or quotes, or are
the empty string.
-.It Fl c
+.It Fl s
Print parameters suitable for passing to
.Xr jail 8 ,
skipping read-only and unused parameters.
diff --git a/usr.sbin/jls/jls.c b/usr.sbin/jls/jls.c
index 443eb8e8ea35..40019f119350 100644
--- a/usr.sbin/jls/jls.c
+++ b/usr.sbin/jls/jls.c
@@ -88,7 +88,8 @@ main(int argc, char **argv)
jname = optarg;
break;
case 'h':
- pflags = (pflags & ~PRINT_SKIP) | PRINT_HEADER;
+ pflags = (pflags & ~(PRINT_SKIP | PRINT_VERBOSE)) |
+ PRINT_HEADER;
break;
case 'n':
pflags = (pflags & ~PRINT_VERBOSE) | PRINT_NAMEVAL;
@@ -101,7 +102,8 @@ main(int argc, char **argv)
PRINT_NAMEVAL | PRINT_QUOTED | PRINT_SKIP;
break;
case 'v':
- pflags = (pflags & ~(PRINT_NAMEVAL | PRINT_SKIP)) |
+ pflags = (pflags &
+ ~(PRINT_HEADER | PRINT_NAMEVAL | PRINT_SKIP)) |
PRINT_VERBOSE;
break;
default:
@@ -110,7 +112,9 @@ main(int argc, char **argv)
/* Add the parameters to print. */
if (optind == argc) {
- if (pflags & PRINT_VERBOSE) {
+ if (pflags & (PRINT_HEADER | PRINT_NAMEVAL))
+ add_param("all", NULL, (size_t)0, NULL, JP_USER);
+ else if (pflags & PRINT_VERBOSE) {
add_param("jid", NULL, (size_t)0, NULL, JP_USER);
add_param("host.hostname", NULL, (size_t)0, NULL,
JP_USER);
@@ -122,9 +126,7 @@ main(int argc, char **argv)
add_param("ip6.addr", NULL, (size_t)0, NULL,
JP_USER | JP_OPT);
} else {
- pflags = (pflags &
- ~(PRINT_NAMEVAL | PRINT_SKIP | PRINT_VERBOSE)) |
- PRINT_DEFAULT;
+ pflags |= PRINT_DEFAULT;
add_param("jid", NULL, (size_t)0, NULL, JP_USER);
add_param("ip4.addr", NULL, (size_t)0, NULL, JP_USER);
add_param("host.hostname", NULL, (size_t)0, NULL,