48 #define SETTINGS_LIST_ROW 3U 49 #define SETTINGS_LIST_COL 1U 50 #define SETTINGS_LIST_ROWS ( LINES - 6U - SETTINGS_LIST_ROW ) 51 #define INFO_ROW ( LINES - 5U ) 52 #define ALERT_ROW ( LINES - 2U ) 53 #define INSTRUCTION_ROW ( LINES - 2U ) 54 #define INSTRUCTION_PAD " " 57 #define SETTING_ROW_TEXT( cols ) struct { \ 61 char settings[ cols - 1 - 1 - 1 - 1 ]; \ 65 char value[ cols - 1 - 15 - 1 - 1 - 1 - 1 ]; \ 70 } __attribute__ (( packed )) 117 unsigned int index ) {
122 unsigned int count = 0;
169 sizeof ( text->u.setting.value ), 0 );
199 unsigned int curs_offset;
203 memset ( &text,
' ',
sizeof ( text ) );
213 sizeof ( text.u.settings ) ) );
218 memset ( text.u.setting.name,
'.',
219 sizeof ( text.u.setting.name ) );
221 sizeof ( text.u.setting.name ) );
226 value =
"<not specified>";
229 sizeof ( text.u.setting.value )));
285 static void msg (
unsigned int row,
const char *
fmt, ... ) {
387 "Ctrl-C - discard changes" );
390 "%sCtrl-X - exit configuration utility",
445 unsigned int previous;
453 memset ( &ui, 0,
sizeof ( ui ) );
int getkey(unsigned long timeout)
Get single keypress.
int editing
Editing in progress flag.
struct arbelprm_rc_send_wqe rc
Editable text box widget.
#define PRODUCT_SHORT_NAME
int fetchf_setting(struct settings *settings, const struct setting *setting, struct settings **origin, struct setting *fetched, char *buf, size_t len)
Fetch formatted value of setting.
int erase(void)
Completely clear the screen.
int settings_ui(struct settings *settings)
static void draw_setting_row(struct settings_ui *ui)
Draw setting row.
struct settings * parent
Parent settings block.
static int attroff(int attrs)
#define CPAIR_EDIT
Editable text.
A settings user interface.
static int main_loop(struct settings *settings)
struct settings_ui_row row
Current row.
static void clearmsg(unsigned int row)
Clear message on specified row.
static int delete_setting(struct settings *settings, const struct setting *setting)
Delete setting.
int endwin(void)
Finalise console environment.
A settings user interface row.
#define mvprintw(y, x, fmt,...)
const char * settings_name(struct settings *settings)
Return settings block name.
#define SETTINGS_LIST_ROW
static void draw_instruction_row(struct settings_ui *ui)
Draw instruction row.
#define offsetof(type, field)
Get offset of a field within a structure.
const char * description
Description.
static unsigned int select_setting_row(struct settings_ui *ui, unsigned int index)
Select a setting.
#define CPAIR_NORMAL
Normal text.
struct settings * origin
Configuration setting origin.
#define SETTINGS
Configuration setting table.
static void valert(const char *fmt, va_list args)
Print alert message.
static int save_setting(struct settings_ui *ui)
Save setting ui value back to configuration settings.
void * memcpy(void *dest, const void *src, size_t len) __nonnull
struct settings * settings_target(struct settings *settings)
Redirect to target settings block.
static void draw_setting_rows(struct settings_ui *ui)
Draw the current block of setting rows.
WINDOW * initscr(void)
Initialise console environment.
static void draw_info_row(struct settings_ui *ui)
Draw information row.
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
#define PRODUCT_SETTING_URI
#define list_for_each_entry(pos, head, member)
Iterate over entries in a list.
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
#define CPAIR_ALERT
Error text.
static int edit_editbox(struct edit_box *box, int key) __nonnull
Edit text box widget.
#define CPAIR_URL
URL text.
struct settings * settings
Target configuration settings block.
An editable text box widget.
pseudo_bit_t value[0x00020]
static __always_inline void off_t userptr_t src
int storef_setting(struct settings *settings, const struct setting *setting, const char *value)
Store formatted value of setting.
static void vmsg(unsigned int row, const char *fmt, va_list args)
Print message centred on specified row.
struct settings * settings
Settings block.
Option configuration console.
char * strerror(int errno)
Retrieve string representation of error number.
void init_editbox(struct edit_box *box, char *buf, size_t len, WINDOW *win, unsigned int row, unsigned int col, unsigned int width, unsigned int flags)
Initialise text box widget.
static void select_settings(struct settings_ui *ui, struct settings *settings)
Select settings block.
int setting_applies(struct settings *settings, const struct setting *setting)
Check applicability of setting.
static int clrtoeol(void)
#define for_each_table_entry(pointer, table)
Iterate through all entries within a linker table.
size_t strlen(const char *src)
Get length of string.
#define CPAIR_SEPARATOR
Unselectable text (e.g.
void draw_editbox(struct edit_box *box)
Draw text box widget.
int curs_set(int visibility)
Set cursor visibility.
__builtin_va_list va_list
char value[256]
Buffer for setting's value.
unsigned int row
Screen row.
struct setting setting
Configuration setting.
static void alert(const char *fmt,...)
Print alert message.
uint16_t count
Number of entries.
struct jump_scroller scroll
Jump scroller.
struct edit_box editbox
Edit box widget used for editing setting.
static int move(int y, int x)
#define CPAIR_SELECT
Highlighted text.
#define SETTINGS_LIST_COL
int ssize_t const char * fmt
int snprintf(char *buf, size_t size, const char *fmt,...)
Write a formatted string to a buffer.
struct list_head children
Child settings blocks.
#define color_set(cpno, opts)
static void draw_title_row(struct settings_ui *ui)
Draw title row.
typeof(acpi_finder=acpi_find)
ACPI table finder.
uint64_t index
Index of the first segment within the content.
#define va_start(ap, last)
static size_t string_copy(char *dest, const char *src, size_t len)
Copy string without NUL termination.
static int edit_setting(struct settings_ui *ui, int key)
Edit setting ui.
#define SETTINGS_LIST_ROWS
int setting_name(struct settings *settings, const struct setting *setting, char *buf, size_t len)
Return full setting name.
int setting_cmp(const struct setting *a, const struct setting *b)
Compare two settings.
unsigned int sleep(unsigned int secs)
Sleep (interruptibly) for a fixed number of seconds.
#define NULL
NULL pointer (VOID *)
static int mvaddstr(int y, int x, const char *str)
#define SETTING_ROW_TEXT(cols)
Layout of text within a setting row.
static int attron(int attrs)
int vsnprintf(char *buf, size_t size, const char *fmt, va_list args)
Write a formatted string to a buffer.
void * memset(void *dest, int character, size_t len) __nonnull
static void msg(unsigned int row, const char *fmt,...)
Print message centred on specified row.