poke-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] poke: use termios functions only if available


From: Jose E. Marchesi
Subject: Re: [PATCH] poke: use termios functions only if available
Date: Fri, 16 Feb 2024 08:59:25 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

Hi Hannes.
Does the pager work in Windows after the patch?

> 2024-02-15  Hannes Domani  <ssbssa@yahoo.de>
>
>       * poke/pk-term.c (pk_puts_paged): use termios functions only if
>       available.
> ---
>  poke/pk-term.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/poke/pk-term.c b/poke/pk-term.c
> index 1feb1ec2..18e0fc3c 100644
> --- a/poke/pk-term.c
> +++ b/poke/pk-term.c
> @@ -409,14 +409,17 @@ pk_puts_paged (const char *lines)
>  
>      if (nlines >= screen_lines)
>        {
> +#ifdef HAVE_TERMIOS_H
>          struct termios old_termios;
>          struct termios new_termios;
> +#endif
>  
>          styled_ostream_begin_use_class (pk_ostream, "pager-more");
>          ostream_write_str (pk_ostream, "--More--");
>          styled_ostream_end_use_class (pk_ostream, "pager-more");
>          ostream_flush (pk_ostream, FLUSH_THIS_STREAM);
>  
> +#ifdef HAVE_TERMIOS_H
>          /* Set stdin in non-buffered mode.  */
>          tcgetattr (0, &old_termios);
>          memcpy (&new_termios, &old_termios, sizeof (struct termios));
> @@ -424,6 +427,7 @@ pk_puts_paged (const char *lines)
>          new_termios.c_cc[VTIME] = 0;
>          new_termios.c_cc[VMIN] = 1;
>          tcsetattr (0, TCSANOW, &new_termios);
> +#endif
>  
>          /* Wait for a key and process it.  */
>          while (1)
> @@ -450,8 +454,10 @@ pk_puts_paged (const char *lines)
>              fprintf (stderr, "\007");
>            }
>  
> +#ifdef HAVE_TERMIOS_H
>          /* Restore stdin to buffered-mode.  */
>          tcsetattr (0, TCSANOW, &old_termios);
> +#endif
>  
>          if (erase_line_str)
>            {



reply via email to

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