scripts/kconfig/lxdialog/util.c
Source file repositories/reference/linux-study-clean/scripts/kconfig/lxdialog/util.c
File Facts
- System
- Linux kernel
- Corpus path
scripts/kconfig/lxdialog/util.c- Extension
.c- Size
- 16505 bytes
- Lines
- 673
- Domain
- Support Tooling And Documentation
- Bucket
- scripts
- Inferred role
- Support Tooling And Documentation: implementation source
- Status
- source implementation candidate
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
stdarg.hdialog.h
Detected Declarations
function set_mono_themefunction set_classic_themefunction set_blackbg_themefunction set_bluetitle_themefunction set_themefunction init_one_colorfunction init_dialog_colorsfunction color_setupfunction attr_clearfunction dialog_clearfunction init_dialogfunction set_dialog_backtitlefunction set_dialog_subtitlesfunction end_dialogfunction dialogfunction print_autowrapfunction print_buttonfunction draw_boxfunction draw_shadowfunction first_alphafunction keypadfunction on_key_resizefunction item_resetfunction item_makefunction item_add_strfunction item_set_tagfunction item_set_datafunction item_set_selectedfunction item_activate_selectedfunction item_tagfunction item_countfunction item_setfunction item_nfunction item_is_selectedfunction item_is_tag
Annotated Snippet
if (len > columns - 2) {
const char *ellipsis = "[...] ";
waddstr(stdscr, ellipsis);
skip = len - (columns - 2 - strlen(ellipsis));
}
for (pos = dlg.subtitles; pos != NULL; pos = pos->next) {
if (skip == 0)
waddch(stdscr, ACS_RARROW);
else
skip--;
if (skip == 0)
waddch(stdscr, ' ');
else
skip--;
if (skip < strlen(pos->text)) {
waddstr(stdscr, pos->text + skip);
skip = 0;
} else
skip -= strlen(pos->text);
if (skip == 0)
waddch(stdscr, ' ');
else
skip--;
}
for (i = len + 1; i < columns - 1; i++)
waddch(stdscr, ACS_HLINE);
}
wnoutrefresh(stdscr);
}
/*
* Do some initialization for dialog
*/
int init_dialog(const char *backtitle)
{
int height, width;
initscr(); /* Init curses */
/* Get current cursor position for signal handler in mconf.c */
getyx(stdscr, saved_y, saved_x);
getmaxyx(stdscr, height, width);
if (height < WINDOW_HEIGHT_MIN || width < WINDOW_WIDTH_MIN) {
endwin();
return -ERRDISPLAYTOOSMALL;
}
dlg.backtitle = backtitle;
color_setup(getenv("MENUCONFIG_COLOR"));
keypad(stdscr, TRUE);
cbreak();
noecho();
dialog_clear();
return 0;
}
void set_dialog_backtitle(const char *backtitle)
{
dlg.backtitle = backtitle;
}
void set_dialog_subtitles(struct subtitle_list *subtitles)
{
dlg.subtitles = subtitles;
}
/*
* End using dialog functions.
*/
void end_dialog(int x, int y)
{
/* move cursor back to original position */
move(y, x);
refresh();
endwin();
}
/* Print the title of the dialog. Center the title and truncate
* tile if wider than dialog (- 2 chars).
**/
void print_title(WINDOW *dialog, const char *title, int width)
{
Annotation
- Immediate include surface: `stdarg.h`, `dialog.h`.
- Detected declarations: `function set_mono_theme`, `function set_classic_theme`, `function set_blackbg_theme`, `function set_bluetitle_theme`, `function set_theme`, `function init_one_color`, `function init_dialog_colors`, `function color_setup`, `function attr_clear`, `function dialog_clear`.
- Atlas domain: Support Tooling And Documentation / scripts.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.