MCPcopy Create free account
hub / github.com/F-Stack/f-stack / db_pager

Function db_pager

freebsd/ddb/db_output.c:254–304  ·  view source on GitHub ↗

* 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. */

Source from the content-addressed store, hash-verified

252 * commands can poll to see if they should terminate early.
253 */
254void
255db_pager(void)
256{
257 int c, done;
258
259 db_capture_enterpager();
260 db_printf("--More--\r");
261 done = 0;
262 while (!done) {
263 c = cngetc();
264 switch (c) {
265 case 'e':
266 case 'j':
267 case '\n':
268 /* Just one more line. */
269 db_maxlines = 1;
270 done++;
271 break;
272 case 'd':
273 /* Half a page. */
274 db_maxlines = db_lines_per_page / 2;
275 done++;
276 break;
277 case 'f':
278 case ' ':
279 /* Another page. */
280 db_maxlines = db_lines_per_page;
281 done++;
282 break;
283 case 'q':
284 case 'Q':
285 case 'x':
286 case 'X':
287 /* Quit */
288 db_maxlines = 0;
289 db_pager_quit = 1;
290 done++;
291 break;
292#if 0
293 /* FALLTHROUGH */
294 default:
295 cnputc('\007');
296#endif
297 }
298 }
299 db_printf(" ");
300 db_force_whitespace();
301 db_printf("\r");
302 db_newlines = 0;
303 db_capture_exitpager();
304}
305
306/*
307 * Return output position

Callers 1

db_putcFunction · 0.85

Calls 6

db_capture_enterpagerFunction · 0.85
db_printfFunction · 0.85
cngetcFunction · 0.85
cnputcFunction · 0.85
db_force_whitespaceFunction · 0.85
db_capture_exitpagerFunction · 0.85

Tested by

no test coverage detected