diff options
author | Simon Rettberg | 2024-04-12 14:00:15 +0200 |
---|---|---|
committer | Simon Rettberg | 2024-04-12 14:00:15 +0200 |
commit | 98dc341428e247141f120d05fac48c4e144a4c0f (patch) | |
tree | 3ebacb37927e338383ac64c2e20eb0b2f820cb85 /src/core/parseopt.c | |
parent | Merge branch 'master' into openslx (diff) | |
parent | Merge branch 'ipxe:master' into aqc1xx (diff) | |
download | ipxe-98dc341428e247141f120d05fac48c4e144a4c0f.tar.gz ipxe-98dc341428e247141f120d05fac48c4e144a4c0f.tar.xz ipxe-98dc341428e247141f120d05fac48c4e144a4c0f.zip |
Merge branch 'aqc1xx' into openslx
Diffstat (limited to 'src/core/parseopt.c')
-rw-r--r-- | src/core/parseopt.c | 24 |
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 |