summaryrefslogtreecommitdiffstats
path: root/src/core/parseopt.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/parseopt.c')
-rw-r--r--src/core/parseopt.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/core/parseopt.c b/src/core/parseopt.c
index cd3b3101..8410e6e9 100644
--- a/src/core/parseopt.c
+++ b/src/core/parseopt.c
@@ -31,6 +31,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <ctype.h>
#include <errno.h>
#include <getopt.h>
+#include <ipxe/uuid.h>
#include <ipxe/netdevice.h>
#include <ipxe/menu.h>
#include <ipxe/settings.h>
@@ -125,6 +126,29 @@ int parse_timeout ( char *text, unsigned long *value ) {
}
/**
+ * Parse UUID
+ *
+ * @v text Text
+ * @ret uuid UUID value
+ * @ret rc Return status code
+ */
+int parse_uuid ( char *text, struct uuid_option *uuid ) {
+ int rc;
+
+ /* Sanity check */
+ assert ( text != NULL );
+
+ /* Parse UUID */
+ if ( ( rc = uuid_aton ( text, &uuid->buf ) ) != 0 ) {
+ printf ( "\"%s\": invalid UUID\n", text );
+ return rc;
+ }
+ uuid->value = &uuid->buf;
+
+ return 0;
+}
+
+/**
* Parse network device name
*
* @v text Text