Group :: Ferramentas de texto
RPM: i2myspell
Main Changelog Spec Patches Sources Download Gear Bugs e FR Repocop
Patch: i2myspell-1.4-alt-mktemp.patch
Download
Download
diff --git a/i2myspell b/i2myspell
index abeced3..0d60743 100644
--- a/i2myspell
+++ b/i2myspell
@@ -27,6 +27,8 @@ of ispell -d flag, because i2myspell use Ispell generated affix table.
esac
export LC_ALL=C # set correct sort, because sorting with hungarian locale is wrong
+temp1=`mktemp`
+temp2=`mktemp`
case $1 in
-d)
@@ -41,12 +43,12 @@ awk '{
if ($2!="") printf "/%s", $2;
}
}' | sed 's#/##g
-s# #/#' >/tmp/i2my$$.1
-cat /tmp/i2my$$.1 | wc -l | tr -cd '0-9\n'
-tail +2 /tmp/i2my$$.1
+s# #/#' > $temp1
+cat $temp1 | wc -l | tr -cd '0-9\n'
+tail -n +2 $temp1
echo
-rm -f /tmp/i2my$$.1
-
+rm -f $temp1
+rm -f $temp2
exit;;
esac
@@ -58,7 +60,7 @@ sed 's/ //g
/suffixes/,//s/flag\(.\):/SFX \1 N /
s/\([^ ]*\).>.\([^,]*\)$/0 \2 \1/
s/\([^ ]*\).>.-\([^,]*\),\(.*\)$/\2 \3 \1/' |
-tee /tmp/i2my$$.1 | cut -c -7 > /tmp/i2my$$.2
+tee $temp1 | cut -c -7 > $temp2
# myspell affix table header
echo "SET $2"
@@ -66,9 +68,8 @@ if [ -n "$5" ]; then echo "TRY $5"; fi;
if [ -n "$7" ]; then echo "COMPOUNDMIN $7"; fi;
if [ -n "$6" ]; then echo "COMPOUNDFLAG $6"; fi;
-cut -c 8- /tmp/i2my$$.1 |
-tr $3 $4 |
-paste -d "" /tmp/i2my$$.2 - |
+cut -c 8- $temp1 | tr $3 $4 |
+paste -d "" $temp2 - |
egrep -v '^(suffixes|prefixes|flagmarker)' |
sort -k 2 | awk '
NR==1 { o1=$1; o2=$2; o3=$3; n[o2]=-1; }
@@ -80,7 +81,8 @@ sort -k 2 | awk '
printf "%s %s %s %s\n", o1, o2, o3, n[o2]+1;
o1=$1; o2=$2; o3=$3;
}
-} END { printf "%s %s %s %s\n", o1, o2, o3, n[o2]+1; } ' | tee x |
+} END { printf "%s %s %s %s\n", o1, o2, o3, n[o2]+1; } ' |
sed 's/ *$//' | sort -r | sed 's/\(^.*[0-9]\)$/\
-\1/'
-rm /tmp/i2my$$.*
+\1/' | sed -r 's/ {2,}/ /g'
+rm -f $temp1
+rm -f $temp2