Revision 7211be1c client/client.c

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
}

Also available in: Unified diff