mirror of https://github.com/ipxe/ipxe.git
[readline] Add replace_string()
Signed-off-by: Michael Brown <mcb30@ipxe.org>pull/1/head
parent
6a6dd5c452
commit
d6f2408f2c
|
@ -117,6 +117,17 @@ static void kill_eol ( struct edit_string *string ) {
|
||||||
insert_delete ( string, ~( ( size_t ) 0 ), NULL );
|
insert_delete ( string, ~( ( size_t ) 0 ), NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Replace editable string
|
||||||
|
*
|
||||||
|
* @v string Editable string
|
||||||
|
* @v replacement Replacement string
|
||||||
|
*/
|
||||||
|
void replace_string ( struct edit_string *string, const char *replacement ) {
|
||||||
|
string->cursor = 0;
|
||||||
|
insert_delete ( string, ~( ( size_t ) 0 ), replacement );
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Edit editable string
|
* Edit editable string
|
||||||
*
|
*
|
||||||
|
|
|
@ -41,6 +41,8 @@ static inline void init_editstring ( struct edit_string *string, char *buf,
|
||||||
string->len = len;
|
string->len = len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern void replace_string ( struct edit_string *string,
|
||||||
|
const char *replacement ) __nonnull;
|
||||||
extern int edit_string ( struct edit_string *string, int key ) __nonnull;
|
extern int edit_string ( struct edit_string *string, int key ) __nonnull;
|
||||||
|
|
||||||
#endif /* _IPXE_EDITSTRING_H */
|
#endif /* _IPXE_EDITSTRING_H */
|
||||||
|
|
Loading…
Reference in New Issue