Sisyphus repositório
Última atualização: 1 outubro 2023 | SRPMs: 18631 | Visitas: 37852309
en ru br
ALT Linux repositórios
S:633-alt1
5.0: 424-alt3
4.1: 418-alt1
4.0: 394-alt1
3.0: 382-alt2

Group :: Ferramentas de Arquivo
RPM: less

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs e FR  Repocop 

#!/bin/sh -e

FILE="$1" && shift
CMD=
TYPE=`/usr/bin/file -bL -- "$FILE"`

TMPFILE="$(mktemp -t "lessfile.XXXXXXXXXX")"
exit_handler()
{
RETVAL=$?
trap '' EXIT
if [ -n "$TMPFILE" ]; then
[ $RETVAL -eq 0 ] && echo "$TMPFILE" || rm -f -- "$TMPFILE"
fi
exit $RETVAL
}

trap exit_handler SIGHUP SIGINT SIGQUIT SIGTERM EXIT

case $TYPE in
bzip\ compressed*|bzip2\ compressed*)
CMD='/bin/bzcat -q --'
;;
gzip\ compressed*)
CMD='/bin/zcat -q --'
;;
xz\ compressed*)
CMD='/bin/xzcat -q --'
;;
compress\'d\ data*)
CMD='/usr/bin/uncompress -c'
;;
esac

if [ -n "$CMD" ]; then
CMD2=
TYPE=`$CMD "$FILE" 2>/dev/null |/usr/bin/file -b -`
case $TYPE in
*tar\ archive*)
CMD2='/bin/tar -tvv'
;;
*cpio\ archive*)
CMD2='/bin/cpio -tv'
;;
ELF\ *|*\ ELF\ *)
CMD2='/usr/bin/readelf'
;;
Linux/i386*|MS-DOS\ executable*|MS-Windows*|Win95\ executable*)
CMD2='/usr/bin/strings'
;;
*troff\ or\ preprocessor\ input\ text*)
CMD2='/usr/bin/nroff -t -mandoc'
;;
esac
if [ -z "$CMD2" ]; then
$CMD "$FILE" >"$TMPFILE" 2>&1
else
$CMD "$FILE" >"$TMPFILE" 2>&1 |$CMD2 2>&1
fi
exit
fi

case $TYPE in
directory)
CMD='/usr/bin/stat'
;;
PNG\ image*|JPEG\ image*|GIF\ image*|TIFF\ image*|X\ pixmap\ image*|MS\ Windows\ icon*)
CMD='/usr/bin/identify'
;;
*tar\ archive*)
CMD='/bin/tar -tvf'
;;
*cpio\ archive*)
CMD='/bin/cpio -tv --quiet -I'
;;
Zip*)
CMD='/usr/bin/unzip -l -qq --'
;;
Zoo*)
CMD='/usr/bin/zoo xqp'
;;
ARC*)
CMD='/usr/bin/arc pn'
;;
LHa*)
CMD='/usr/bin/lha p'
;;
RAR*)
CMD='/usr/bin/unrar p'
;;
RPM\ v*)
CMD='/usr/bin/rpm -qilvp --lastchange --'
;;
current\ ar\ archive*)
CMD='/usr/bin/ar tv'
;;
ELF\ *|*\ ELF\ *)
CMD='/usr/bin/readelf -a --'
;;
Linux/i386*|MS-DOS\ executable*|MS-Windows*|Win95\ executable*)
CMD='/usr/bin/strings --'
;;
*troff\ or\ preprocessor\ input\ text*)
CMD='/usr/bin/nroff -t -mandoc --'
;;
esac

if [ -n "$CMD" ]; then
$CMD "$FILE" >"$TMPFILE" 2>&1
else
exit 1
fi
 
projeto & código: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
mantenedor atual: Michael Shigorin
mantenedor da tradução: Fernando Martini aka fmartini © 2009