Compare commits
12 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
051cac53ff | ||
|
9eb8cf8b45 | ||
|
c74bca4632 | ||
|
a587b98d60 | ||
|
f197286adf | ||
|
674b3188a8 | ||
|
40c2f63c88 | ||
|
8a2da05adb | ||
|
44917d8329 | ||
|
90568d8b51 | ||
|
0e0f6268fa | ||
|
bb9d9edb26 |
0
.cvsignore → .gitignore
vendored
0
.cvsignore → .gitignore
vendored
21
Makefile
21
Makefile
@ -1,21 +0,0 @@
|
||||
# Makefile for source rpm: less
|
||||
# $Id: Makefile,v 1.2 2007/10/15 18:57:09 notting Exp $
|
||||
NAME := less
|
||||
SPECFILE = $(firstword $(wildcard *.spec))
|
||||
|
||||
define find-makefile-common
|
||||
for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$d/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done
|
||||
endef
|
||||
|
||||
MAKEFILE_COMMON := $(shell $(find-makefile-common))
|
||||
|
||||
ifeq ($(MAKEFILE_COMMON),)
|
||||
# attempt a checkout
|
||||
define checkout-makefile-common
|
||||
test -f CVS/Root && { cvs -Q -d $$(cat CVS/Root) checkout common && echo "common/Makefile.common" ; } || { echo "ERROR: I can't figure out how to checkout the 'common' module." ; exit -1 ; } >&2
|
||||
endef
|
||||
|
||||
MAKEFILE_COMMON := $(shell $(checkout-makefile-common))
|
||||
endif
|
||||
|
||||
include $(MAKEFILE_COMMON)
|
87
less-436-empty-lessopen-pipe.patch
Normal file
87
less-436-empty-lessopen-pipe.patch
Normal file
@ -0,0 +1,87 @@
|
||||
diff -rup less-436-orig/filename.c less-436/filename.c
|
||||
--- less-436-orig/filename.c 2009-07-06 22:52:23.000000000 +0200
|
||||
+++ less-436/filename.c 2011-02-09 16:36:59.508940154 +0100
|
||||
@@ -843,6 +843,16 @@ open_altfile(filename, pf, pfd)
|
||||
#else
|
||||
lessopen++;
|
||||
returnfd = 1;
|
||||
+
|
||||
+ if (*lessopen == '|') {
|
||||
+ /*
|
||||
+ * If there is another vertical bar |, after
|
||||
+ * the first one, it indicates a "pipe preprocessor"
|
||||
+ * with correct exit status.
|
||||
+ */
|
||||
+ lessopen++;
|
||||
+ returnfd = 2;
|
||||
+ }
|
||||
#endif
|
||||
}
|
||||
if (*lessopen == '-') {
|
||||
@@ -879,17 +888,32 @@ open_altfile(filename, pf, pfd)
|
||||
*/
|
||||
f = fileno(fd);
|
||||
SET_BINARY(f);
|
||||
+ *pfd = (void *) fd;
|
||||
+ *pf = f;
|
||||
if (read(f, &c, 1) != 1)
|
||||
{
|
||||
/*
|
||||
- * Pipe is empty. This means there is no alt file.
|
||||
+ * Error or pipe is empty. Close it and eventually
|
||||
+ * check exit status of the pipe process.
|
||||
*/
|
||||
- pclose(fd);
|
||||
+ if (pclose(fd) == 0 && returnfd == 2) {
|
||||
+ /*
|
||||
+ * Exit status was zero, so the EOF was correct
|
||||
+ * empty output. Let the program open /dev/null
|
||||
+ * instead, as the pipe is already closed.
|
||||
+ * Set force_open to omit bad_file() check
|
||||
+ * failure, as it is special 'c' pseudo-device.
|
||||
+ */
|
||||
+ *pf = 0;
|
||||
+ *pfd = NULL;
|
||||
+ force_open = 1;
|
||||
+ return (save("/dev/null"));
|
||||
+ }
|
||||
+ *pf = 0;
|
||||
+ *pfd = NULL;
|
||||
return (NULL);
|
||||
}
|
||||
ch_ungetchar(c);
|
||||
- *pfd = (void *) fd;
|
||||
- *pf = f;
|
||||
return (save("-"));
|
||||
}
|
||||
#endif
|
||||
diff -rup less-436-orig/less.nro less-436/less.nro
|
||||
--- less-436-orig/less.nro 2011-02-09 16:00:12.520936431 +0100
|
||||
+++ less-436/less.nro 2011-02-09 16:30:33.161235986 +0100
|
||||
@@ -1147,11 +1147,26 @@ lesspipe.sh:
|
||||
.br
|
||||
;;
|
||||
.br
|
||||
+ *) exit 1
|
||||
+.br
|
||||
+ ;;
|
||||
+.br
|
||||
esac
|
||||
.br
|
||||
+ exit $?
|
||||
+.br
|
||||
.PP
|
||||
To use this script, put it where it can be executed and set
|
||||
LESSOPEN="|lesspipe.sh %s".
|
||||
+.PP
|
||||
+The script should return zero if the output was valid and non-zero
|
||||
+otherwise, so less could detect even a valid empty output
|
||||
+(for example while uncompressing gzipped empty file).
|
||||
+For backward-compatibility, this is not required by default. To turn
|
||||
+this functionality there should be another vertical bar (|) straight
|
||||
+after the first one in the LESSOPEN environment variable, eg.
|
||||
+LESSOPEN="||lesspipe.sh %s".
|
||||
+.PP
|
||||
When an input pipe is used, a LESSCLOSE postprocessor can be used,
|
||||
but it is usually not necessary since there is no replacement file
|
||||
to clean up.
|
50
less-436-help.patch
Normal file
50
less-436-help.patch
Normal file
@ -0,0 +1,50 @@
|
||||
diff --git a/help.c b/help.c
|
||||
index 531aa16..0de6f0f 100644
|
||||
--- a/help.c
|
||||
+++ b/help.c
|
||||
@@ -119,7 +119,7 @@ constant char helpdata[] = {
|
||||
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','N','u','m','b','e','r',' ','o','f',' ','b','u','f','f','e','r','s','.','\n',
|
||||
' ',' ','-','B',' ',' ','.','.','.','.','.','.','.','.',' ',' ','-','-','a','u','t','o','-','b','u','f','f','e','r','s','\n',
|
||||
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','D','o','n','\'','t',' ','a','u','t','o','m','a','t','i','c','a','l','l','y',' ','a','l','l','o','c','a','t','e',' ','b','u','f','f','e','r','s',' ','f','o','r',' ','p','i','p','e','s','.','\n',
|
||||
-' ',' ','-','c',' ',' ','.','.','.','.','.','.','.','.',' ',' ','-','-','c','l','e','a','r','-','s','c','r','e','e','n','\n',
|
||||
+' ',' ','-','c',' ',' ','-','C',' ',' ','.','.','.','.',' ',' ','-','-','c','l','e','a','r','-','s','c','r','e','e','n',' ','-','-','C','L','E','A','R','-','S','C','R','E','E','N','\n',
|
||||
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','R','e','p','a','i','n','t',' ','b','y',' ','c','l','e','a','r','i','n','g',' ','r','a','t','h','e','r',' ','t','h','a','n',' ','s','c','r','o','l','l','i','n','g','.','\n',
|
||||
' ',' ','-','d',' ',' ','.','.','.','.','.','.','.','.',' ',' ','-','-','d','u','m','b','\n',
|
||||
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','D','u','m','b',' ','t','e','r','m','i','n','a','l','.','\n',
|
||||
@@ -151,8 +151,10 @@ constant char helpdata[] = {
|
||||
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','I','g','n','o','r','e',' ','t','h','e',' ','L','E','S','S','O','P','E','N',' ','e','n','v','i','r','o','n','m','e','n','t',' ','v','a','r','i','a','b','l','e','.','\n',
|
||||
' ',' ','-','m',' ',' ','-','M',' ',' ','.','.','.','.',' ',' ','-','-','l','o','n','g','-','p','r','o','m','p','t',' ',' ','-','-','L','O','N','G','-','P','R','O','M','P','T','\n',
|
||||
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','S','e','t',' ','p','r','o','m','p','t',' ','s','t','y','l','e','.','\n',
|
||||
-' ',' ','-','n',' ',' ','-','N',' ',' ','.','.','.','.',' ',' ','-','-','l','i','n','e','-','n','u','m','b','e','r','s',' ',' ','-','-','L','I','N','E','-','N','U','M','B','E','R','S','\n',
|
||||
+' ',' ','-','n',' ',' ','.','.','.','.','.','.','.','.',' ',' ','-','-','l','i','n','e','-','n','u','m','b','e','r','s','\n',
|
||||
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','D','o','n','\'','t',' ','u','s','e',' ','l','i','n','e',' ','n','u','m','b','e','r','s','.','\n',
|
||||
+' ',' ','-','N',' ',' ','.','.','.','.','.','.','.','.',' ',' ','-','-','L','I','N','E','-','N','U','M','B','E','R','S','\n',
|
||||
+' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','U','s','e',' ','l','i','n','e',' ','n','u','m','b','e','r','s','.','\n',
|
||||
' ',' ','-','o',' ','[','_','\b','f','_','\b','i','_','\b','l','_','\b','e',']',' ',' ','.',' ',' ','-','-','l','o','g','-','f','i','l','e','=','[','_','\b','f','_','\b','i','_','\b','l','_','\b','e',']','\n',
|
||||
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','C','o','p','y',' ','t','o',' ','l','o','g',' ','f','i','l','e',' ','(','s','t','a','n','d','a','r','d',' ','i','n','p','u','t',' ','o','n','l','y',')','.','\n',
|
||||
' ',' ','-','O',' ','[','_','\b','f','_','\b','i','_','\b','l','_','\b','e',']',' ',' ','.',' ',' ','-','-','L','O','G','-','F','I','L','E','=','[','_','\b','f','_','\b','i','_','\b','l','_','\b','e',']','\n',
|
||||
diff --git a/less.hlp b/less.hlp
|
||||
index 15ece5a..186e409 100644
|
||||
--- a/less.hlp
|
||||
+++ b/less.hlp
|
||||
@@ -116,7 +116,7 @@
|
||||
Number of buffers.
|
||||
-B ........ --auto-buffers
|
||||
Don't automatically allocate buffers for pipes.
|
||||
- -c ........ --clear-screen
|
||||
+ -c -C .... --clear-screen --CLEAR-SCREEN
|
||||
Repaint by clearing rather than scrolling.
|
||||
-d ........ --dumb
|
||||
Dumb terminal.
|
||||
@@ -148,8 +148,10 @@
|
||||
Ignore the LESSOPEN environment variable.
|
||||
-m -M .... --long-prompt --LONG-PROMPT
|
||||
Set prompt style.
|
||||
- -n -N .... --line-numbers --LINE-NUMBERS
|
||||
+ -n ........ --line-numbers
|
||||
Don't use line numbers.
|
||||
+ -N ........ --LINE-NUMBERS
|
||||
+ Use line numbers.
|
||||
-o [_f_i_l_e] . --log-file=[_f_i_l_e]
|
||||
Copy to log file (standard input only).
|
||||
-O [_f_i_l_e] . --LOG-FILE=[_f_i_l_e]
|
13
less-436-manpage-add-old-bot-option.patch
Normal file
13
less-436-manpage-add-old-bot-option.patch
Normal file
@ -0,0 +1,13 @@
|
||||
--- less-436/less.nro.old-bot 2010-01-05 15:20:00.690985900 +0100
|
||||
+++ less-436/less.nro 2010-01-05 15:16:30.500112556 +0100
|
||||
@@ -555,6 +555,10 @@ This can cause
|
||||
to run somewhat faster than the default.
|
||||
.IP "\-G or \-\-HILITE-SEARCH"
|
||||
The \-G option suppresses all highlighting of strings found by search commands.
|
||||
+.IP "\-\-old-bot"
|
||||
+Reverts to the old bottom of screen behavior. This can be sometimes
|
||||
+desirable if the long lines are not wrapped correctly
|
||||
+when reaching the bottom of the terminal, while scrolling forward.
|
||||
.IP "\-h\fIn\fP or \-\-max-back-scroll=\fIn\fP"
|
||||
Specifies a maximum number of lines to scroll backward.
|
||||
If it is necessary to scroll backward more than \fIn\fP lines,
|
2
less.csh
2
less.csh
@ -1,4 +1,4 @@
|
||||
# less initialization script (csh)
|
||||
if ( -x /usr/bin/lesspipe.sh ) then
|
||||
setenv LESSOPEN "|/usr/bin/lesspipe.sh %s"
|
||||
setenv LESSOPEN "||/usr/bin/lesspipe.sh %s"
|
||||
endif
|
||||
|
2
less.sh
2
less.sh
@ -1,2 +1,2 @@
|
||||
# less initialization script (sh)
|
||||
[ -x /usr/bin/lesspipe.sh ] && export LESSOPEN="|/usr/bin/lesspipe.sh %s"
|
||||
[ -x /usr/bin/lesspipe.sh ] && export LESSOPEN="||/usr/bin/lesspipe.sh %s"
|
||||
|
46
less.spec
46
less.spec
@ -1,7 +1,7 @@
|
||||
Summary: A text file browser similar to more, but better
|
||||
Name: less
|
||||
Version: 436
|
||||
Release: 5%{?dist}
|
||||
Release: 10%{?dist}
|
||||
License: GPLv3+
|
||||
Group: Applications/Text
|
||||
Source: http://www.greenwoodsoftware.com/less/%{name}-%{version}.tar.gz
|
||||
@ -11,9 +11,12 @@ Source3: less.csh
|
||||
Patch1: less-406-Foption.patch
|
||||
Patch4: less-394-time.patch
|
||||
Patch5: less-418-fsync.patch
|
||||
Patch6: less-436-manpage.patch
|
||||
Patch6: less-436-manpage-add-old-bot-option.patch
|
||||
Patch7: less-436-manpage-del-extra-line.patch
|
||||
Patch8: less-436-help.patch
|
||||
Patch9: less-436-empty-lessopen-pipe.patch
|
||||
URL: http://www.greenwoodsoftware.com/less/
|
||||
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
BuildRequires: ncurses-devel
|
||||
BuildRequires: pcre-devel
|
||||
BuildRequires: autoconf automake libtool
|
||||
@ -23,7 +26,7 @@ The less utility is a text file browser that resembles more, but has
|
||||
more capabilities. Less allows you to move backwards in the file as
|
||||
well as forwards. Since less doesn't have to read the entire input file
|
||||
before it starts, less starts up more quickly than text editors (for
|
||||
example, vi).
|
||||
example, vi).
|
||||
|
||||
You should install less because it is a basic utility for viewing text
|
||||
files, and you'll use it frequently.
|
||||
@ -33,7 +36,10 @@ files, and you'll use it frequently.
|
||||
%patch1 -p1 -b .Foption
|
||||
%patch4 -p1 -b .time
|
||||
%patch5 -p1 -b .fsync
|
||||
%patch6 -p1 -b .manpage
|
||||
%patch6 -p1 -b .manpage-add-old-bot-option
|
||||
%patch7 -p1 -b .manpage-del-extra-line
|
||||
%patch8 -p1 -b .help
|
||||
%patch9 -p1 -b .empty-lessopen-pipe
|
||||
|
||||
autoreconf
|
||||
|
||||
@ -65,6 +71,36 @@ ls -la $RPM_BUILD_ROOT/etc/profile.d
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
%changelog
|
||||
* Wed Apr 13 2011 Vojtech Vitek (V-Teq) <vvitek@redhat.com> - 436-10
|
||||
- Don't convert files with UTF-16/UTF-32 string in filename
|
||||
Resolve: #638312
|
||||
|
||||
* Tue Feb 15 2011 Vojtech Vitek (V-Teq) <vvitek@redhat.com> - 436-9
|
||||
- Clean lesspipe.sh script
|
||||
- Split case for compressed and plain troff files
|
||||
- Add support for *.xz and *.lzma man pages
|
||||
Resolves: #676057
|
||||
- Add support for reading UTF-16 and UTF-32 files
|
||||
Resolves: #638312
|
||||
- Don't require correct exit status from LESSOPEN scripts until
|
||||
it gets accepted by upstream (preserve backward compatibility)
|
||||
Resolves: #666084, #676057
|
||||
|
||||
* Mon Jan 03 2011 Vojtech Vitek (V-Teq) <vvitek@redhat.com> - 436-8
|
||||
- Fix regression in lesspipe.sh script (*.gz files etc.)
|
||||
Resolves: #615303 (comment #9)
|
||||
|
||||
* Thu Dec 23 2010 Vojtech Vitek (V-Teq) <vvitek@redhat.com> - 436-7
|
||||
- Fix for valid empty LESSOPEN pipe output
|
||||
Resolves: #579251, #615303
|
||||
- The new "--old-bot" option is not documented in the man page
|
||||
Resolves: #510724
|
||||
- Fix descriptions of some options in online help
|
||||
Resolves: #578289 (Jeff Bastian <jbastian@redhat.com>)[IT603793]
|
||||
|
||||
* Wed Jan 20 2010 Nikola Pajkovsky <npajkovs@redhat.com> - 436-6
|
||||
- RFE: lesspipe.sh could use a support for *.xz file
|
||||
|
||||
* Mon Jan 4 2010 Nikola Pajkovsky <npajkovs@redhat.com> - 436-5
|
||||
- patched wrong manpage. Resolves: #537746.
|
||||
|
||||
|
116
lesspipe.sh
116
lesspipe.sh
@ -2,55 +2,75 @@
|
||||
#
|
||||
# To use this filter with less, define LESSOPEN:
|
||||
# export LESSOPEN="|/usr/bin/lesspipe.sh %s"
|
||||
#
|
||||
# The script should return zero if the output was valid and non-zero
|
||||
# otherwise, so less could detect even a valid empty output
|
||||
# (for example while uncompressing gzipped empty file).
|
||||
# For backward-compatibility, this is not required by default. To turn
|
||||
# this functionality there should be another vertical bar (|) straight
|
||||
# after the first one in the LESSOPEN environment variable:
|
||||
# export LESSOPEN="||/usr/bin/lesspipe.sh %s"
|
||||
|
||||
lesspipe() {
|
||||
case "$1" in
|
||||
*.[1-9n]|*.man|*.[1-9n].bz2|*.man.bz2|*.[1-9].gz|*.[1-9]x.gz|*.[1-9].man.gz)
|
||||
case "$1" in
|
||||
*.gz) DECOMPRESSOR="gunzip -c" ;;
|
||||
*.bz2) DECOMPRESSOR="bunzip2 -c" ;;
|
||||
*) DECOMPRESSOR="cat" ;;
|
||||
esac
|
||||
if $DECOMPRESSOR -- "$1" | file - | grep -q troff; then
|
||||
if echo "$1" | grep -q ^/; then #absolute path
|
||||
man -- "$1" | cat -s
|
||||
else
|
||||
man -- "./$1" | cat -s
|
||||
fi
|
||||
else
|
||||
$DECOMPRESSOR -- "$1"
|
||||
fi ;;
|
||||
*.tar) tar tvvf "$1" ;;
|
||||
*.tgz|*.tar.gz|*.tar.[zZ]) tar tzvvf "$1" ;;
|
||||
*.tar.bz2|*.tbz2) bzip2 -dc -- "$1" | tar tvvf - ;;
|
||||
*.[zZ]|*.gz) gzip -dc -- "$1" ;;
|
||||
*.bz2) bzip2 -dc -- "$1" ;;
|
||||
*.lzma) lzma -c -d -- "$1" ;;
|
||||
*.zip|*.jar|*.nbm) zipinfo -- "$1" ;;
|
||||
*.rpm) rpm -qpivl --changelog -- "$1" ;;
|
||||
*.cpi|*.cpio) cpio -itv < "$1" ;;
|
||||
*.gif|*.jpeg|*.jpg|*.pcd|*.png|*.tga|*.tiff|*.tif)
|
||||
if [ -x /usr/bin/identify ]; then
|
||||
identify "$1"
|
||||
elif [ -x /usr/bin/gm ]; then
|
||||
gm identify "$1"
|
||||
else
|
||||
echo "No identify available"
|
||||
echo "Install ImageMagick or GraphicsMagick to browse images"
|
||||
fi ;;
|
||||
*)
|
||||
case "$1" in
|
||||
*.gz) DECOMPRESSOR="gunzip -c" ;;
|
||||
*.bz2) DECOMPRESSOR="bunzip2 -c" ;;
|
||||
esac
|
||||
if [ ! -z $DECOMPRESSOR ] ; then
|
||||
$DECOMPRESSOR -- "$1" ;
|
||||
fi
|
||||
esac
|
||||
}
|
||||
if [ ! -e "$1" ] ; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -d "$1" ] ; then
|
||||
/bin/ls -alF -- "$1"
|
||||
else
|
||||
lesspipe "$1" 2> /dev/null
|
||||
ls -alF -- "$1"
|
||||
exit $?
|
||||
fi
|
||||
|
||||
exec 2>/dev/null
|
||||
|
||||
case "$1" in
|
||||
*.[1-9n].bz2|*.[1-9]x.bz2|*.man.bz2|*.[1-9n].[gx]z|*.[1-9]x.[gx]z|*.man.[gx]z|*.[1-9n].lzma|*.[1-9]x.lzma|*.man.lzma)
|
||||
case "$1" in
|
||||
*.gz) DECOMPRESSOR="gzip -dc" ;;
|
||||
*.bz2) DECOMPRESSOR="bzip2 -dc" ;;
|
||||
*.xz|*.lzma) DECOMPRESSOR="xz -dc" ;;
|
||||
esac
|
||||
if [ -n "$DECOMPRESSOR" ] && $DECOMPRESSOR -- "$1" | file - | grep -q troff; then
|
||||
$DECOMPRESSOR -- "$1" | man -l - | cat -s
|
||||
exit $?
|
||||
fi ;;&
|
||||
*.[1-9n]|*.[1-9]x|*.man)
|
||||
if file "$1" | grep -q troff; then
|
||||
man -l "$1" | cat -s
|
||||
exit $?
|
||||
fi ;;&
|
||||
*.tar) tar tvvf "$1" ;;
|
||||
*.tgz|*.tar.gz|*.tar.[zZ]) tar tzvvf "$1" ;;
|
||||
*.tar.xz) tar Jtvvf "$1" ;;
|
||||
*.xz|*.lzma) xz -dc -- "$1" ;;
|
||||
*.tar.bz2|*.tbz2) bzip2 -dc -- "$1" | tar tvvf - ;;
|
||||
*.[zZ]|*.gz) gzip -dc -- "$1" ;;
|
||||
*.bz2) bzip2 -dc -- "$1" ;;
|
||||
*.zip|*.jar|*.nbm) zipinfo -- "$1" ;;
|
||||
*.rpm) rpm -qpivl --changelog -- "$1" ;;
|
||||
*.cpi|*.cpio) cpio -itv < "$1" ;;
|
||||
*.gif|*.jpeg|*.jpg|*.pcd|*.png|*.tga|*.tiff|*.tif)
|
||||
if [ -x /usr/bin/identify ]; then
|
||||
identify "$1"
|
||||
elif [ -x /usr/bin/gm ]; then
|
||||
gm identify "$1"
|
||||
else
|
||||
echo "No identify available"
|
||||
echo "Install ImageMagick or GraphicsMagick to browse images"
|
||||
exit 1
|
||||
fi ;;
|
||||
*)
|
||||
if [ -x /usr/bin/file -a -x /usr/bin/iconv -a -x /usr/bin/cut ]; then
|
||||
case `file -b "$1"` in
|
||||
*UTF-16*) conv='UTF-16' ;;
|
||||
*UTF-32*) conv='UTF-32' ;;
|
||||
esac
|
||||
env=`echo $LANG | cut -d. -f2`
|
||||
if [ -n "$conv" -a -n "$env" -a "$conv" != "$env" ]; then
|
||||
iconv -f $conv -t $env "$1"
|
||||
exit $?
|
||||
fi
|
||||
fi
|
||||
exit 1
|
||||
esac
|
||||
exit $?
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user