summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorMartin Mares <mj@ucw.cz>2000-01-20 14:13:30 +0100
committerMartin Mares <mj@ucw.cz>2000-01-20 14:13:30 +0100
commit7211be1cffdee84fd15e8b6b2a07a644948f1455 (patch)
tree1a5a56054e5212cff23442bc39eddd4f916b9640 /client
parent9fac310d1a4e46f4bcc70177e59cbf93763ef479 (diff)
downloadbird-7211be1cffdee84fd15e8b6b2a07a644948f1455.tar
bird-7211be1cffdee84fd15e8b6b2a07a644948f1455.zip
Configure, link and use the readline library.
Diffstat (limited to 'client')
-rw-r--r--client/client.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/client/client.c b/client/client.c
index e9bc827..260e043 100644
--- a/client/client.c
+++ b/client/client.c
@@ -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);
+ }
}