[parseopt] Allow parsed option to be modified

Parsing a setting name requires the ability to modify the text being
parsed.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2013-07-22 16:13:25 +01:00
parent 8ea5822afd
commit b87020a090
6 changed files with 25 additions and 26 deletions

View File

@@ -43,7 +43,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
* @ret port Fibre Channel port
* @ret rc Return status code
*/
static int parse_fc_port ( const char *text, struct fc_port **port ) {
static int parse_fc_port ( char *text, struct fc_port **port ) {
/* Sanity check */
assert ( text != NULL );
@@ -65,7 +65,7 @@ static int parse_fc_port ( const char *text, struct fc_port **port ) {
* @ret port_id Fibre Channel port ID
* @ret rc Return status code
*/
static int parse_fc_port_id ( const char *text, struct fc_port_id *port_id ) {
static int parse_fc_port_id ( char *text, struct fc_port_id *port_id ) {
int rc;
/* Sanity check */
@@ -87,8 +87,7 @@ static int parse_fc_port_id ( const char *text, struct fc_port_id *port_id ) {
* @ret handler Fibre Channel ELS handler
* @ret rc Return status code
*/
static int parse_fc_els_handler ( const char *text,
struct fc_els_handler **handler ) {
static int parse_fc_els_handler ( char *text, struct fc_els_handler **handler ){
for_each_table_entry ( (*handler), FC_ELS_HANDLERS ) {
if ( strcasecmp ( (*handler)->name, text ) == 0 )

View File

@@ -39,7 +39,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
/** "img{single}" options */
struct imgsingle_options {
/** Image name */
const char *name;
char *name;
/** Replace image */
int replace;
/** Free image after execution */

View File

@@ -84,7 +84,7 @@ static int imgtrust_exec ( int argc, char **argv ) {
/** "imgverify" options */
struct imgverify_options {
/** Required signer common name */
const char *signer;
char *signer;
/** Keep signature after verification */
int keep;
};

View File

@@ -41,7 +41,7 @@ FEATURE ( FEATURE_MISC, "Menu", DHCP_EB_FEATURE_MENU, 1 );
/** "menu" options */
struct menu_options {
/** Name */
const char *name;
char *name;
/** Delete */
int delete;
};
@@ -107,7 +107,7 @@ static int menu_exec ( int argc, char **argv ) {
/** "item" options */
struct item_options {
/** Menu name */
const char *menu;
char *menu;
/** Shortcut key */
unsigned int key;
/** Use as default */
@@ -192,11 +192,11 @@ static int item_exec ( int argc, char **argv ) {
/** "choose" options */
struct choose_options {
/** Menu name */
const char *menu;
char *menu;
/** Timeout */
unsigned int timeout;
/** Default selection */
const char *select;
char *select;
/** Keep menu */
int keep;
};