Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/kdump Allow passing of the ktrace file as the last a...



details:   https://anonhg.NetBSD.org/src/rev/75aeea91bf54
branches:  trunk
changeset: 537174:75aeea91bf54
user:      atatat <atatat%NetBSD.org@localhost>
date:      Fri Sep 27 20:31:44 2002 +0000

description:
Allow passing of the ktrace file as the last argument without a -f.

diffstat:

 usr.bin/kdump/kdump.1 |  11 +++++++----
 usr.bin/kdump/kdump.c |  21 ++++++++++++++++-----
 2 files changed, 23 insertions(+), 9 deletions(-)

diffs (92 lines):

diff -r 5c6a63d9871c -r 75aeea91bf54 usr.bin/kdump/kdump.1
--- a/usr.bin/kdump/kdump.1     Fri Sep 27 20:29:02 2002 +0000
+++ b/usr.bin/kdump/kdump.1     Fri Sep 27 20:31:44 2002 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: kdump.1,v 1.11 2002/06/20 22:02:32 atatat Exp $
+.\"    $NetBSD: kdump.1,v 1.12 2002/09/27 20:31:44 atatat Exp $
 .\"
 .\" Copyright (c) 1990, 1993
 .\"    The Regents of the University of California.  All rights reserved.
@@ -40,21 +40,24 @@
 .Nm kdump
 .Nd display kernel trace data
 .Sh SYNOPSIS
-.Nm
+.Nm ""
 .Op Fl dnlRT
 .Op Fl e Ar emulation
 .Op Fl f Ar file
 .Op Fl m Ar maxdata
 .Op Fl p Ar pid
 .Op Fl t Ar trstr
+.Op Ar file
 .Sh DESCRIPTION
 .Nm
 displays the kernel trace files produced with
 .Xr ktrace 1
 in human readable format.
-By default, the file
+The file
 .Pa ktrace.out
-in the current directory is displayed.
+in the current directory is displayed, unless either the
+.Fl f
+option is used, or a file name is supplied as the last argument.
 .Pp
 The options are as follows:
 .Bl -tag -width Fl
diff -r 5c6a63d9871c -r 75aeea91bf54 usr.bin/kdump/kdump.c
--- a/usr.bin/kdump/kdump.c     Fri Sep 27 20:29:02 2002 +0000
+++ b/usr.bin/kdump/kdump.c     Fri Sep 27 20:31:44 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kdump.c,v 1.40 2002/08/04 14:26:21 jdolecek Exp $      */
+/*     $NetBSD: kdump.c,v 1.41 2002/09/27 20:31:44 atatat Exp $        */
 
 /*-
  * Copyright (c) 1988, 1993
@@ -43,7 +43,7 @@
 #if 0
 static char sccsid[] = "@(#)kdump.c    8.4 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: kdump.c,v 1.40 2002/08/04 14:26:21 jdolecek Exp $");
+__RCSID("$NetBSD: kdump.c,v 1.41 2002/09/27 20:31:44 atatat Exp $");
 #endif
 #endif /* not lint */
 
@@ -72,7 +72,7 @@
 
 int timestamp, decimal, plain, tail, maxdata;
 pid_t do_pid = -1;
-const char *tracefile = DEF_TRACEFILE;
+const char *tracefile = NULL;
 struct ktr_header ktr_header;
 int emul_changed = 0;
 
@@ -162,7 +162,17 @@
        argv += optind;
        argc -= optind;
 
-       if (argc > 1)
+       if (tracefile == NULL) {
+               if (argc == 1) {
+                       tracefile = argv[0];
+                       argv++;
+                       argc--;
+               }
+               else
+                       tracefile = DEF_TRACEFILE;
+       }
+
+       if (argc > 0)
                usage();
 
        setemul(emul_name, 0, 0);
@@ -637,6 +647,7 @@
 {
 
        (void)fprintf(stderr,
-"usage: kdump [-dnlRT] [-e emulation] [-f trfile] [-m maxdata] [-t [cnis]]\n");
+"usage: kdump [-dnlRT] [-e emulation] [-f trfile] [-m maxdata] [-p pid]\n"
+"             [-t [cnis]] [trfile]\n");
        exit(1);
 }



Home | Main Index | Thread Index | Old Index