summaryrefslogtreecommitdiffstats
path: root/lib/libcqrlogo.c
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2016-05-09 11:53:44 +0200
committerGravatar Christian Hesse <mail@eworm.de>2016-05-09 11:53:44 +0200
commitdaddd6cb7d021a73de45cd21f42da438c65dc1df (patch)
treee54d7536ceff83cba45c40c0bbc6850aa4248daf /lib/libcqrlogo.c
parentb6b192b49333ff18e1a4df53f27fc4873bf1ac25 (diff)
downloadcqrlogo-daddd6cb7d021a73de45cd21f42da438c65dc1df.tar.gz
cqrlogo-daddd6cb7d021a73de45cd21f42da438c65dc1df.tar.zst
introduce cqr_get_query_char()
Diffstat (limited to 'lib/libcqrlogo.c')
-rw-r--r--lib/libcqrlogo.c22
1 files changed, 22 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) {