summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2009-08-12 10:16:32 +0200
committerOndrej Zajicek <santiago@crfreenet.org>2009-08-12 10:16:32 +0200
commit9c46ad8e2fba592d28d19757d39bc090fc5b0d47 (patch)
treeff89c032da87aba370444c4e80ba22b07d2a7810 /client
parentc0973621bc1e06cb6176dc2dfd97bec637861edd (diff)
downloadbird-9c46ad8e2fba592d28d19757d39bc090fc5b0d47.tar
bird-9c46ad8e2fba592d28d19757d39bc090fc5b0d47.zip
Count number of lines (and not messages) in 'more'.
Diffstat (limited to 'client')
-rw-r--r--client/client.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/client/client.c b/client/client.c
index ea8f8d3..88a6095 100644
--- a/client/client.c
+++ b/client/client.c
@@ -333,17 +333,18 @@ static void
server_got_reply(char *x)
{
int code;
+ int len = 0;
if (*x == '+') /* Async reply */
- skip_input || printf(">>> %s\n", x+1);
+ skip_input || (len = printf(">>> %s\n", x+1));
else if (x[0] == ' ') /* Continuation */
- skip_input || printf("%s%s\n", verbose ? " " : "", x+1);
+ skip_input || (len = printf("%s%s\n", verbose ? " " : "", x+1));
else if (strlen(x) > 4 &&
sscanf(x, "%d", &code) == 1 && code >= 0 && code < 10000 &&
(x[4] == ' ' || x[4] == '-'))
{
if (code)
- skip_input || printf("%s\n", verbose ? x : x+5);
+ skip_input || (len = printf("%s\n", verbose ? x : x+5));
if (x[4] == ' ')
{
nstate = STATE_PROMPT;
@@ -352,14 +353,19 @@ server_got_reply(char *x)
}
}
else
- skip_input || printf("??? <%s>\n", x);
+ skip_input || (len = printf("??? <%s>\n", x));
if (skip_input)
return;
- num_lines++;
- if (interactive && input_initialized && (num_lines >= LINES) && (cstate == STATE_CMD_SERVER))
- more();
+ if (interactive && input_initialized && (len > 0))
+ {
+ int lns = LINES ? LINES : 25;
+ int cls = COLS ? COLS : 80;
+ num_lines += (len + cls - 1) / cls; /* Divide and round up */
+ if ((num_lines >= lns) && (cstate == STATE_CMD_SERVER))
+ more();
+ }
}
static void