diff moefetch.sh @ 230:e922fb1e858f

- fixes on openssl output - no more features will be added
author edhoprima
date Tue, 09 Mar 2010 04:37:07 +0000
parents b03fef57b465
children 4c0fd276665e
line wrap: on
line diff
--- a/moefetch.sh	Sun Dec 27 19:18:02 2009 +0000
+++ b/moefetch.sh	Tue Mar 09 04:37:07 2010 +0000
@@ -63,7 +63,7 @@
 }
 
 # Checks md5. OpenSSL should be available on anything usable.
-get_md5() { cat "$(safe_path "${1}")" | openssl dgst -md5; }
+get_md5() { cat "$(safe_path "${1}")" | openssl dgst -md5 | tail -n 1 | sed -e 's/.*\([[:xdigit:]]\{32\}\).*/\1/'; }
 
 # Safely get basename.
 get_basename() { basename "$(safe_path "${1}")"; }
@@ -138,7 +138,7 @@
 </xsl:stylesheet>
 EOF
 		__tempnum=$(echo $(wc -l < "${TEMP_PREFIX}-templist"))
-		__iternum=$((${__iternum} + 1))
+		__iternum=$((__iternum + 1))
 		cat "${TEMP_PREFIX}-templist" >> "${TEMP_PREFIX}-list"
 		echo "${__tempnum} file(s) available"
 	done
@@ -170,10 +170,10 @@
 	numfiles=0
 	for dircontent in "${*}/"* "${*}/".*; do 
 		if [ "${dircontent}" != "${*}/*" ] || [ -e "${dircontent}" ]; then 
-			numfiles=$((${numfiles} + 1))
+			numfiles=$((numfiles + 1))
 		fi
 	done
-	echo $((${numfiles} - 2))
+	echo $((numfiles - 2))
 }
 
 # check tools availability
@@ -341,10 +341,10 @@
 		;;
 	esac
 	shift
+	SITE=
+	TAGS=
 	__has_pass=0
 	__has_user=0
-	#copypasta from http://mywiki.wooledge.org/BashFAQ/035
-	__optnum=1
 	while getopts "s:(site)n(noclean)u:(user)p:(password)" opt
 	do
 		case "$opt" in
@@ -359,9 +359,7 @@
 				__has_user=1
 			;;
 		esac
-		__optnum="${OPTIND}"
 	done
-	shift $((${__optnum}-1))
 	TAGS="$@"
 	[ -n "${SITE}" ] || SITE=${DEFAULT_SITE}
 	[ -n "${TAGS}" ] || Err_Fatal "No tag specified"
@@ -382,11 +380,8 @@
 # global variables goes here
 init_globals()
 {
-	cd . # Reset ${PWD}
-	_version="0.3-beta3"	# version of this script
+	_version="0.3-rc1"	# version of this script
 	_use_login=0	# variable to check whether a login is used or not
-	SITE=
-	TAGS=
 }
 
 main()