-/*
- * Check to see if we need to pause at the end of a screen.
- * If we do, we have to switch to half keepalives during the pause because
- * we are probably in the middle of a server operation and the NOOP command
- * would confuse everything.
- */
-int checkpagin(int lp, unsigned int pagin, unsigned int height)
-{
- int thekey;
-
- if (sigcaught) return(lp);
- thekey = was_a_key_pressed();
- if (thekey == 'q' || thekey == 'Q' || thekey == 's' || thekey == 'S')
- thekey = STOP_KEY;
- if (thekey == 'n' || thekey == 'N')
- thekey = NEXT_KEY;
- if ( (thekey == NEXT_KEY) || (thekey == STOP_KEY)) sigcaught = thekey;
- if (sigcaught) return(lp);
-
- if (!pagin) return(0);
- if (lp>=(height-1)) {
- set_keepalives(KA_HALF);
- hit_any_key(ipc_for_signal_handlers); /* Cheating -IO */
- set_keepalives(KA_YES);
- return(0);
- }
- return(lp);
-}
-
-
-
-
-/*
- * pprintf() ... paginated version of printf()
- */
-void pprintf(const char *format, ...) {
- va_list arg_ptr;
- static char buf[4096]; /* static for performance, change if needed */
- int i;
-
- /* If sigcaught is nonzero, a keypress has interrupted this and we
- * should just drain output.
- */
- if (sigcaught) return;
-
- /* Otherwise, start spewing... */
- va_start(arg_ptr, format);
- vsnprintf(buf, sizeof(buf), format, arg_ptr);
- va_end(arg_ptr);
-
- for (i=0; !IsEmptyStr(&buf[i]); ++i) {
- scr_putc(buf[i]);
- if (buf[i]==10) {
- ++lines_printed;
- lines_printed = checkpagin(lines_printed,
- (userflags & US_PAGINATOR),
- screenheight);
- }
- }
-}
-
-
-