Subject: Re: ddb dmesg change
To: Simon Burge <simonb@wasabisystems.com>
From: Andrew Brown <atatat@atatdot.net>
List: tech-kern
Date: 05/28/2003 23:28:22
>> >+		print = addr;
>> >+	else
>> >+		print = mbp->msg_bufs;
>> >+
>> > 	for (newl = skip = i = 0, p = bufdata + mbp->msg_bufx;
>> > 	    i < mbp->msg_bufs; i++, p++) {
>> > 		if (p == bufdata + mbp->msg_bufs)
>> > 			p = bufdata;
>> >+		if (i < mbp->msg_bufs - print)
>> >+			continue;
>> 
>> you realize that this doesn't take the "\n<.*>" sequences into
>> account, yes?
>
>I'm not sure how big a deal this is.  I also could have just started
>printing after adding "mbp->msg_bufs - print" to the current message
>buffer start, checking for wraparound, etc but that seemed like too
>much work.

yes, indeed.

>The way the skip/newl logic works would require a bit of re-ordering
>of the existing code.   Unless ... I simply moved the new check to
>immediately before the "db_printf("%c", ch);", and that seems to
>work ok (but I didn't have any syslog messages in the kernel buffer
>to skip over).

otoh, you could simply make the man page (you are updating the man
page, aren't you? :) to say that "at most n characters will be
printed" instead of "prints n characters".  or something like that.
chances are you'll say you want 500 or so and that will tell you what
you want.  i doubt people will get picky about asking for 483
characters and not getting it.

-- 
|-----< "CODE WARRIOR" >-----|
codewarrior@daemon.org             * "ah!  i see you have the internet
twofsonet@graffiti.com (Andrew Brown)                that goes *ping*!"
werdna@squooshy.com       * "information is power -- share the wealth."