summaryrefslogtreecommitdiffstats
path: root/ui/common
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2013-03-06 13:42:15 +0800
committerGeoff Levand <geoff@infradead.org>2013-03-06 06:06:26 -0800
commit56c142e5406160a58ee345e3e0433eb998ee046e (patch)
tree5b512ab04e77b2e915a30d77b8b178c5fe343bbf /ui/common
parente01ca9726e5ce96605cb57595999885fde18884b (diff)
downloadpetitboot-56c142e5406160a58ee345e3e0433eb998ee046e.zip
petitboot-56c142e5406160a58ee345e3e0433eb998ee046e.tar.gz
ui/common/url: Add pb_url_scheme_name
Add a function to lookup the name of a scheme, for more useful URL output. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Geoff Levand <geoff@infradead.org>
Diffstat (limited to 'ui/common')
-rw-r--r--ui/common/url.c11
-rw-r--r--ui/common/url.h2
2 files changed, 13 insertions, 0 deletions
diff --git a/ui/common/url.c b/ui/common/url.c
index 3e7b384..3e6c8da 100644
--- a/ui/common/url.c
+++ b/ui/common/url.c
@@ -197,3 +197,14 @@ fail:
talloc_free(url);
return NULL;
}
+
+const char *pb_url_scheme_name(enum pb_url_scheme scheme)
+{
+ unsigned int i;
+
+ for (i = 0; i < sizeof(schemes) / sizeof(schemes[0]); i++)
+ if (schemes[i].scheme == scheme)
+ return schemes[i].str;
+
+ return NULL;
+}
diff --git a/ui/common/url.h b/ui/common/url.h
index a966dc7..3cb7cd8 100644
--- a/ui/common/url.h
+++ b/ui/common/url.h
@@ -60,4 +60,6 @@ struct pb_url {
struct pb_url *pb_url_parse(void *ctx, const char *url_str);
+const char *pb_url_scheme_name(enum pb_url_scheme scheme);
+
#endif
OpenPOWER on IntegriCloud