From c2589d1319a6171334739fb4b10ddc8317ec486b Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Sun, 8 Sep 2013 08:32:13 -0700 Subject: [PATCH] =?utf8?q?3357=20Desire=20-Q=20to=20make=20zlogin=20"quiet?= =?utf8?q?er"=20Reviewed=20by:=20David=20H=C3=B6ppner=20<0xffea@gmail.com>?= =?utf8?q?=20Reviewed=20by:=20Andy=20Stormont=20=20Approved=20by:=20Dan=20McDonald=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- usr/src/cmd/zlogin/zlogin.c | 33 ++++++++++++++++++++++----------- usr/src/man/man1/zlogin.1 | 33 +++++++++++++++++++++++++++------ 2 files changed, 49 insertions(+), 17 deletions(-) diff --git a/usr/src/cmd/zlogin/zlogin.c b/usr/src/cmd/zlogin/zlogin.c index abb817117e..838ecf638b 100644 --- a/usr/src/cmd/zlogin/zlogin.c +++ b/usr/src/cmd/zlogin/zlogin.c @@ -20,6 +20,7 @@ */ /* * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright 2013 DEY Storage Systems, Inc. */ /* @@ -101,6 +102,7 @@ static priv_set_t *dropprivs; static int nocmdchar = 0; static int failsafe = 0; static char cmdchar = '~'; +static int quiet = 0; static int pollerr = 0; @@ -147,7 +149,7 @@ static boolean_t forced_login = B_FALSE; static void usage(void) { - (void) fprintf(stderr, gettext("usage: %s [ -CES ] [ -e cmdchar ] " + (void) fprintf(stderr, gettext("usage: %s [ -QCES ] [ -e cmdchar ] " "[-l user] zonename [command [args ...] ]\n"), pname); exit(2); } @@ -1749,7 +1751,7 @@ main(int argc, char **argv) (void) getpname(argv[0]); username = get_username(); - while ((arg = getopt(argc, argv, "ECR:Se:l:")) != EOF) { + while ((arg = getopt(argc, argv, "ECR:Se:l:Q")) != EOF) { switch (arg) { case 'C': console = 1; @@ -1769,6 +1771,9 @@ main(int argc, char **argv) } zonecfg_set_root(optarg); break; + case 'Q': + quiet = 1; + break; case 'S': failsafe = 1; break; @@ -1923,8 +1928,10 @@ main(int argc, char **argv) if (get_console_master(zonename) == -1) return (1); - (void) printf(gettext("[Connected to zone '%s' console]\n"), - zonename); + if (!quiet) + (void) printf( + gettext("[Connected to zone '%s' console]\n"), + zonename); if (set_tty_rawmode(STDIN_FILENO) == -1) { reset_tty(); @@ -1940,8 +1947,10 @@ main(int argc, char **argv) */ doio(masterfd, -1, masterfd, -1, -1, B_FALSE); reset_tty(); - (void) printf(gettext("\n[Connection to zone '%s' console " - "closed]\n"), zonename); + if (!quiet) + (void) printf( + gettext("\n[Connection to zone '%s' console " + "closed]\n"), zonename); return (0); } @@ -2068,8 +2077,9 @@ main(int argc, char **argv) (void) strlcpy(slaveshortname, slavename, sizeof (slaveshortname)); - (void) printf(gettext("[Connected to zone '%s' %s]\n"), zonename, - slaveshortname); + if (!quiet) + (void) printf(gettext("[Connected to zone '%s' %s]\n"), + zonename, slaveshortname); if (set_tty_rawmode(STDIN_FILENO) == -1) { reset_tty(); @@ -2214,9 +2224,10 @@ main(int argc, char **argv) doio(masterfd, -1, masterfd, -1, -1, B_FALSE); reset_tty(); - (void) fprintf(stderr, - gettext("\n[Connection to zone '%s' %s closed]\n"), zonename, - slaveshortname); + if (!quiet) + (void) fprintf(stderr, + gettext("\n[Connection to zone '%s' %s closed]\n"), + zonename, slaveshortname); if (pollerr != 0) { (void) fprintf(stderr, gettext("Error: connection closed due " diff --git a/usr/src/man/man1/zlogin.1 b/usr/src/man/man1/zlogin.1 index c66c972cb6..1a5bcf20a3 100644 --- a/usr/src/man/man1/zlogin.1 +++ b/usr/src/man/man1/zlogin.1 @@ -1,20 +1,29 @@ '\" te .\" Copyright (c) 2006, Sun Microsystems, Inc. All Rights Reserved -.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. -.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. -.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] -.TH ZLOGIN 1 "Dec 18, 2006" +.\" The contents of this file are subject to the terms of the Common +.\" Development and Distribution License (the "License"). You may not use this +.\" file except in compliance with the License. +.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or +.\" http://www.opensolaris.org/os/licensing. See the License for the specific +.\" language governing permissions and limitations under the License. +.\" When distributing Covered Code, include this CDDL HEADER in each file and +.\" include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, +.\" add the following below this CDDL HEADER, with the fields enclosed by +.\" brackets "[]" replaced with your own identifying information: +.\" Portions Copyright [yyyy] [name of copyright owner] +.\" Copyright 2013 DEY Storage Systems, Inc. +.TH ZLOGIN 1 "Sep 8, 2013" .SH NAME zlogin \- enter a zone .SH SYNOPSIS .LP .nf -\fBzlogin\fR [\fB-CE\fR] [\fB-e\fR \fIc\fR] [\fB-l\fR \fIusername\fR] \fIzonename\fR +\fBzlogin\fR [\fB-CEQ\fR] [\fB-e\fR \fIc\fR] [\fB-l\fR \fIusername\fR] \fIzonename\fR .fi .LP .nf -\fBzlogin\fR [\fB-ES\fR] [\fB-e\fR \fIc\fR] [\fB-l\fR \fIusername\fR] \fIzonename\fR \fIutility\fR +\fBzlogin\fR [\fB-EQS\fR] [\fB-e\fR \fIc\fR] [\fB-l\fR \fIusername\fR] \fIzonename\fR \fIutility\fR [\fIargument\fR]... .fi @@ -117,6 +126,18 @@ option, the zone username used is "root". This option is invalid if the .sp .ne 2 .na +\fB-Q\fR +.ad +.RS 15n +Specifies quiet mode operation. In quiet mode, extra messages indicating the +the function of \fBzlogin\fR will not be displayed, giving the possibility +to present the appearance that the command is running locally rather than +in another zone. +.RE + +.sp +.ne 2 +.na \fB\fB-S\fR\fR .ad .RS 15n -- 2.11.4.GIT