File: modul

package info (click to toggle)
magyarispell 1.2%2Brepack-2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 4,952 kB
  • sloc: sh: 1,032; awk: 404; makefile: 265; sed: 153; lisp: 102
file content (153 lines) | stat: -rw-r--r-- 2,616 bytes parent folder | download | duplicates (4)
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
#!/bin/sh
# modul
# modulvlasztsi men a Magyar Ispellhez
# module selection menu for Magyar Ispell
#
#	Version 1.2 (2002.11.22.)
#	Version 1.1 (2002.09.06.) 
#	Version 1.0 (2002.07.30.) 
#
#	(c) Copyright 2002 Lszl Nmeth, All Rights Reserved
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the BSD License (see http://www.opensource.org)
#
# $1: a sztr helye / dictionary location
export LC_ALL=C

if [ "$1" = "" ]; then
	echo "A sztr helynek megadsa ktelez (pl. ./szotar)"
	exit 1
fi

. ./config

cd $1 || exit 1


# functions
nevelo() {
	case $1 in
	[aeiou]*)
		echo az
		;;
	*)
		echo a
		;;
	esac
}

capitalize() {
	A=`echo $1 | sed 's/^\(.\).*/\1/' | tr [:lower:] [:upper:]`
	B=`echo $1 | sed 's/^.\(.*\)/\1/'`
	echo $A$B
}

makemenu() {
	for i in _*; do 
		name=`echo $i | sed 's/^.//'`
		if [ -d `capitalize $name` ]; then
			echo_n "==>$name "
		else
			echo_n "$name "
		fi
	done
}

if [ "$2" = "uj" ]; then
	echo_n "j modulknyvtr neve (kezd alhzsjel nlkl): _"
	read D

	if [ "$D" = "" ]; then
		exit 0
	fi

	mkdir "_$D"

	if [ $? -ne 0 ]; then
		echo "==> A knyvtr ltrehozsa nem sikerlt."
		exit 1
	fi

	for i in `ls alap.modul/* | grep -v "\."` ; do
		grep "^#" $i >"_$D/`basename $i`"
		echo_n .
	done

	ln -s -f _$D `capitalize $D`
	echo " Rendben."
	exit
fi


CANCEL="mgsem: kilps - exit"
OK="ksz: sztrkszts (make all)"
HELP="segtsg - help"
DESC="modulok lersa - about modules"
TITLE1=" A nyllal jellt modulok kerlnek be a sztrba."
TITLE2=" Vltoztatni a megfelel modul szmnak megadsval lehet."

# start of script

# example -> Example
LC_SAVE=$LC_ALL
LC_ALL="C"
export LC_ALL

clear
echo
echo "<<<< Magyar Ispell helyesrsi sztr moduljainak kivlasztsa >>>>"

while true; do
	echo
	echo "$TITLE1"
	echo "$TITLE2"
	echo
	select i in "$CANCEL" "$OK" "$HELP" "$DESC" `makemenu`; do
	case $i in
	==\>*)
		dirname=`echo $i | sed 's/^==>//'`
		echo "Kikapcsolom `nevelo $dirname` \"$dirname\" modult..."
		rm -f `capitalize $dirname`
		if [ $? -ne 0 ]; then
			echo Nem sikerlt.
		else
			echo Ksz.
		fi
		break
		;;
	"$CANCEL")
		# ez micsoda?
		LC_ALL=$LC_SAVE
		export LC_ALL
		exit 1
		;;
	"$OK") # kilp
		LC_ALL=$LC_SAVE
		export LC_ALL
		exit 0
		;;
	"$HELP")
		echo $TITLE1
		echo $TITLE2
		;;
	"$DESC")
		more _*/LEIRAS.txt
		;;
	*)
		if [ "$i" != "" ]; then
			echo "Bekapcsolom `nevelo $i` \"$i\" modult..."
			ln -s -f _$i `capitalize $i`
			if [ $? -ne 0 ]; then
				echo Nem sikerlt.
			else
				echo Ksz.
			fi
		else
			echo "Nincs ilyen menpont."
		fi
		break
		;;
	esac
done
done