aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorBruce Evans <bde@FreeBSD.org>2006-10-08 18:15:08 +0000
committerBruce Evans <bde@FreeBSD.org>2006-10-08 18:15:08 +0000
commit2481da7487b9ad8f88311742b190fb5021a60260 (patch)
tree9e69099aed086269ab338b986781b6629a9787c9 /sys
parent0f85b689a524c306cff4d7acee6f4a8001f98f75 (diff)
downloadsrc-2481da7487b9ad8f88311742b190fb5021a60260.tar.gz
src-2481da7487b9ad8f88311742b190fb5021a60260.zip
Fixed formatting of printing of command tables. WIth the default max
output width of 79, only 6 columns of width 12 each fit, but 7 columns were printed. The fix is to pass the width of the next output to db_end_line() and not assume there that this width is always 1. Related unfixed bugs: - 1 character is wasted for a space after the last column - suppression of trailing spaces used to limit the misformatting, but seems to have been lost - in db_examine(), the width of the next output is not know and is still assumed to be 1.
Notes
Notes: svn path=/head/; revision=163134
Diffstat (limited to 'sys')
-rw-r--r--sys/ddb/db_command.c4
-rw-r--r--sys/ddb/db_examine.c2
-rw-r--r--sys/ddb/db_output.c4
-rw-r--r--sys/ddb/db_output.h2
4 files changed, 6 insertions, 6 deletions
diff --git a/sys/ddb/db_command.c b/sys/ddb/db_command.c
index 5494c848f08e..79143f118322 100644
--- a/sys/ddb/db_command.c
+++ b/sys/ddb/db_command.c
@@ -266,14 +266,14 @@ db_cmd_list(table)
for (cmd = table->table; cmd->name != 0; cmd++) {
db_printf("%-12s", cmd->name);
- db_end_line();
+ db_end_line(12);
}
if (table->aux_tablep == NULL)
return;
for (aux_cmdp = table->aux_tablep; aux_cmdp < table->aux_tablep_end;
aux_cmdp++) {
db_printf("%-12s", (*aux_cmdp)->name);
- db_end_line();
+ db_end_line(12);
}
}
diff --git a/sys/ddb/db_examine.c b/sys/ddb/db_examine.c
index 9be98e46048c..b9d4353da82a 100644
--- a/sys/ddb/db_examine.c
+++ b/sys/ddb/db_examine.c
@@ -176,7 +176,7 @@ db_examine(addr, fmt, count)
break;
}
if (db_print_position() != 0)
- db_end_line();
+ db_end_line(1);
break;
}
}
diff --git a/sys/ddb/db_output.c b/sys/ddb/db_output.c
index e9f0c824c9de..a3492416ae91 100644
--- a/sys/ddb/db_output.c
+++ b/sys/ddb/db_output.c
@@ -304,8 +304,8 @@ db_iprintf(fmt)
* End line if too long.
*/
void
-db_end_line()
+db_end_line(int field_width)
{
- if (db_output_position >= db_max_width)
+ if (db_output_position + field_width > db_max_width)
db_printf("\n");
}
diff --git a/sys/ddb/db_output.h b/sys/ddb/db_output.h
index 480c40d73af8..cbf9f0e3d68c 100644
--- a/sys/ddb/db_output.h
+++ b/sys/ddb/db_output.h
@@ -40,7 +40,7 @@
void db_disable_pager(void);
void db_enable_pager(void);
-void db_end_line(void);
+void db_end_line(int);
void db_force_whitespace(void);
int db_print_position(void);