Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/ipcs Fix option handling so that you can show inform...



details:   https://anonhg.NetBSD.org/src/rev/5b42700fcc9f
branches:  trunk
changeset: 559622:5b42700fcc9f
user:      simonb <simonb%NetBSD.org@localhost>
date:      Sun Mar 21 10:02:12 2004 +0000

description:
Fix option handling so that you can show information about more than
one thing at a time.
Patch from Chris Demetriou a very long time ago.

diffstat:

 usr.bin/ipcs/ipcs.1 |  13 ++++++++++---
 usr.bin/ipcs/ipcs.c |  21 ++++++++++++---------
 2 files changed, 22 insertions(+), 12 deletions(-)

diffs (103 lines):

diff -r 0d72b2cfd2da -r 5b42700fcc9f usr.bin/ipcs/ipcs.1
--- a/usr.bin/ipcs/ipcs.1       Sun Mar 21 08:35:18 2004 +0000
+++ b/usr.bin/ipcs/ipcs.1       Sun Mar 21 10:02:12 2004 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: ipcs.1,v 1.13 2003/02/25 10:35:44 wiz Exp $
+.\"    $NetBSD: ipcs.1,v 1.14 2004/03/21 10:02:12 simonb Exp $
 .\"
 .\" Copyright (c) 1994 SigmaSoft, Th. Lockert
 .\" All rights reserved.
@@ -28,7 +28,7 @@
 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd June 17, 2002
+.Dd March 21, 2004
 .Dt IPCS 1
 .Os
 .Sh NAME
@@ -118,6 +118,12 @@
 .It Fl T
 Display system information about shared memory, message queues
 and semaphores.
+(This is shorthand for specifying the
+.Fl M ,
+.Fl Q ,
+and
+.Fl S
+options.)
 .El
 .Pp
 If none of the
@@ -126,8 +132,9 @@
 .Fl Q ,
 .Fl q ,
 .Fl S ,
+.Fl s ,
 or
-.Fl s
+.Fl T
 options are specified, information about all active IPC facilities is
 listed.
 .Sh RESTRICTIONS
diff -r 0d72b2cfd2da -r 5b42700fcc9f usr.bin/ipcs/ipcs.c
--- a/usr.bin/ipcs/ipcs.c       Sun Mar 21 08:35:18 2004 +0000
+++ b/usr.bin/ipcs/ipcs.c       Sun Mar 21 10:02:12 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ipcs.c,v 1.31 2003/10/21 02:20:22 fvdl Exp $   */
+/*     $NetBSD: ipcs.c,v 1.32 2004/03/21 10:02:12 simonb Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -155,7 +155,7 @@
 #define TIME           16
 
 char   *core = NULL, *namelist = NULL;
-int    display = SHMINFO | MSGINFO | SEMINFO;
+int    display = 0;
 int    option = 0;
 
 int
@@ -166,25 +166,25 @@
        while ((i = getopt(argc, argv, "MmQqSsabC:cN:optT")) != -1)
                switch (i) {
                case 'M':
-                       display = SHMTOTAL;
+                       display |= SHMTOTAL;
                        break;
                case 'm':
-                       display = SHMINFO;
+                       display |= SHMINFO;
                        break;
                case 'Q':
-                       display = MSGTOTAL;
+                       display |= MSGTOTAL;
                        break;
                case 'q':
-                       display = MSGINFO;
+                       display |= MSGINFO;
                        break;
                case 'S':
-                       display = SEMTOTAL;
+                       display |= SEMTOTAL;
                        break;
                case 's':
-                       display = SEMINFO;
+                       display |= SEMINFO;
                        break;
                case 'T':
-                       display = SHMTOTAL | MSGTOTAL | SEMTOTAL;
+                       display |= SHMTOTAL | MSGTOTAL | SEMTOTAL;
                        break;
                case 'a':
                        option |= BIGGEST | CREATOR | OUTSTANDING | PID | TIME;
@@ -217,6 +217,9 @@
        if (argc - optind > 0)
                usage();
 
+        if (display == 0)
+               display = SHMINFO | MSGINFO | SEMINFO;
+
        if (core == NULL) {
                if (display & (MSGINFO | MSGTOTAL))
                        msg_sysctl();



Home | Main Index | Thread Index | Old Index