Browse Source

[readline] Add replace_string()

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 13 years ago
parent
commit
d6f2408f2c
2 changed files with 13 additions and 0 deletions
  1. 11
    0
      src/hci/editstring.c
  2. 2
    0
      src/include/ipxe/editstring.h

+ 11
- 0
src/hci/editstring.c View File

117
 	insert_delete ( string, ~( ( size_t ) 0 ), NULL );
117
 	insert_delete ( string, ~( ( size_t ) 0 ), NULL );
118
 }
118
 }
119
 
119
 
120
+/**
121
+ * Replace editable string
122
+ *
123
+ * @v string		Editable string
124
+ * @v replacement	Replacement string
125
+ */
126
+void replace_string ( struct edit_string *string, const char *replacement ) {
127
+	string->cursor = 0;
128
+	insert_delete ( string, ~( ( size_t ) 0 ), replacement );
129
+}
130
+
120
 /**
131
 /**
121
  * Edit editable string
132
  * Edit editable string
122
  *
133
  *

+ 2
- 0
src/include/ipxe/editstring.h View File

41
 	string->len = len;
41
 	string->len = len;
42
 }
42
 }
43
 
43
 
44
+extern void replace_string ( struct edit_string *string,
45
+			     const char *replacement ) __nonnull;
44
 extern int edit_string ( struct edit_string *string, int key ) __nonnull;
46
 extern int edit_string ( struct edit_string *string, int key ) __nonnull;
45
 
47
 
46
 #endif /* _IPXE_EDITSTRING_H */
48
 #endif /* _IPXE_EDITSTRING_H */

Loading…
Cancel
Save