summaryrefslogtreecommitdiff
path: root/dpip/dpip.c
diff options
context:
space:
mode:
authorJorge Arellano Cid <jcid@dillo.org>2009-07-17 19:19:35 -0400
committerJorge Arellano Cid <jcid@dillo.org>2009-07-17 19:19:35 -0400
commit2ee5e732c456c722b1456bdbc8b203098681b4de (patch)
treeb71550eb13832ea37d3a5a5ae52b6990b28f2da2 /dpip/dpip.c
parentd53595dd6d4a1d6431aa8d439c63e30cb27525a0 (diff)
Added a_Dpip_get_attr_l() to DPIP's API
Diffstat (limited to 'dpip/dpip.c')
-rw-r--r--dpip/dpip.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/dpip/dpip.c b/dpip/dpip.c
index 5d83a2e9..bf6667d3 100644
--- a/dpip/dpip.c
+++ b/dpip/dpip.c
@@ -107,17 +107,18 @@ char *a_Dpip_build_cmd(const char *format, ...)
}
/*
- * Task: given a tag and an attribute name, return its value.
- * (stuffing of ' is removed here)
+ * Task: given a tag, its size and an attribute name, return the
+ * attribute value (stuffing of ' is removed here).
+ *
* Return value: the attribute value, or NULL if not present or malformed.
*/
-char *a_Dpip_get_attr(char *tag, size_t tagsize, const char *attrname)
+char *a_Dpip_get_attr_l(char *tag, size_t tagsize, const char *attrname)
{
uint_t i, n = 0, found = 0;
char *p, *q, *start, *val = NULL;
DpipTagParsingState state = SEEK_NAME;
- if (!attrname || !*attrname)
+ if (!tag || !tagsize || !attrname || !*attrname)
return NULL;
for (i = 1; i < tagsize && !found; ++i) {
@@ -164,5 +165,14 @@ char *a_Dpip_get_attr(char *tag, size_t tagsize, const char *attrname)
return val;
}
+/*
+ * Task: given a tag and an attribute name, return its value.
+ * Return value: the attribute value, or NULL if not present or malformed.
+ */
+char *a_Dpip_get_attr(char *tag, const char *attrname)
+{
+ return (tag ? a_Dpip_get_attr_l(tag, strlen(tag), attrname) : NULL);
+}
+
/* ------------------------------------------------------------------------- */