From f72400421d48f979e30a5c2fc20767f7edcb2018 Mon Sep 17 00:00:00 2001 From: Andy Spencer Date: Fri, 19 Aug 2011 04:46:23 +0000 Subject: [PATCH] Set dropdown using GET param --- index.cgi | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/index.cgi b/index.cgi index 39a868b..7347e9e 100755 --- a/index.cgi +++ b/index.cgi @@ -15,9 +15,12 @@ # Remove url codings from stdin function get_modeline { echo "$QUERY_STRING" | - sed -e 's/%\([0-9A-F][0-9A-F]\)/\\\\\x\1/g; s/[,&]/ /g' | + sed -e 's/%\([0-9A-F][0-9A-F]\)/\\\\\x\1/g; s/[,&?]/ /g' | xargs echo -e } +function get_param { + get_modeline | awk -v "key=$1" 'BEGIN{RS=" "; FS="="}; $1 ~ key {print $2}' +} # Extract an uploaded file from standard input # $1 is the name of the input to extract @@ -157,6 +160,7 @@ function do_help { sort | uniq ) uploads=$(ls -t db | head -n 5) + filetype=$(get_param '^(ft|filet(y(pe?)?)?)$') header text/html cat <<-EOF @@ -185,11 +189,14 @@ function do_help { -- 2.43.2