Fix endianess in shell_get (#4294)
authorFlorian Fainelli <florian@openwrt.org>
Sun, 15 Mar 2009 12:33:26 +0000 (12:33 +0000)
committerFlorian Fainelli <florian@openwrt.org>
Sun, 15 Mar 2009 12:33:26 +0000 (12:33 +0000)
SVN-Revision: 14883

net/ddns-scripts/Makefile
net/ddns-scripts/files/usr/lib/ddns/shell_get.sh

index f8e6946..539887b 100644 (file)
@@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=ddns-scripts
 PKG_VERSION:=1.0.0
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
 
index 8762617..ec9fc0c 100755 (executable)
@@ -33,7 +33,7 @@ encode_base64()
 {
        original_str=$1
        
-       hex_str=$( echo -n "$original_str" | hexdump -v | awk '{ for ( i = 2; i <= NF; i++ ) {  h1=substr($i, 3, 2); h2=substr($i,0,2); printf("%s%s", h1, h2); }}' | awk ' { $0~gsub(/00$/, "") };{ i=1; while(i <= length($0) ){ block= substr($0, i, 3); printf("%s ", block); i=i+3;  }}' | awk ' {$0~gsub(/ $/, "")}; { print $0 }' )
+       hex_str=$( echo -n "$original_str" | hexdump -v -e '1/1 "%02x"' | awk ' { $0~gsub(/00$/, "") };{ i=1; while(i <= length($0) ){ block= substr($0, i, 3); printf("%s ", block); i=i+3;  }}' | awk ' {$0~gsub(/ $/, "")}; { print $0 }' )
 
        length=$(echo $hex_str | awk  '{$0~gsub(/ /, "")}; { print length($0) }')
        remainder=$(($length % 3 ))