File: mkindex

package info (click to toggle)
wims 2%3A4.29a%2Bdfsg1-3
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 185,704 kB
  • sloc: xml: 366,687; javascript: 120,570; ansic: 62,341; java: 62,170; sh: 7,744; perl: 3,937; yacc: 3,217; cpp: 1,915; lex: 1,805; makefile: 1,084; lisp: 914; pascal: 601; python: 520; php: 318; asm: 7
file content (52 lines) | stat: -rwxr-xr-x 1,363 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#! /bin/sh

LL="env LC_ALL=C LC_CTYPE=C LANG=C"
if [ ! -d def ]; then exit; fi
if [ -f "INDEX" ]; then
  transl_lang=`grep -a translation_language INDEX | awk -F= '{print $2}'`;
  module_lang=`grep -aw language INDEX | awk -F= '{print $2}'`;
fi
rm -f Exindex Extitles >/dev/null
cd def
list=`ls *.def 2>/dev/null | sed 's/\.def//g'`
cd ..

if [ -z "$list" ]; then exit; fi
titlist=
for lang in $transl_lang $module_lang ; do
  rm -f Extitles_$lang;
done
for i in $list
do
  tit=`awk -F= 'NF>=2 {print $2; exit}' lang/$i.$module_lang | $LL tr ',\11' '; '`
  echo "$i:$tit" >>Extitles
  titlist="$titlist$tit
"
done

echo "$titlist" >tmp1
echo "$list" >tmp2
llist=`$LL paste tmp1 tmp2 | $LL sort -t '	' -f -k 1,1`
list1=`echo "$llist" | $LL awk -F'\11' 'length()>2 {print $2}' | $LL tr '\n' ' '`
list=`echo "$llist" | $LL awk -F'\11' 'length()>2 {print $2}' | $LL tr '\n' ','`
titlist=`echo "$llist" | $LL awk -F'\11' 'length()>2 {print $1}' | $LL tr '\n' ','`

cat >Exindex <<@
!set exolist  =!char 1 to -2 of $list
!set exototal =!itemcnt \$exolist
@

for lang in $transl_lang $module_lang ; do
  titlist=""
  for i in $list1
  do
    titl=`grep -a "title" lang/$i.$lang | awk -F= '{print $2}'`;
    echo "$i:$titl" >>"Extitles_$lang";
    titlist="$titlist$titl,"
  done
  cat >>Exindex <<@
!set titlelist_$lang=!char 1 to -2 of $titlist
@
done

rm -f tmp1 tmp2