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

Function get_line

scripts/config/lxdialog/textbox.c:54–79  ·  view source on GitHub ↗

* Return current line of text. Called by dialog_textbox() and print_line(). * 'page' should point to start of current line before calling, and will be * updated to point to start of next line. */

Source from the content-addressed store, hash-verified

52 * updated to point to start of next line.
53 */
54static char *get_line(void)
55{
56 int i = 0;
57 static char line[MAX_LEN + 1];
58
59 end_reached = 0;
60 while (*page != '\n') {
61 if (*page == '\0') {
62 end_reached = 1;
63 break;
64 } else if (i < MAX_LEN)
65 line[i++] = *(page++);
66 else {
67 /* Truncate lines longer than MAX_LEN characters */
68 if (i == MAX_LEN)
69 line[i++] = '\0';
70 page++;
71 }
72 }
73 if (i <= MAX_LEN)
74 line[i] = '\0';
75 if (!end_reached)
76 page++; /* move past '\n' */
77
78 return line;
79}
80
81/*
82 * Print a new line of text.

Callers 2

print_lineFunction · 0.70
dialog_textboxFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected