Source-Changes-HG archive

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

[src/trunk]: src From kern/9569.



details:   https://anonhg.NetBSD.org/src/rev/7ab82681b439
branches:  trunk
changeset: 484867:7ab82681b439
user:      jhawk <jhawk%NetBSD.org@localhost>
date:      Thu Apr 13 22:48:29 2000 +0000

description:
>From kern/9569.
Preserve ddb's idea of "count" from one command to the next if
repeating a command via hitting newline.

diffstat:

 share/man/man4/ddb.4 |  15 ++++++++++++---
 sys/ddb/db_command.c |  21 +++++++++++++++++----
 2 files changed, 29 insertions(+), 7 deletions(-)

diffs (83 lines):

diff -r 349f2e1aed30 -r 7ab82681b439 share/man/man4/ddb.4
--- a/share/man/man4/ddb.4      Thu Apr 13 22:04:23 2000 +0000
+++ b/share/man/man4/ddb.4      Thu Apr 13 22:48:29 2000 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: ddb.4,v 1.38 2000/01/26 13:37:57 soren Exp $
+.\"    $NetBSD: ddb.4,v 1.39 2000/04/13 22:48:29 jhawk Exp $
 .\"
 .\" Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -179,9 +179,9 @@
 .Pp
 A blank line repeats the previous command from the address
 .Ar next
-with a
+with the previous
 .Cm count
-of 1 and no modifiers.
+and no modifiers.
 Specifying
 .Cm address
 sets
@@ -196,6 +196,15 @@
 .Cm count
 is taken to be 1 for printing commands, and infinity for stack traces.
 .Pp
+The syntax:
+.Bd -ragged -offset indent
+.Ic Cm , Ns Ar count
+.Ed
+.Pp
+repeats the previous command, just as a blank line does, but with
+the specified
+.Cm count .
+.Pp
 .Nm
 has a
 .Xr more 1 -like
diff -r 349f2e1aed30 -r 7ab82681b439 sys/ddb/db_command.c
--- a/sys/ddb/db_command.c      Thu Apr 13 22:04:23 2000 +0000
+++ b/sys/ddb/db_command.c      Thu Apr 13 22:48:29 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: db_command.c,v 1.37 2000/04/11 02:21:16 chs Exp $      */
+/*     $NetBSD: db_command.c,v 1.38 2000/04/13 22:48:29 jhawk Exp $    */
 
 /* 
  * Mach Operating System
@@ -197,13 +197,25 @@
        boolean_t       have_addr = FALSE;
        int             result;
 
+       static db_expr_t               last_count = 0;
+
        t = db_read_token();
-       if (t == tEOL) {
-           /* empty line repeats last command, at 'next' */
+       if ((t == tEOL) || (t == tCOMMA)) {
+           /*
+            * An empty line repeats last command, at 'next'.
+            * Only a count repeats the last command with the new count.
+            */
            cmd = *last_cmdp;
            addr = (db_expr_t)db_next;
+           if (t == tCOMMA) {
+                   if (!db_expression(&count)) {
+                   db_printf("Count missing\n");
+                   db_flush_lex();
+                   return;
+               }
+           } else
+               count = last_count;
            have_addr = FALSE;
-           count = 1;
            modif[0] = '\0';
        }
        else if (t == tEXCL) {
@@ -296,6 +308,7 @@
            }
        }
        *last_cmdp = cmd;
+       last_count = count;
        if (cmd != 0) {
            /*
             * Execute the command.



Home | Main Index | Thread Index | Old Index