diff options
| author | Michael Brown | 2009-02-17 12:55:55 +0100 |
|---|---|---|
| committer | Michael Brown | 2009-02-17 12:55:55 +0100 |
| commit | 67ee41ad6d3cbd137e390e61a17eac8eaddc30fa (patch) | |
| tree | e9f5ecabec095baafacb5b777731b49a98cabe70 /src/hci | |
| parent | [pxe] Allow Escape to abort PXE menu selections (diff) | |
| download | ipxe-67ee41ad6d3cbd137e390e61a17eac8eaddc30fa.tar.gz ipxe-67ee41ad6d3cbd137e390e61a17eac8eaddc30fa.tar.xz ipxe-67ee41ad6d3cbd137e390e61a17eac8eaddc30fa.zip | |
[editbox] Allow for password widgets that do not display their contents
Diffstat (limited to 'src/hci')
| -rw-r--r-- | src/hci/mucurses/widgets/editbox.c | 11 | ||||
| -rw-r--r-- | src/hci/tui/settings_ui.c | 2 |
2 files changed, 9 insertions, 4 deletions
diff --git a/src/hci/mucurses/widgets/editbox.c b/src/hci/mucurses/widgets/editbox.c index 5c066fda7..a52089ce7 100644 --- a/src/hci/mucurses/widgets/editbox.c +++ b/src/hci/mucurses/widgets/editbox.c @@ -38,11 +38,11 @@ * @v row Row * @v col Starting column * @v width Width - * + * @v flags Flags */ 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 width, unsigned int flags ) { memset ( box, 0, sizeof ( *box ) ); box->string.buf = buf; box->string.len = len; @@ -51,6 +51,7 @@ void init_editbox ( struct edit_box *box, char *buf, size_t len, box->row = row; box->col = col; box->width = width; + box->flags = flags; } /** @@ -86,7 +87,11 @@ void draw_editbox ( struct edit_box *box ) { len = ( strlen ( box->string.buf ) - first ); if ( len > width ) len = width; - memcpy ( buf, ( box->string.buf + first ), len ); + if ( box->flags & EDITBOX_STARS ) { + memset ( buf, '*', len ); + } else { + memcpy ( buf, ( box->string.buf + first ), len ); + } /* Print box content and move cursor */ if ( ! box->win ) diff --git a/src/hci/tui/settings_ui.c b/src/hci/tui/settings_ui.c index 0907bfd32..4ab382704 100644 --- a/src/hci/tui/settings_ui.c +++ b/src/hci/tui/settings_ui.c @@ -123,7 +123,7 @@ static void load_setting ( struct setting_widget *widget ) { init_editbox ( &widget->editbox, widget->value, sizeof ( widget->value ), NULL, widget->row, ( widget->col + offsetof ( struct setting_row, value )), - sizeof ( ( ( struct setting_row * ) NULL )->value ) ); + sizeof ( ( ( struct setting_row * ) NULL )->value ), 0); } /** |
