]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Configure, link and use the readline library.
authorMartin Mares <mj@ucw.cz>
Thu, 20 Jan 2000 13:13:30 +0000 (13:13 +0000)
committerMartin Mares <mj@ucw.cz>
Thu, 20 Jan 2000 13:13:30 +0000 (13:13 +0000)
client/client.c
configure.in
tools/Makefile.in
tools/Rules.in

index e9bc827d98698604fa970c8c801f0406a44369ed..260e043920c58ab7e3a5c006b3f50f1f4f2799e1 100644 (file)
@@ -10,6 +10,8 @@
 #include <string.h>
 #include <stdlib.h>
 #include <unistd.h>
+#include <readline/readline.h>
+#include <readline/history.h>
 
 #include "nest/bird.h"
 #include "lib/resource.h"
@@ -39,6 +41,21 @@ parse_args(int argc, char **argv)
     usage();
 }
 
+static char *
+get_command(void)
+{
+  static char *cmd_buffer;
+
+  if (cmd_buffer)
+    free(cmd_buffer);
+  cmd_buffer = readline("bird> ");
+  if (!cmd_buffer)
+    exit(0);
+  if (cmd_buffer[0])
+    add_history(cmd_buffer);
+  return cmd_buffer;
+}
+
 int
 main(int argc, char **argv)
 {
@@ -49,5 +66,9 @@ main(int argc, char **argv)
 
   parse_args(argc, argv);
 
-  bug("Not implemented yet!");
+  for(;;)
+    {
+      char *c = get_command();
+      puts(c);
+    }
 }
index 1e1fdba726c8c1fc9702bb96352a8e806de97d37..579c6bd542f80b5b736566a94c6eb4fe30de5e91 100644 (file)
@@ -134,12 +134,19 @@ else
        AC_DEFINE_UNQUOTED(PATH_CONTROL_SOCKET_DIR, "$localstatedir")
 fi
 
+CLIENT=
+CLIENT_LIBS=
 if test "$enable_client" = yes ; then
        CLIENT=client
-else
-       CLIENT=
+       AC_CHECK_LIB(history, add_history, CLIENT_LIBS="-lhistory")
+       AC_CHECK_LIB(ncurses, tgetent, USE_TERMCAP_LIB=-lncurses,
+               AC_CHECK_LIB(curses, tgetent, USE_TERMCAP_LIB=-lcurses,
+                       AC_CHECK_LIB(termcap, tgetent, USE_TERMCAP_LIB=-ltermcap)))
+       AC_CHECK_LIB(readline, readline, CLIENT_LIBS="-lreadline $CLIENT_LIBS $USE_TERMCAP_LIB",
+               AC_MSG_ERROR([[The client requires GNU readline library. Either install the library or use --disable-client to compile without the client.]]), $USE_TERMCAP_LIB)
 fi
 AC_SUBST(CLIENT)
+AC_SUBST(CLIENT_LIBS)
 
 mkdir -p $objdir/sysdep
 AC_CONFIG_HEADER($objdir/sysdep/autoconf.h:sysdep/autoconf.h.in)
index 56d65140056476daa97715c4e0b28b352e1831ab..1dcb9bce9aa94d85933ced9340bd792f480bda5d 100644 (file)
@@ -21,7 +21,7 @@ $(exedir)/bird: $(addsuffix /all.o, $(static-dirs)) conf/all.o lib/birdlib.a
        $(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
 
 $(exedir)/birdc: client/all.o lib/birdlib.a
-       $(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
+       $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) $(CLIENT_LIBS)
 
 .dir-stamp:
        mkdir -p $(static-dirs) $(client-dirs)
index fc3d2b1a70b3ff7ebae2437dd034620327e19085..48201824625c6e9c5c6d6e0dde5595bc866ad794 100644 (file)
@@ -20,6 +20,7 @@ CPPFLAGS=-I$(root-rel) -I$(srcdir) @CPPFLAGS@
 CFLAGS=$(CPPFLAGS) @CFLAGS@
 LDFLAGS=
 LIBS=@LIBS@
+CLIENT_LIBS=@CLIENT_LIBS@
 CC=@CC@
 M4=@M4@
 BISON=@BISON@