lynx-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Lynx-dev] Disabling timeout


From: Steffen Nurpmeso
Subject: Re: [Lynx-dev] Disabling timeout
Date: Thu, 29 Aug 2024 15:57:35 +0200
User-agent: s-nail v14.9.25-599-g5c75a327b2

Hello.

Bela Lubkin wrote in
 <202408281939.aa07673@deepthought.armory.com>:
 |Steffen Nurpmeso <steffen@sdaoden.eu>
 |> Can anybody tell me how i can disable timeouts?
 |> I do have
 |>
 |>   NO_PAUSE=on
 |>   no_pause=on
 |>   infosecs=0.25
 |>   messagesecs=0.25
 |>   alertsecs=0.25
 |>
 |> in my ~/.lynxrc, and (reformatted by bash):
 |>
 |>   translate ()
 |>   {
 |>       ( [ $# -le 1 ] || {
 |>           echo 'Synopsis: translate WORD' 1>&2;
 |>           exit 1
 |>};
 |>       i=lynx;
 |>       command -v lynx-redux > /dev/null 2>&1 && i=lynx-redux;
 |>       exec $i https://m.dict.cc/deen/?s="$*"; )
 |>}
 |>
 |> and if i say say "translate hochsommer" (german) then i get three
 |> or four message displays in the footer, plus a cookie, and then
 |> more, so that it takes seconds before i get the result.
 |
 |If you run it with `lynx -dump [-nolist] ...` -- the delays are avoided.
 |The output may not be most pleasing, but could be piped through `less`,
 |`sed` or other scripts to clean it up, stuff like that.
 |
 |This isn't helpful if you actually tend to follow further links offered
 |by that page; but if you just want static output, it's fine.

Thanks, yes, seems so.  (Needs to be paged really given the often
lengthy output.)
Thanks to Nelson Beebe i discovered translate-shell, and will
henceforth use that instead, it is a specialized thing which is
pretty cool.

 |>Bela<
 |
 |PS: writing this without actually testing the consequences -- you've got
 |most of this function wrapped in `( ... )`, putting it in a subshell;
 |which allows you to then `exit 1` without actually causing your
 |interactive shell to exit.  I think the same effect could be had by
 |removing the framing `( ... )`; changing it to `return 1`; and omitting
 |`exec`.

I had to look in the revision history, hmmm, it was a mindless
change in 2019 when we started looking for the lynx-redux package,
followed by yet another mindless change five weeks later to enwrap
that in a subshell, because of the exec, say.  What a mess.
Fixed.  Thank you.  Interestingly the only function around which
is so messy even though we have monsters like

                __r_d_b_x__() {
                        [ "${#}" -lt 2 ] && exit 64
                        if [ "${2}" = - ]; then
                                [ "${1}" != y ] && exit 64
                                __r__=- __d__=- __b__=-
                        else
                                __r__=$(realpath "${2}")
                                __d__=$(dirname "${__r__}")
                                __b__=$(basename "${__r__}")
                        fi

                        __x__=
                        if [ "${1}" = y ] && [ ${#} -gt 2 ]; then
                                if [ "${__r__}" != - ]; then
                                        exec 5<&0 <"${__r__}"
                                        __r__=-
                                fi
                                dd skip=${3} ibs=1 count=0 2>/dev/null
                                __x__='cat |'
                        fi

                        cd /
                }

                mp4playq() {
                        #set -m
                        (
                        __r_d_b_x__ y "${@}"
                        eval "${__x__} faad -q -w \"${__r__}\" |\
                                sox -q -t raw -r 44100 -c 2 -b 16 -e 
signed-integer - -t alsa"
                        ) &
                }

                xa() {
                        if [ -z "${__xa}" ]; then
                                __xa=n
                                command -v s-nail >/dev/null 2>&1 &&
                                        [ "$(</dev/null s-nail -#:/ -X 'echo 
$((1+1));x')" = 2 ] && __xa=y
                        fi
                        if [ ${__xa} = y ]; then
                                </dev/null s-nail -#:/ -X '
                                        define xarith {
                                                \local se e r
                                                #\if true
                                                        \eval ignerr local pp : 
\$((r=("${@}")))
                                                        \local se e=${?}
                                                        \if ${e} -eq 0; \vexpr 
= ${r}; \en
                                                #\el
                                                        #\eval ignerr local pp 
local se r=\"\$(("${@}"))\"
                                                        #\local se e=${?}
                                                        #\if ${e} -ne -1; 
\vexpr = ${r}; \en
                                                #\en
                                                \xit ${e}
                                        }
                                        call xarith '"${*}"'
                                '
                        else
                                perl -e '$i='${@+"${@}"}';' \
                                        -e 'printf "%08b %08b %08b %08b %08b 
%08b %08b %08b\n",
                                                ($i & 0xFF00000000000000) >> 56,
                                                ($i & 0x00FF000000000000) >> 48,
                                                ($i & 0x0000FF0000000000) >> 40,
                                                ($i & 0x000000FF00000000) >> 32,
                                                ($i & 0x00000000FF000000) >> 24,
                                                ($i & 0x0000000000FF0000) >> 16,
                                                ($i & 0x000000000000FF00) >>  8,
                                                ($i & 0x00000000000000FF) >>  
0;'\
                                        -e 'printf "0x%08X | 0%o | %d\n", $i, 
$i, $i'
                        fi
                }

and such, what a mess.

 --End of <202408281939.aa07673@deepthought.armory.com>

mumble

--steffen
|
|Der Kragenbaer,                The moon bear,
|der holt sich munter           he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]