diff --git a/less1 b/less1 deleted file mode 100755 index a3c1cef..0000000 --- a/less1 +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 - -iconv -f latin1 -t utf-8 "$@" | less -S -R -E diff --git a/lless b/lless new file mode 100755 index 0000000..5ea1cfb --- /dev/null +++ b/lless @@ -0,0 +1,31 @@ +#!/bin/bash +# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 +source "$(dirname "$0")/lib/ulib/auto" || exit 1 + +function display_help() { + uecho "$scriptname: frontend de less pour lire des fichiers encodés en latin1 + +USAGE + $scriptname [options] files... + +OPTIONS + -S, --chop-long-lines + -r, --raw-control-chars + -R, --RAW-CONTROL-CHARS + -e, --quit-at-eof + -E, --QUIT-AT-EOF + options de less qui sont reportées telles quelles" +} + +lessopts=() +args=( + --help '$exit_with display_help' + -S,--chop-long-lines '$lessopts+=(-S)' + -r,--raw-control-chars '$lessopts+=(-r)' + -R,--RAW-CONTROL-CHARS '$lessopts+=(-R)' + -e,--quit-at-eof '$lessopts+=(-e)' + -E,--QUIT-AT-EOF '$lessopts+=(-E)' +) +parse_args "$@"; set -- "${args[@]}" + +iconv -f latin1 -t utf-8 "$@" | less "${lessopts[@]}"