MCPcopy Create free account
hub / github.com/Entware/Entware / back_lines

Function back_lines

scripts/config/lxdialog/textbox.c:20–47  ·  view source on GitHub ↗

* Go back 'n' lines in text. Called by dialog_textbox(). * 'page' will be updated to point to the desired line in 'buf'. */

Source from the content-addressed store, hash-verified

18 * 'page' will be updated to point to the desired line in 'buf'.
19 */
20static void back_lines(int n)
21{
22 int i;
23
24 begin_reached = 0;
25 /* Go back 'n' lines */
26 for (i = 0; i < n; i++) {
27 if (*page == '\0') {
28 if (end_reached) {
29 end_reached = 0;
30 continue;
31 }
32 }
33 if (page == buf) {
34 begin_reached = 1;
35 return;
36 }
37 page--;
38 do {
39 if (page == buf) {
40 begin_reached = 1;
41 return;
42 }
43 page--;
44 } while (*page != '\n');
45 page++;
46 }
47}
48
49/*
50 * Return current line of text. Called by dialog_textbox() and print_line().

Callers 1

dialog_textboxFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected