Revision 7211be1c

View differences:

client/client.c
10 10
#include <string.h>
11 11
#include <stdlib.h>
12 12
#include <unistd.h>
13
#include <readline/readline.h>
14
#include <readline/history.h>
13 15

  
14 16
#include "nest/bird.h"
15 17
#include "lib/resource.h"
......
39 41
    usage();
40 42
}
41 43

  
44
static char *
45
get_command(void)
46
{
47
  static char *cmd_buffer;
48

  
49
  if (cmd_buffer)
50
    free(cmd_buffer);
51
  cmd_buffer = readline("bird> ");
52
  if (!cmd_buffer)
53
    exit(0);
54
  if (cmd_buffer[0])
55
    add_history(cmd_buffer);
56
  return cmd_buffer;
57
}
58

  
42 59
int
43 60
main(int argc, char **argv)
44 61
{
......
49 66

  
50 67
  parse_args(argc, argv);
51 68

  
52
  bug("Not implemented yet!");
69
  for(;;)
70
    {
71
      char *c = get_command();
72
      puts(c);
73
    }
53 74
}
configure.in
134 134
	AC_DEFINE_UNQUOTED(PATH_CONTROL_SOCKET_DIR, "$localstatedir")
135 135
fi
136 136

  
137
CLIENT=
138
CLIENT_LIBS=
137 139
if test "$enable_client" = yes ; then
138 140
	CLIENT=client
139
else
140
	CLIENT=
141
	AC_CHECK_LIB(history, add_history, CLIENT_LIBS="-lhistory")
142
	AC_CHECK_LIB(ncurses, tgetent, USE_TERMCAP_LIB=-lncurses,
143
		AC_CHECK_LIB(curses, tgetent, USE_TERMCAP_LIB=-lcurses,
144
			AC_CHECK_LIB(termcap, tgetent, USE_TERMCAP_LIB=-ltermcap)))
145
	AC_CHECK_LIB(readline, readline, CLIENT_LIBS="-lreadline $CLIENT_LIBS $USE_TERMCAP_LIB",
146
		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)
141 147
fi
142 148
AC_SUBST(CLIENT)
149
AC_SUBST(CLIENT_LIBS)
143 150

  
144 151
mkdir -p $objdir/sysdep
145 152
AC_CONFIG_HEADER($objdir/sysdep/autoconf.h:sysdep/autoconf.h.in)
tools/Makefile.in
21 21
	$(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
22 22

  
23 23
$(exedir)/birdc: client/all.o lib/birdlib.a
24
	$(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
24
	$(CC) $(LDFLAGS) -o $@ $^ $(LIBS) $(CLIENT_LIBS)
25 25

  
26 26
.dir-stamp:
27 27
	mkdir -p $(static-dirs) $(client-dirs)
tools/Rules.in
20 20
CFLAGS=$(CPPFLAGS) @CFLAGS@
21 21
LDFLAGS=
22 22
LIBS=@LIBS@
23
CLIENT_LIBS=@CLIENT_LIBS@
23 24
CC=@CC@
24 25
M4=@M4@
25 26
BISON=@BISON@

Also available in: Unified diff