On Fri, Jul 11, 2014 at 5:52 AM, Vitezslav Samel <vitezslav@samel.cz> wrote:
  See below.

On Fri, Jul 11, 2014 at 05:16:53AM -0300, Augusto Mecking Caringi wrote:
> ---
>  src/itrafmon.c |    9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/src/itrafmon.c b/src/itrafmon.c
> index f19eb61..75975f2 100644
> --- a/src/itrafmon.c
> +++ b/src/itrafmon.c
> @@ -535,11 +535,12 @@ static int checkrvnamed(void)
>       return 1;
>  }
>
> -static void ipmon_process_key(int ch, int curwin, struct tcptable *table, struct othptable *othptbl)
> +static void ipmon_process_key(int ch, struct tcptable *table, struct othptable *othptbl)
>  {
>       static int keymode = 0;
>       static WINDOW *sortwin;
>       static PANEL *sortpanel;
> +     static int curwin = 0;

This patch adds a bug when the ipmon() is run twice or more:

  1) run ipmon()
  2) change active window (this sets curwin to 1)
  3) exit ipmon()
  4) run ipmon() (in the same iptraf-ng instance)
  5) bug: now the curwin is still 1, but markactive(0, ...) just before
     the mainloop assumes the curwin is 0!

  You need to reset the curwin to 0 at every ipmon() innvocation!

  So: NAK to this patch!

  Was this patch supposed to fix something (according to Subject)?

Hi Vita,

    Now I see... Sorry for that.

    I was trying to solve a bug that I found...

    After the keypress handling was moved into a separate function, the switch of active window became broken.

    Best regards! 

--
Augusto Mecking Caringi