2023-07-10 16:05:07 +04:00
|
|
|
#!/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() {
|
2024-07-05 10:13:19 +04:00
|
|
|
uecho "$scriptname: frontend de less pour lire un fichier encodé en latin1
|
2023-07-10 16:05:07 +04:00
|
|
|
|
|
|
|
USAGE
|
2024-07-05 10:13:19 +04:00
|
|
|
$scriptname [options] FILE
|
2023-07-10 16:05:07 +04:00
|
|
|
|
|
|
|
OPTIONS
|
|
|
|
-S, --chop-long-lines
|
|
|
|
-r, --raw-control-chars
|
|
|
|
-R, --RAW-CONTROL-CHARS
|
|
|
|
-e, --quit-at-eof
|
|
|
|
-E, --QUIT-AT-EOF
|
2023-07-10 16:33:31 +04:00
|
|
|
options de less qui sont reprises telles quelles"
|
2023-07-10 16:05:07 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
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[@]}"
|