[PATCH RFC nftables 0/4] Add Linenoise support to the CLI.

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

 



Sebastian Priebe [0] requested Linenoise support for the CLI as an
alternative to Readline, so I thought I'd have a go at providing it.
Linenoise is a minimal, zero-config, BSD licensed, Readline replacement
used in Redis, MongoDB, and Android [1].

 0 - https://lore.kernel.org/netfilter-devel/4df20614cd10434b9f91080d0862dd0c@xxxxxx.group/
 1 - https://github.com/antirez/linenoise/

The upstream repo doesn't contain the infrastructure for building or
installing libraries.  I've taken a look at how Redis and MongoDB handle
this, and they both include the upstream sources in their trees (MongoDB
actually uses a C++ fork, Linenoise NG [2]), so I've done the same.

 2 - https://github.com/arangodb/linenoise-ng

Initially, I added the Linenoise header to include/ and the source to
src/, but the compiler warning flags used by upstream differ from those
used by nftables, which meant that the compiler emitted warnings when
compiling the Linenoise source and I had to edit it to fix them.  Since
they were benign and editing the source would make it more complicated
to update from upstream in the future, I have, instead, chosen to put
everything in a separate linenoise/ directory with its own Makefile.am
and the same warning flags as upstream.

By default, the CLI continues to be build using Readline, but passing
`with-cli=linenoise` instead causes Linenoise to be used instead.

The first two patches do a bit of tidying; the third patch adds the
Linenoise sources; the last adds Linenoise support to the CLI.

Jeremy Sowden (4):
  configure: remove unused AC_SUBST macros.
  cli: remove unused declaration.
  cli: add upstream linenoise source.
  cli: add linenoise CLI implementation.

 Makefile.am                 |    7 +-
 configure.ac                |   20 +-
 include/cli.h               |    3 +-
 linenoise/.gitignore        |    6 +
 linenoise/LICENSE           |   25 +
 linenoise/Makefile.am       |   13 +
 linenoise/Makefile.upstream |    7 +
 linenoise/README.markdown   |  229 +++++++
 linenoise/example.c         |   74 +++
 linenoise/linenoise.c       | 1201 +++++++++++++++++++++++++++++++++++
 linenoise/linenoise.h       |   73 +++
 src/Makefile.am             |    6 +
 src/cli.c                   |   64 +-
 13 files changed, 1710 insertions(+), 18 deletions(-)
 create mode 100644 linenoise/.gitignore
 create mode 100644 linenoise/LICENSE
 create mode 100644 linenoise/Makefile.am
 create mode 100644 linenoise/Makefile.upstream
 create mode 100644 linenoise/README.markdown
 create mode 100644 linenoise/example.c
 create mode 100644 linenoise/linenoise.c
 create mode 100644 linenoise/linenoise.h

-- 
2.23.0




[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux