summaryrefslogtreecommitdiff
path: root/textproc/dict-server/patches/patch-dictl.in
blob: 3b2c04149e1e704805a021dc8b469f28b856e037 (plain)
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
$NetBSD: patch-dictl.in,v 1.1 2012/06/17 13:18:42 cheusov Exp $
# http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=677868
--- dictl.in.orig	2009-01-10 21:16:56.000000000 +0000
+++ dictl.in
@@ -59,11 +59,17 @@ echo apple |
 
 #####################################
 
+shquote (){
+    __cmd=`printf '%s\n' "$1" | sed "s|'|'\\\\\''|g"`
+    printf "%s\n" "'$__cmd'"
+}
+
 cmd='dict'
 while test $# -ne 0; do
-    cmd="$cmd '$1'"
+    cmd="$cmd "`shquote "$1"`
     shift
 done
-cmd=$(echo $cmd | charset2charset $DICTL_CHARSET $DICTL_SERVER_CHARSET)
 
-eval $cmd -P - | charset2charset $DICTL_SERVER_CHARSET $DICTL_CHARSET
+cmd=$(printf '%s\n' "$cmd" | charset2charset $DICTL_CHARSET $DICTL_SERVER_CHARSET)
+
+eval "$cmd" | charset2charset $DICTL_SERVER_CHARSET $DICTL_CHARSET