mirror of
https://github.com/ipxe/ipxe
synced 2025-12-25 00:17:57 +03:00
[readline] Add init_editstring() wrapper function
Standardise on using init_editstring() to initialise an embedded editable string, to match the coding style used by other embedded objects. Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
@@ -46,8 +46,7 @@ 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 ) {
|
||||
memset ( box, 0, sizeof ( *box ) );
|
||||
box->string.buf = buf;
|
||||
box->string.len = len;
|
||||
init_editstring ( &box->string, buf, len );
|
||||
box->string.cursor = strlen ( buf );
|
||||
box->win = ( win ? win : stdscr );
|
||||
box->row = row;
|
||||
|
||||
@@ -93,8 +93,7 @@ char * readline ( const char *prompt ) {
|
||||
printf ( "%s", prompt );
|
||||
|
||||
memset ( &string, 0, sizeof ( string ) );
|
||||
string.buf = buf;
|
||||
string.len = sizeof ( buf );
|
||||
init_editstring ( &string, buf, sizeof ( buf ) );
|
||||
buf[0] = '\0';
|
||||
|
||||
while ( 1 ) {
|
||||
|
||||
Reference in New Issue
Block a user