Mt Xia: Technical Consulting Group

Business Continuity / Disaster Recovery / High Availability
Data Center Automation / Audit Response / Audit Compliance

-
Current Location
-

css
  Downloads
    Scripts
      Korn
        Functions

-

digg Digg this page
del.icio.us Post to del.icio.us
Slashdot Slashdot it!


AIX FREE DEMO UNIX
Automated AIX Deployment
Reduce your DC costs

www.siteox.com

Business Web Site Hosting
$3.99 / month includes Tools,
Shopping Cart, Site Builder

www.siteox.com

cgiparse

Korn Shell 93 function to parse CGI variables containing encoded HEX characters.




################################################################
####
#### Program: cgiparse
#### 
#### Description: Korn Shell 93 function to parse CGI variables 
#### containing encoded HEX characters.  Initializes CGI 
#### variables with their assigned values into the current
#### shell environment.  If no CGI variable is passed, then
#### the parsed CGI string is sent to standard output.
####
#### Description:	Version 0.2	
####
#### Author:	Dana French (dfrench@mtxia.com)
####		615.556.0456
####
#### Date:		20061024
####
#### Usage: 
#### 
####   IFS="&" PARSED=( ${QUERY_STRING} )
####   for VAR in "${PARSED[@]}"
####   do
####     print "${VAR}" | cgiparse
####   done
####
################################################################
function cgiparse_k93
{
  typeset CGILINE
  typeset CGITMP
  typeset CGIVAR
  typeset CGIVAL
  CGIIFS="${IFS}"
  IFS=''
  while read -r -- CGILINE
  do
    CGITMP="${CGILINE//+/ }"
    CGITMP="${CGITMP//%([A-Za-z0-9][A-Za-z0-9])/\$( printf "'\\\0%o'" 0x\1 )}"
    CGIVAR="${CGITMP%%=*}"
    CGIVAL="${CGITMP#*=}"
    CGITMP="${CGIVAR}=\"\\\"${CGIVAL}\\\"\""
    [[ "${CGITMP}" = *=* ]] &&
      eval $( eval print -- "${CGITMP}" ) ||
      eval print -- "${CGITMP}"
  done
  IFS="${CGIIFS}"
}
################################################################

-
CGI Parser
-
 


AIX FREE DEMO UNIX
Automated AIX Deployment
Reduce your DC costs

www.siteox.com

Business Web Site Hosting
$3.99 / month includes Tools,
Shopping Cart, Site Builder

www.siteox.com