David,

Ncurses will never work for socket connections since it makes assumptions about 
having a tty device and only uses stdin/stdout. It also does not allow more 
than one ncurses instance at the same time; all its state is global, so it will 
never work for multiple CLI sessions.

The CLI code does track if the session is ANSI capable so you can emit your own 
sequences. If you have fancy things in mind, you’re probably generally better 
off writing an independent application that makes use of the API. (which is 
what I did for the – as yet unreleased – vpptop utility)

One key issue with the snippet below, if you built it in to a VPP CLI command, 
is it will block the main thread indefinitely waiting for that keypress. There 
are ways around that, but not the stdin/stdout/tty/session issue.

Chris

From: vpp-dev@lists.fd.io <vpp-dev@lists.fd.io> On Behalf Of 
david.leitch....@gmail.com
Sent: Wednesday, July 4, 2018 4:00
To: vpp-dev@lists.fd.io
Subject: [EXTERNAL] [vpp-dev] Using Ncurses library in VPP CLI

Hi,
Is it possible to use Ncurses library function on VPP CLI Command to have nice 
view,
i used  a basic sample but does not work, compile with -lncurses and use this 
commands :

  initscr();                     /* Start curses mode              */
 printw("Hello World !!!");     /* Print Hello World              */
 refresh();                     /* Print it on to the real screen */
 getch();                       /* Wait for user input            */
 endwin();                      /* End curses mode                */


-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.

View/Reply Online (#9778): https://lists.fd.io/g/vpp-dev/message/9778
Mute This Topic: https://lists.fd.io/mt/23038782/21656
Group Owner: vpp-dev+ow...@lists.fd.io
Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to