forked from gentoo/gentoo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
aview-1.3.0_rc1-filename-spaces.patch
53 lines (53 loc) · 1.36 KB
/
aview-1.3.0_rc1-filename-spaces.patch
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
diff -ur aview-1.3.0-orig/asciiview aview-1.3.0/asciiview
--- aview-1.3.0-orig/asciiview 2005-08-15 21:20:16.000000000 -0400
+++ aview-1.3.0/asciiview 2005-08-15 21:20:19.000000000 -0400
@@ -7,9 +7,9 @@
}
myconvert()
{
- if anytopnm $1 >/tmp/aview$$.pgm 2>/dev/null ; then
+ if anytopnm "$1" >/tmp/aview$$.pgm 2>/dev/null ; then
exit
- elif convert -colorspace gray $1 pgm:- 2>/dev/null ; then
+ elif convert -colorspace gray "$1" pgm:- 2>/dev/null ; then
exit
fi
echo "Failed to convert file format to PNM by both convert and anytopnm" >&2
@@ -44,8 +44,13 @@
options="$options $1"
shift
;;
- *)
- filenames="$filenames $1"
+ *)
+ if [ "$filenames" = "" ]
+ then
+ filenames=$1 #avoid leading null
+ else
+ filenames=$(echo -e "$filenames\000$1")
+ fi
shift
;;
esac
@@ -53,15 +58,16 @@
trap clear 0
mkfifo /tmp/aview$$.pgm
outfile=/tmp/aview$$.pgm
-for name in $filenames ; do
-if test -r $name ; then
-case $name in
+IFS=$(echo -e "\000")
+echo $filenames | while read name; do
+if test -r "$name" ; then
+case "$name" in
*.fli | *.lfc | *.flic )
PATH="$PATH:."
- aaflip $options $name
+ aaflip $options "$name"
;;
*)
- myconvert $name >/tmp/aview$$.pgm &
+ myconvert "$name" >/tmp/aview$$.pgm &
pid=$!
PATH="$PATH:."
aview $options /tmp/aview$$.pgm