2005-01-06 01:34:41 +00:00
|
|
|
/*-
|
2017-11-30 15:48:35 +00:00
|
|
|
* SPDX-License-Identifier: MIT-CMU
|
|
|
|
*
|
1993-06-12 14:58:17 +00:00
|
|
|
* Mach Operating System
|
|
|
|
* Copyright (c) 1991,1990 Carnegie Mellon University
|
|
|
|
* All Rights Reserved.
|
1995-05-30 08:16:23 +00:00
|
|
|
*
|
1993-06-12 14:58:17 +00:00
|
|
|
* Permission to use, copy, modify and distribute this software and its
|
|
|
|
* documentation is hereby granted, provided that both the copyright
|
|
|
|
* notice and this permission notice appear in all copies of the
|
|
|
|
* software, derivative works or modified versions, and any portions
|
|
|
|
* thereof, and that both notices appear in supporting documentation.
|
1995-05-30 08:16:23 +00:00
|
|
|
*
|
|
|
|
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS
|
1993-06-12 14:58:17 +00:00
|
|
|
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
|
|
|
|
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
|
1995-05-30 08:16:23 +00:00
|
|
|
*
|
1993-06-12 14:58:17 +00:00
|
|
|
* Carnegie Mellon requests users of this software to return to
|
1995-05-30 08:16:23 +00:00
|
|
|
*
|
1993-06-12 14:58:17 +00:00
|
|
|
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
|
|
|
|
* School of Computer Science
|
|
|
|
* Carnegie Mellon University
|
|
|
|
* Pittsburgh PA 15213-3890
|
1995-05-30 08:16:23 +00:00
|
|
|
*
|
1993-06-12 14:58:17 +00:00
|
|
|
* any improvements or extensions that they make and grant Carnegie the
|
|
|
|
* rights to redistribute these changes.
|
|
|
|
*/
|
|
|
|
/*
|
|
|
|
* Author: David B. Golub, Carnegie Mellon University
|
|
|
|
* Date: 7/90
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Printf and character output for debugger.
|
|
|
|
*/
|
|
|
|
|
2003-06-10 22:09:23 +00:00
|
|
|
#include <sys/cdefs.h>
|
|
|
|
__FBSDID("$FreeBSD$");
|
|
|
|
|
2008-08-18 16:51:44 +00:00
|
|
|
#include "opt_ddb.h"
|
|
|
|
|
1994-08-13 03:50:34 +00:00
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/systm.h>
|
1999-08-09 10:35:05 +00:00
|
|
|
#include <sys/cons.h>
|
2004-07-10 23:47:20 +00:00
|
|
|
#include <sys/kdb.h>
|
2004-01-28 06:51:18 +00:00
|
|
|
#include <sys/kernel.h>
|
|
|
|
#include <sys/sysctl.h>
|
1995-12-10 19:08:32 +00:00
|
|
|
|
1994-08-13 03:50:34 +00:00
|
|
|
#include <machine/stdarg.h>
|
1995-12-10 19:08:32 +00:00
|
|
|
|
1994-08-13 03:50:34 +00:00
|
|
|
#include <ddb/ddb.h>
|
1995-11-24 14:13:42 +00:00
|
|
|
#include <ddb/db_output.h>
|
1993-06-12 14:58:17 +00:00
|
|
|
|
2008-08-18 16:48:09 +00:00
|
|
|
struct dbputchar_arg {
|
|
|
|
size_t da_nbufr;
|
|
|
|
size_t da_remain;
|
|
|
|
char *da_pbufr;
|
|
|
|
char *da_pnext;
|
|
|
|
};
|
|
|
|
|
1993-06-12 14:58:17 +00:00
|
|
|
/*
|
|
|
|
* Character output - tracks position in line.
|
|
|
|
* To do this correctly, we should know how wide
|
|
|
|
* the output device is - then we could zero
|
|
|
|
* the line position when the output device wraps
|
|
|
|
* around to the start of the next line.
|
|
|
|
*
|
|
|
|
* Instead, we count the number of spaces printed
|
|
|
|
* since the last printing character so that we
|
|
|
|
* don't print trailing spaces. This avoids most
|
|
|
|
* of the wraparounds.
|
|
|
|
*/
|
1995-11-29 10:25:50 +00:00
|
|
|
static int db_output_position = 0; /* output column */
|
|
|
|
static int db_last_non_space = 0; /* last non-space character */
|
1998-07-08 09:11:43 +00:00
|
|
|
db_expr_t db_tab_stop_width = 8; /* how wide are tab stops? */
|
2016-04-30 14:41:18 +00:00
|
|
|
#define NEXT_TAB(i) rounddown((i) + db_tab_stop_width, db_tab_stop_width)
|
1998-07-08 09:11:43 +00:00
|
|
|
db_expr_t db_max_width = 79; /* output line width */
|
2004-11-01 22:15:15 +00:00
|
|
|
db_expr_t db_lines_per_page = 20; /* lines per page */
|
2006-07-12 21:22:44 +00:00
|
|
|
volatile int db_pager_quit; /* user requested quit */
|
2003-07-31 17:27:52 +00:00
|
|
|
static int db_newlines; /* # lines this page */
|
2006-07-12 21:22:44 +00:00
|
|
|
static int db_maxlines; /* max lines/page when paging */
|
2004-01-28 06:51:18 +00:00
|
|
|
static int ddb_use_printf = 0;
|
|
|
|
SYSCTL_INT(_debug, OID_AUTO, ddb_use_printf, CTLFLAG_RW, &ddb_use_printf, 0,
|
|
|
|
"use printf for all ddb output");
|
1993-06-12 14:58:17 +00:00
|
|
|
|
2008-08-18 16:48:09 +00:00
|
|
|
static void db_putc(int c);
|
|
|
|
static void db_puts(const char *str);
|
2004-01-28 06:51:18 +00:00
|
|
|
static void db_putchar(int c, void *arg);
|
2006-07-12 21:22:44 +00:00
|
|
|
static void db_pager(void);
|
1996-05-08 04:29:08 +00:00
|
|
|
|
1993-06-12 14:58:17 +00:00
|
|
|
/*
|
|
|
|
* Force pending whitespace.
|
|
|
|
*/
|
|
|
|
void
|
2014-10-12 18:01:52 +00:00
|
|
|
db_force_whitespace(void)
|
1993-06-12 14:58:17 +00:00
|
|
|
{
|
2017-05-17 00:34:34 +00:00
|
|
|
int last_print, next_tab;
|
1993-06-12 14:58:17 +00:00
|
|
|
|
|
|
|
last_print = db_last_non_space;
|
|
|
|
while (last_print < db_output_position) {
|
|
|
|
next_tab = NEXT_TAB(last_print);
|
|
|
|
if (next_tab <= db_output_position) {
|
|
|
|
while (last_print < next_tab) { /* DON'T send a tab!!! */
|
|
|
|
cnputc(' ');
|
Add a new DDB(4) facility, output capture. Input and output from DDB may be
captured to a memory buffer for later inspection using sysctl(8), or in the
future, to a textdump.
A new DDB command, "capture", is added, which accepts arguments "on", "off",
"reset", and "status".
A new DDB sysctl tree, debug.ddb.capture, is added, which can be used to
resize the capture buffer and extract buffer contents.
MFC after: 3 months
2007-12-25 23:06:51 +00:00
|
|
|
db_capture_writech(' ');
|
1993-06-12 14:58:17 +00:00
|
|
|
last_print++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
cnputc(' ');
|
Add a new DDB(4) facility, output capture. Input and output from DDB may be
captured to a memory buffer for later inspection using sysctl(8), or in the
future, to a textdump.
A new DDB command, "capture", is added, which accepts arguments "on", "off",
"reset", and "status".
A new DDB sysctl tree, debug.ddb.capture, is added, which can be used to
resize the capture buffer and extract buffer contents.
MFC after: 3 months
2007-12-25 23:06:51 +00:00
|
|
|
db_capture_writech(' ');
|
1993-06-12 14:58:17 +00:00
|
|
|
last_print++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
db_last_non_space = db_output_position;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Output character. Buffer whitespace.
|
|
|
|
*/
|
1996-05-08 04:29:08 +00:00
|
|
|
static void
|
2008-08-18 16:48:09 +00:00
|
|
|
db_putchar(int c, void *arg)
|
|
|
|
{
|
|
|
|
struct dbputchar_arg *dap = arg;
|
|
|
|
|
|
|
|
if (dap->da_pbufr == NULL) {
|
|
|
|
/* No bufferized output is provided. */
|
|
|
|
db_putc(c);
|
|
|
|
} else {
|
|
|
|
*dap->da_pnext++ = c;
|
|
|
|
dap->da_remain--;
|
|
|
|
|
|
|
|
/* Leave always the buffer 0 terminated. */
|
|
|
|
*dap->da_pnext = '\0';
|
|
|
|
|
|
|
|
/* Check if the buffer needs to be flushed. */
|
|
|
|
if (dap->da_remain < 2 || c == '\n') {
|
|
|
|
db_puts(dap->da_pbufr);
|
|
|
|
dap->da_pnext = dap->da_pbufr;
|
|
|
|
dap->da_remain = dap->da_nbufr;
|
|
|
|
*dap->da_pnext = '\0';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
db_putc(int c)
|
1993-06-12 14:58:17 +00:00
|
|
|
{
|
2003-07-31 17:27:52 +00:00
|
|
|
|
2004-01-28 06:51:18 +00:00
|
|
|
/*
|
|
|
|
* If not in the debugger or the user requests it, output data to
|
|
|
|
* both the console and the message buffer.
|
|
|
|
*/
|
2004-07-10 23:47:20 +00:00
|
|
|
if (!kdb_active || ddb_use_printf) {
|
2004-01-28 06:51:18 +00:00
|
|
|
printf("%c", c);
|
2004-07-10 23:47:20 +00:00
|
|
|
if (!kdb_active)
|
2004-01-28 06:51:18 +00:00
|
|
|
return;
|
|
|
|
if (c == '\r' || c == '\n')
|
|
|
|
db_check_interrupt();
|
2006-07-12 21:22:44 +00:00
|
|
|
if (c == '\n' && db_maxlines > 0) {
|
2004-01-28 06:51:18 +00:00
|
|
|
db_newlines++;
|
2006-07-12 21:22:44 +00:00
|
|
|
if (db_newlines >= db_maxlines)
|
|
|
|
db_pager();
|
2004-01-28 06:51:18 +00:00
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Otherwise, output data directly to the console. */
|
1993-06-12 14:58:17 +00:00
|
|
|
if (c > ' ' && c <= '~') {
|
|
|
|
/*
|
|
|
|
* Printing character.
|
|
|
|
* If we have spaces to print, print them first.
|
|
|
|
* Use tabs if possible.
|
|
|
|
*/
|
|
|
|
db_force_whitespace();
|
|
|
|
cnputc(c);
|
Add a new DDB(4) facility, output capture. Input and output from DDB may be
captured to a memory buffer for later inspection using sysctl(8), or in the
future, to a textdump.
A new DDB command, "capture", is added, which accepts arguments "on", "off",
"reset", and "status".
A new DDB sysctl tree, debug.ddb.capture, is added, which can be used to
resize the capture buffer and extract buffer contents.
MFC after: 3 months
2007-12-25 23:06:51 +00:00
|
|
|
db_capture_writech(c);
|
1993-06-12 14:58:17 +00:00
|
|
|
db_output_position++;
|
|
|
|
db_last_non_space = db_output_position;
|
|
|
|
}
|
|
|
|
else if (c == '\n') {
|
1994-08-27 16:14:39 +00:00
|
|
|
/* Newline */
|
|
|
|
cnputc(c);
|
Add a new DDB(4) facility, output capture. Input and output from DDB may be
captured to a memory buffer for later inspection using sysctl(8), or in the
future, to a textdump.
A new DDB command, "capture", is added, which accepts arguments "on", "off",
"reset", and "status".
A new DDB sysctl tree, debug.ddb.capture, is added, which can be used to
resize the capture buffer and extract buffer contents.
MFC after: 3 months
2007-12-25 23:06:51 +00:00
|
|
|
db_capture_writech(c);
|
1994-08-27 16:14:39 +00:00
|
|
|
db_output_position = 0;
|
|
|
|
db_last_non_space = 0;
|
|
|
|
db_check_interrupt();
|
2006-07-12 21:22:44 +00:00
|
|
|
if (db_maxlines > 0) {
|
2003-07-31 17:27:52 +00:00
|
|
|
db_newlines++;
|
2006-07-12 21:22:44 +00:00
|
|
|
if (db_newlines >= db_maxlines)
|
|
|
|
db_pager();
|
2003-07-31 17:27:52 +00:00
|
|
|
}
|
1994-08-27 16:14:39 +00:00
|
|
|
}
|
|
|
|
else if (c == '\r') {
|
1993-06-12 14:58:17 +00:00
|
|
|
/* Return */
|
|
|
|
cnputc(c);
|
Add a new DDB(4) facility, output capture. Input and output from DDB may be
captured to a memory buffer for later inspection using sysctl(8), or in the
future, to a textdump.
A new DDB command, "capture", is added, which accepts arguments "on", "off",
"reset", and "status".
A new DDB sysctl tree, debug.ddb.capture, is added, which can be used to
resize the capture buffer and extract buffer contents.
MFC after: 3 months
2007-12-25 23:06:51 +00:00
|
|
|
db_capture_writech(c);
|
1993-06-12 14:58:17 +00:00
|
|
|
db_output_position = 0;
|
|
|
|
db_last_non_space = 0;
|
|
|
|
db_check_interrupt();
|
|
|
|
}
|
|
|
|
else if (c == '\t') {
|
|
|
|
/* assume tabs every 8 positions */
|
|
|
|
db_output_position = NEXT_TAB(db_output_position);
|
|
|
|
}
|
|
|
|
else if (c == ' ') {
|
|
|
|
/* space */
|
|
|
|
db_output_position++;
|
|
|
|
}
|
|
|
|
else if (c == '\007') {
|
|
|
|
/* bell */
|
|
|
|
cnputc(c);
|
Add a new DDB(4) facility, output capture. Input and output from DDB may be
captured to a memory buffer for later inspection using sysctl(8), or in the
future, to a textdump.
A new DDB command, "capture", is added, which accepts arguments "on", "off",
"reset", and "status".
A new DDB sysctl tree, debug.ddb.capture, is added, which can be used to
resize the capture buffer and extract buffer contents.
MFC after: 3 months
2007-12-25 23:06:51 +00:00
|
|
|
/* No need to beep in a log: db_capture_writech(c); */
|
1993-06-12 14:58:17 +00:00
|
|
|
}
|
|
|
|
/* other characters are assumed non-printing */
|
|
|
|
}
|
|
|
|
|
2008-08-18 16:48:09 +00:00
|
|
|
static void
|
|
|
|
db_puts(const char *str)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; str[i] != '\0'; i++)
|
|
|
|
db_putc(str[i]);
|
|
|
|
}
|
|
|
|
|
2003-07-31 17:27:52 +00:00
|
|
|
/*
|
2006-07-12 21:22:44 +00:00
|
|
|
* Turn on the pager.
|
2003-07-31 17:27:52 +00:00
|
|
|
*/
|
|
|
|
void
|
2006-07-12 21:22:44 +00:00
|
|
|
db_enable_pager(void)
|
2003-07-31 17:27:52 +00:00
|
|
|
{
|
2006-07-12 21:22:44 +00:00
|
|
|
if (db_maxlines == 0) {
|
|
|
|
db_maxlines = db_lines_per_page;
|
2005-10-02 22:57:31 +00:00
|
|
|
db_newlines = 0;
|
2006-07-12 21:22:44 +00:00
|
|
|
db_pager_quit = 0;
|
2005-10-02 22:57:31 +00:00
|
|
|
}
|
2003-07-31 17:27:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2006-07-12 21:22:44 +00:00
|
|
|
* Turn off the pager.
|
2003-07-31 17:27:52 +00:00
|
|
|
*/
|
|
|
|
void
|
2006-07-12 21:22:44 +00:00
|
|
|
db_disable_pager(void)
|
|
|
|
{
|
|
|
|
db_maxlines = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* A simple paging callout function. It supports several simple more(1)-like
|
|
|
|
* commands as well as a quit command that sets db_pager_quit which db
|
|
|
|
* commands can poll to see if they should terminate early.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
db_pager(void)
|
2003-07-31 17:27:52 +00:00
|
|
|
{
|
2004-11-01 22:15:15 +00:00
|
|
|
int c, done;
|
2003-07-31 17:27:52 +00:00
|
|
|
|
Add a new DDB(4) facility, output capture. Input and output from DDB may be
captured to a memory buffer for later inspection using sysctl(8), or in the
future, to a textdump.
A new DDB command, "capture", is added, which accepts arguments "on", "off",
"reset", and "status".
A new DDB sysctl tree, debug.ddb.capture, is added, which can be used to
resize the capture buffer and extract buffer contents.
MFC after: 3 months
2007-12-25 23:06:51 +00:00
|
|
|
db_capture_enterpager();
|
2003-07-31 17:27:52 +00:00
|
|
|
db_printf("--More--\r");
|
2004-11-01 22:15:15 +00:00
|
|
|
done = 0;
|
|
|
|
while (!done) {
|
2021-03-14 23:04:27 +00:00
|
|
|
c = db_getc();
|
2003-07-31 17:27:52 +00:00
|
|
|
switch (c) {
|
2004-11-01 22:15:15 +00:00
|
|
|
case 'e':
|
|
|
|
case 'j':
|
2003-07-31 17:27:52 +00:00
|
|
|
case '\n':
|
|
|
|
/* Just one more line. */
|
2006-07-12 21:22:44 +00:00
|
|
|
db_maxlines = 1;
|
2004-11-01 22:15:15 +00:00
|
|
|
done++;
|
|
|
|
break;
|
|
|
|
case 'd':
|
|
|
|
/* Half a page. */
|
2006-07-12 21:22:44 +00:00
|
|
|
db_maxlines = db_lines_per_page / 2;
|
2004-11-01 22:15:15 +00:00
|
|
|
done++;
|
|
|
|
break;
|
|
|
|
case 'f':
|
2003-07-31 17:27:52 +00:00
|
|
|
case ' ':
|
|
|
|
/* Another page. */
|
2006-07-12 21:22:44 +00:00
|
|
|
db_maxlines = db_lines_per_page;
|
2004-11-01 22:15:15 +00:00
|
|
|
done++;
|
|
|
|
break;
|
2003-07-31 17:27:52 +00:00
|
|
|
case 'q':
|
|
|
|
case 'Q':
|
|
|
|
case 'x':
|
|
|
|
case 'X':
|
|
|
|
/* Quit */
|
2006-07-12 21:22:44 +00:00
|
|
|
db_maxlines = 0;
|
|
|
|
db_pager_quit = 1;
|
|
|
|
done++;
|
|
|
|
break;
|
2003-07-31 17:27:52 +00:00
|
|
|
#if 0
|
|
|
|
/* FALLTHROUGH */
|
|
|
|
default:
|
|
|
|
cnputc('\007');
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
2006-10-10 06:36:01 +00:00
|
|
|
db_printf(" ");
|
|
|
|
db_force_whitespace();
|
|
|
|
db_printf("\r");
|
2006-07-12 21:22:44 +00:00
|
|
|
db_newlines = 0;
|
Add a new DDB(4) facility, output capture. Input and output from DDB may be
captured to a memory buffer for later inspection using sysctl(8), or in the
future, to a textdump.
A new DDB command, "capture", is added, which accepts arguments "on", "off",
"reset", and "status".
A new DDB sysctl tree, debug.ddb.capture, is added, which can be used to
resize the capture buffer and extract buffer contents.
MFC after: 3 months
2007-12-25 23:06:51 +00:00
|
|
|
db_capture_exitpager();
|
2003-07-31 17:27:52 +00:00
|
|
|
}
|
|
|
|
|
1993-06-12 14:58:17 +00:00
|
|
|
/*
|
|
|
|
* Return output position
|
|
|
|
*/
|
|
|
|
int
|
2014-10-12 18:01:52 +00:00
|
|
|
db_print_position(void)
|
1993-06-12 14:58:17 +00:00
|
|
|
{
|
|
|
|
return (db_output_position);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Printing
|
|
|
|
*/
|
2010-05-11 17:01:14 +00:00
|
|
|
int
|
1993-11-25 01:38:01 +00:00
|
|
|
db_printf(const char *fmt, ...)
|
1993-06-12 14:58:17 +00:00
|
|
|
{
|
2008-08-18 16:48:09 +00:00
|
|
|
#ifdef DDB_BUFR_SIZE
|
|
|
|
char bufr[DDB_BUFR_SIZE];
|
|
|
|
#endif
|
|
|
|
struct dbputchar_arg dca;
|
1993-06-12 14:58:17 +00:00
|
|
|
va_list listp;
|
2010-05-11 17:01:14 +00:00
|
|
|
int retval;
|
1996-09-14 11:54:59 +00:00
|
|
|
|
2008-08-18 16:48:09 +00:00
|
|
|
#ifdef DDB_BUFR_SIZE
|
|
|
|
dca.da_pbufr = bufr;
|
|
|
|
dca.da_pnext = dca.da_pbufr;
|
|
|
|
dca.da_nbufr = sizeof(bufr);
|
|
|
|
dca.da_remain = sizeof(bufr);
|
|
|
|
*dca.da_pnext = '\0';
|
|
|
|
#else
|
|
|
|
dca.da_pbufr = NULL;
|
|
|
|
#endif
|
|
|
|
|
1996-09-14 11:54:59 +00:00
|
|
|
va_start(listp, fmt);
|
2010-05-11 17:01:14 +00:00
|
|
|
retval = kvprintf (fmt, db_putchar, &dca, db_radix, listp);
|
1996-09-14 11:54:59 +00:00
|
|
|
va_end(listp);
|
2008-08-18 16:48:09 +00:00
|
|
|
|
|
|
|
#ifdef DDB_BUFR_SIZE
|
|
|
|
if (*dca.da_pbufr != '\0')
|
|
|
|
db_puts(dca.da_pbufr);
|
|
|
|
#endif
|
2010-05-11 17:01:14 +00:00
|
|
|
return (retval);
|
1996-09-14 11:54:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int db_indent;
|
|
|
|
|
|
|
|
void
|
|
|
|
db_iprintf(const char *fmt,...)
|
|
|
|
{
|
2008-08-18 16:48:09 +00:00
|
|
|
#ifdef DDB_BUFR_SIZE
|
|
|
|
char bufr[DDB_BUFR_SIZE];
|
|
|
|
#endif
|
|
|
|
struct dbputchar_arg dca;
|
2017-05-17 00:34:34 +00:00
|
|
|
int i;
|
1996-09-14 11:54:59 +00:00
|
|
|
va_list listp;
|
|
|
|
|
|
|
|
for (i = db_indent; i >= 8; i -= 8)
|
|
|
|
db_printf("\t");
|
|
|
|
while (--i >= 0)
|
|
|
|
db_printf(" ");
|
2008-08-18 16:48:09 +00:00
|
|
|
|
|
|
|
#ifdef DDB_BUFR_SIZE
|
|
|
|
dca.da_pbufr = bufr;
|
|
|
|
dca.da_pnext = dca.da_pbufr;
|
|
|
|
dca.da_nbufr = sizeof(bufr);
|
|
|
|
dca.da_remain = sizeof(bufr);
|
|
|
|
*dca.da_pnext = '\0';
|
|
|
|
#else
|
|
|
|
dca.da_pbufr = NULL;
|
|
|
|
#endif
|
|
|
|
|
1993-06-12 14:58:17 +00:00
|
|
|
va_start(listp, fmt);
|
2008-08-18 16:48:09 +00:00
|
|
|
kvprintf (fmt, db_putchar, &dca, db_radix, listp);
|
1993-06-12 14:58:17 +00:00
|
|
|
va_end(listp);
|
2008-08-18 16:48:09 +00:00
|
|
|
|
|
|
|
#ifdef DDB_BUFR_SIZE
|
|
|
|
if (*dca.da_pbufr != '\0')
|
|
|
|
db_puts(dca.da_pbufr);
|
|
|
|
#endif
|
1993-06-12 14:58:17 +00:00
|
|
|
}
|
|
|
|
|
1993-09-09 23:03:24 +00:00
|
|
|
/*
|
|
|
|
* End line if too long.
|
|
|
|
*/
|
|
|
|
void
|
2006-10-08 18:15:08 +00:00
|
|
|
db_end_line(int field_width)
|
1993-09-09 23:03:24 +00:00
|
|
|
{
|
2006-10-08 18:15:08 +00:00
|
|
|
if (db_output_position + field_width > db_max_width)
|
1993-09-09 23:03:24 +00:00
|
|
|
db_printf("\n");
|
|
|
|
}
|