aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2011-04-23 13:46:54 -0700
committerH. Peter Anvin <hpa@zytor.com>2011-04-23 13:50:01 -0700
commitd6426caa6772e1887f07e35c15e2ba72a8a2bccd (patch)
treed598c04f3ea48680b957e9b1afbb9a6876190d92
parentda94a304bcb9645600901a692409680ac627e7d7 (diff)
downloadsyslinux-d6426caa6772e1887f07e35c15e2ba72a8a2bccd.tar.gz
syslinux-d6426caa6772e1887f07e35c15e2ba72a8a2bccd.tar.xz
syslinux-d6426caa6772e1887f07e35c15e2ba72a8a2bccd.zip
pxe: urlparse: add comments
Add comments to the URL parser functions. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r--core/fs/pxe/urlparse.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/core/fs/pxe/urlparse.c b/core/fs/pxe/urlparse.c
index 77865b54..459dca42 100644
--- a/core/fs/pxe/urlparse.c
+++ b/core/fs/pxe/urlparse.c
@@ -27,8 +27,6 @@
/*
* urlparse.c
- *
- * Decompose a URL into its components.
*/
#include <string.h>
@@ -36,6 +34,11 @@
#include <stdio.h>
#include "url.h"
+/*
+ * Decompose a URL into its components. This is done in-place;
+ * this routine does not allocate any additional storage. Freeing the
+ * original buffer frees all storage used.
+ */
void parse_url(struct url_info *ui, char *url)
{
char *p = url;
@@ -97,6 +100,9 @@ void parse_url(struct url_info *ui, char *url)
}
}
+/*
+ * Escapes unsafe characters in a URL. Returns a malloc'd buffer.
+ */
char *url_escape_unsafe(const char *input)
{
const char *p = input;
@@ -136,6 +142,13 @@ static int hexdigit(char c)
return -1;
}
+/*
+ * Unescapes a buffer, optionally ending at an *unescaped* terminator
+ * (like ; for TFTP). The unescaping is done in-place.
+ *
+ * If a terminator is reached, return a pointer to the first character
+ * after the terminator.
+ */
char *url_unescape(char *buffer, char terminator)
{
char *p = buffer;