summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile1
-rwxr-xr-xquery_param2
-rw-r--r--uriescape.c2
3 files changed, 4 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index b6e3ab8..7809a59 100644
--- a/Makefile
+++ b/Makefile
@@ -36,3 +36,4 @@ install: all
install -t $(PREFIX)/bin urigetline
install -t $(PREFIX)/bin copy_start_nevermind.sh
install -t $(PREFIX)/bin choose
+ install -t $(PREFIX)/bin query_param
diff --git a/query_param b/query_param
new file mode 100755
index 0000000..3438bb7
--- /dev/null
+++ b/query_param
@@ -0,0 +1,2 @@
+#!/bin/sh
+printf "%s\n" "${QUERY_STRING}" | tr '&' '\n' | grep "^${1}=" | cut -d= -f2-
diff --git a/uriescape.c b/uriescape.c
index ccf90cb..2098941 100644
--- a/uriescape.c
+++ b/uriescape.c
@@ -7,7 +7,7 @@ int main(int argc,char *argv[]) {
if(argc < 2) return 1;
len=uriescapelength((unsigned char *)argv[1],strlen(argv[1]));
out=malloc(len+1);
- uriescape((unsigned char *)argv[1],out,len);
+ uriescape((unsigned char *)argv[1],out,strlen(argv[1]));
out[len]=0;
printf("%s\n",out);
return 0;