1 |
Author: abcd |
2 |
Date: 2010-02-28 22:11:44 +0000 (Sun, 28 Feb 2010) |
3 |
New Revision: 767 |
4 |
|
5 |
Modified: |
6 |
trunk/extern/modules/oodict.eselect |
7 |
Log: |
8 |
add prefix support, cleanup some older code |
9 |
|
10 |
Modified: trunk/extern/modules/oodict.eselect |
11 |
=================================================================== |
12 |
--- trunk/extern/modules/oodict.eselect 2010-02-26 21:13:00 UTC (rev 766) |
13 |
+++ trunk/extern/modules/oodict.eselect 2010-02-28 22:11:44 UTC (rev 767) |
14 |
@@ -1,5 +1,5 @@ |
15 |
# -*-eselect-*- vim: ft=eselect |
16 |
-# Copyright 1999-2006 Gentoo Foundation |
17 |
+# Copyright 1999-2010 Gentoo Foundation |
18 |
# Distributed under the terms of the GNU General Public License v2 |
19 |
# $Id$ |
20 |
|
21 |
@@ -20,12 +20,12 @@ |
22 |
# Base directory where OpenOffice stores its dictionary information. |
23 |
# Default is non-multilib /usr/lib - if given, the --libdir option changes |
24 |
# this to the supplied library subdirectory name. |
25 |
-OOO_DICTBASE="/usr/lib/openoffice/share/dict/ooo" |
26 |
+OOO_DICTBASE="${EPREFIX}/usr/lib/openoffice/share/dict/ooo" |
27 |
OOO_DICTLIST="dictionary.lst" |
28 |
|
29 |
OODICT_CLASSES="myspell" |
30 |
|
31 |
-MYSPELL_BASE="/usr/share/myspell" |
32 |
+MYSPELL_BASE="${EPREFIX}/usr/share/myspell" |
33 |
|
34 |
# set array "fields" to the elements of $1, separated by $2. |
35 |
# This saves having to muck about with IFS all over the place. |
36 |
@@ -65,12 +65,12 @@ |
37 |
else |
38 |
count=0 |
39 |
for lang in $*; do |
40 |
- [[ ${count} == 0 ]] && printf " " |
41 |
+ ((count == 0)) && printf " " |
42 |
printf " %s" ${lang} |
43 |
- ((count = count+1)) |
44 |
- [[ ${count} == 22 ]] && printf "\n" && count=0 |
45 |
+ ((count++)) |
46 |
+ ((count == 22)) && printf "\n" && count=0 |
47 |
done |
48 |
- [[ ${count} == 0 ]] || printf "\n" |
49 |
+ ((count == 0)) || printf "\n" |
50 |
fi |
51 |
} |
52 |
|
53 |
@@ -124,13 +124,13 @@ |
54 |
# 2) Copy and consume (shift) parameters before calling this, otherwise it |
55 |
# considers extra parameters as potential options. |
56 |
oodict_process_options() { |
57 |
- while [[ -n $1 && "--" != ${1:0:2} ]]; do |
58 |
+ while [[ -n $1 && $1 != --* ]]; do |
59 |
shift |
60 |
done |
61 |
- while [[ "--" == ${1:0:2} ]]; do |
62 |
+ while [[ $1 == --* ]]; do |
63 |
if [[ "--libdir" == $1 ]]; then |
64 |
shift |
65 |
- OOO_DICTBASE="/usr/$1/openoffice/share/dict/ooo" |
66 |
+ OOO_DICTBASE="${EPREFIX}/usr/$1/openoffice/share/dict/ooo" |
67 |
libdir=$1 |
68 |
shift |
69 |
elif [[ "--" == $1 ]]; then |
70 |
@@ -168,7 +168,7 @@ |
71 |
direct_sources="" |
72 |
while read entry; do |
73 |
fields=(${entry}) |
74 |
- [[ ${fields[0]:0:1} == "#" ]] && continue |
75 |
+ [[ ${fields[0]::1} == "#" ]] && continue |
76 |
lang=${fields[1]} |
77 |
for suffix in $(oodict_get_myspell_suffixes ${fields[0]}); do |
78 |
if [[ -h ${OOO_DICTBASE}/${fields[3]}${suffix} ]]; then |
79 |
@@ -190,12 +190,12 @@ |
80 |
if [[ -n ${myspell_sources} ]]; then |
81 |
write_numbered_list_entry ${listn} "myspell" |
82 |
oodict_display_langs "Configured language codes from ${MYSPELL_BASE}" ${myspell_sources} |
83 |
- (( listn = ${listn} + 1 )) |
84 |
+ (( listn++ )) |
85 |
fi |
86 |
if [[ -n ${direct_sources} ]]; then |
87 |
write_numbered_list_entry ${listn} "direct" |
88 |
oodict_display_langs "Language codes installed directly in ${OOO_DICTBASE}" ${direct_sources} |
89 |
- (( listn = ${listn} + 1 )) |
90 |
+ (( listn++ )) |
91 |
fi |
92 |
# show none if no sources found |
93 |
[[ ${listn} == "1" ]] && echo " (none)" |
94 |
@@ -223,7 +223,7 @@ |
95 |
known_langs="${known_langs} ${dict/${MYSPELL_BASE}\/${OOO_DICTLIST}.}" |
96 |
done |
97 |
oodict_display_langs "Installed language codes" ${known_langs} |
98 |
- (( listn = ${listn} + 1 )) |
99 |
+ (( listn++ )) |
100 |
fi |
101 |
# show none if no sources found |
102 |
[[ ${listn} == "1" ]] && echo " (none)" |
103 |
@@ -265,8 +265,8 @@ |
104 |
if [[ -f ${MYSPELL_BASE}/${dictlst} ]]; then |
105 |
while read entry; do |
106 |
fields=(${entry}) |
107 |
- [[ ${fields[0]:0:1} == "#" ]] && continue |
108 |
- [[ ${fields[3]} == "" ]] && continue |
109 |
+ [[ ${fields[0]::1} == "#" ]] && continue |
110 |
+ [[ -z ${fields[3]} ]] && continue |
111 |
# Remove entry from dictionary.lst |
112 |
sed -i -e "/^${fields[0]} ${fields[1]} ${fields[2]} ${fields[3]}$/ { d }" \ |
113 |
${OOO_DICTBASE}/${OOO_DICTLIST} || |
114 |
@@ -363,7 +363,7 @@ |
115 |
do_unset ${dict} |
116 |
while read entry; do |
117 |
fields=(${entry}) |
118 |
- [[ ${fields[0]:0:1} == "#" ]] && continue |
119 |
+ [[ ${fields[0]::1} == "#" ]] && continue |
120 |
grep "^${fields[0]} ${fields[1]} ${fields[2]} ${fields[3]}$" \ |
121 |
${OOO_DICTBASE}/${OOO_DICTLIST} > /dev/null 2>&1 || |
122 |
echo "${entry}" >> ${OOO_DICTBASE}/${OOO_DICTLIST} |