Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/ktrace repair command-line parsing so that an error ...



details:   https://anonhg.NetBSD.org/src/rev/f0fb2e2d0d5c
branches:  trunk
changeset: 514447:f0fb2e2d0d5c
user:      assar <assar%NetBSD.org@localhost>
date:      Sun Sep 02 23:18:01 2001 +0000

description:
repair command-line parsing so that an error is generated if no pid or
program is given (or input file for ktruss)

diffstat:

 usr.bin/ktrace/ktrace.c |  17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)

diffs (61 lines):

diff -r 533d9fa655b2 -r f0fb2e2d0d5c usr.bin/ktrace/ktrace.c
--- a/usr.bin/ktrace/ktrace.c   Sun Sep 02 23:00:30 2001 +0000
+++ b/usr.bin/ktrace/ktrace.c   Sun Sep 02 23:18:01 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ktrace.c,v 1.23 2001/05/04 07:09:55 simonb Exp $       */
+/*     $NetBSD: ktrace.c,v 1.24 2001/09/02 23:18:01 assar Exp $        */
 
 /*-
  * Copyright (c) 1988, 1993
@@ -43,7 +43,7 @@
 #if 0
 static char sccsid[] = "@(#)ktrace.c   8.2 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: ktrace.c,v 1.23 2001/05/04 07:09:55 simonb Exp $");
+__RCSID("$NetBSD: ktrace.c,v 1.24 2001/09/02 23:18:01 assar Exp $");
 #endif
 #endif /* not lint */
 
@@ -86,8 +86,9 @@
 {
        enum { NOTSET, CLEAR, CLEARALL } clear;
        int append, ch, fd, inherit, ops, pid, pidset, synclog, trpoints;
-       const char *infile, *outfile;
+       const char *outfile;
 #ifdef KTRUSS
+       const char *infile;
        const char *emul_name = "netbsd";
 #endif
 
@@ -101,7 +102,7 @@
        outfile = infile = NULL;
 #else
 # define OPTIONS "aCcdf:g:ip:st:"
-       outfile = infile = DEF_TRACEFILE;
+       outfile = DEF_TRACEFILE;
 #endif
 
        while ((ch = getopt(argc,argv, OPTIONS)) != -1)
@@ -129,7 +130,7 @@
                        break;
 #else
                case 'f':
-                       infile = outfile = optarg;
+                       outfile = optarg;
                        break;
 #endif
                case 'g':
@@ -181,8 +182,12 @@
        argv += optind;
        argc -= optind;
 
-       if (!infile && ((pidset && *argv) || (!pidset && !*argv)))
+       if ((pidset && *argv) || (!pidset && !*argv)) {
+#ifdef KTRUSS
+           if(!infile)
+#endif
                usage();
+       }
 
 #ifdef KTRUSS
        if (infile) {



Home | Main Index | Thread Index | Old Index