[parseopt] Add parse_timeout()

Parsing a timeout value (specified in milliseconds) into an internal
timeout value measured in timer ticks is a common operation.  Provide
a parse_timeout() value to carry out this conversion automatically.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2013-11-01 02:22:12 +00:00
parent b15dbc9cc6
commit 5e1fa5cd40
12 changed files with 46 additions and 27 deletions

View File

@@ -43,7 +43,7 @@ extern struct menu_item * add_menu_item ( struct menu *menu, const char *label,
int is_default );
extern void destroy_menu ( struct menu *menu );
extern struct menu * find_menu ( const char *name );
extern int show_menu ( struct menu *menu, unsigned int timeout_ms,
extern int show_menu ( struct menu *menu, unsigned long timeout,
const char *select, struct menu_item **selected );
#endif /* _IPXE_MENU_H */

View File

@@ -126,6 +126,7 @@ struct named_setting {
extern int parse_string ( char *text, char **value );
extern int parse_integer ( char *text, unsigned int *value );
extern int parse_timeout ( char *text, unsigned long *value );
extern int parse_netdev ( char *text, struct net_device **netdev );
extern int parse_menu ( char *text, struct menu **menu );
extern int parse_flag ( char *text __unused, int *flag );

View File

@@ -11,6 +11,6 @@ FILE_LICENCE ( GPL2_OR_LATER );
#include <stdint.h>
extern int ping ( const char *hostname, unsigned long timeout_ms, size_t len );
extern int ping ( const char *hostname, unsigned long timeout, size_t len );
#endif /* _USR_PINGMGMT_H */

View File

@@ -9,6 +9,6 @@
FILE_LICENCE ( GPL2_OR_LATER );
extern int prompt ( const char *text, unsigned int wait_ms, int key );
extern int prompt ( const char *text, unsigned long timeout, int key );
#endif /* _USR_PROMPT_H */