aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/libcqrlogo.c22
-rw-r--r--lib/libcqrlogo.h2
2 files changed, 24 insertions, 0 deletions
diff --git a/lib/libcqrlogo.c b/lib/libcqrlogo.c
index d2690ab..1502887 100644
--- a/lib/libcqrlogo.c
+++ b/lib/libcqrlogo.c
@@ -261,6 +261,28 @@ unsigned int cqr_get_query_uint(const char *query_string, const char *pattern,
return value;
}
+/*** get_query_char ***/
+char * cqr_get_query_char(const char *query_string, const char *pattern) {
+ char *value = NULL, *cut = NULL;
+ const char *tmp = NULL, *match = NULL;
+
+ if ((match = strstr(query_string, pattern)) == NULL)
+ return NULL;
+
+ if ((tmp = strchr(match, '=')) == NULL)
+ return NULL;
+
+ if (strlen(tmp) < 1)
+ return NULL;
+
+ value = strdup(tmp + 1);
+
+ if ((cut = strchr(value, '&')) != NULL)
+ *cut = '\0';
+
+ return value;
+}
+
/*** get_ini_value ***/
unsigned int get_ini_value(dictionary * ini, uint8_t type, const char * section, const char * parameter,
unsigned int value, unsigned int min, unsigned int max) {
diff --git a/lib/libcqrlogo.h b/lib/libcqrlogo.h
index 4be5087..cc3153c 100644
--- a/lib/libcqrlogo.h
+++ b/lib/libcqrlogo.h
@@ -80,6 +80,8 @@ struct cqr_png * cqr_encode_qrcode_to_png(const char *text, const struct cqr_con
/*** cqr_get_query_uint ***/
unsigned int cqr_get_query_uint(const char *query_string, const char *pattern,
unsigned int value, unsigned int min, unsigned int max);
+/*** get_query_char ***/
+char * cqr_get_query_char(const char *query_string, const char *pattern);
/*** cqr_get_ini_value ***/
unsigned int cqr_get_ini_value(dictionary * ini, uint8_t type, const char * section, const char * parameter,
unsigned int value, unsigned int min, unsigned int max);