From 2dac6c15d822f51b96c7d2ca4b74cabf11d4079e Mon Sep 17 00:00:00 2001 From: root Date: Sat, 24 Oct 2009 16:38:24 +0200 Subject: Generalize uriunescape function, and cleanup a bit. --- localsmsapps | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'localsmsapps') diff --git a/localsmsapps b/localsmsapps index 0938820..54379a6 100755 --- a/localsmsapps +++ b/localsmsapps @@ -6,13 +6,16 @@ simpleword() { echo "$1" | tr '[A-Z]' '[a-z]' | egrep '^[a-z][a-z0-9-]+$' || exit 1 } +uriunescape() { + echo "$1" | perl -e 'use URI::Escape; print lc(uri_unescape());' +} + urlencode() { -# echo "$1" | perl -e 'use Encode; use URI::Escape; use URI::URL; print URI::URL->new(Encode::decode("utf8", uri_unescape()))."\n";' echo "$1" | perl -e 'use URI::URL; print URI::URL->new()."\n";' } -phone="$1"; shift -set -- `echo "$@" | perl -e 'use URI::Escape; print lc(uri_unescape());' | sed -e 's/\+/ /g'` +phone=`uriunescape "$1" | sed -e 's/\+/ /g'`; shift +set -- `uriunescape "$@" | sed -e 's/\+/ /g'` app=`simpleword "$1"`; shift case "$app" in -- cgit v1.2.3