[zebra:linux] clean up blocking setting of netlink sockets
[jleu-quagga.git] / tests / test-buffer.c
blobb310776f86cc1fb667a3a89e5ebbd54d7d8e49f9
1 #include <zebra.h>
2 #include <memory.h>
3 #include <buffer.h>
5 struct thread_master *master;
7 int
8 main(int argc, char **argv)
10 struct buffer *b1, *b2;
11 int n;
12 char junk[3];
13 char c = 'a';
15 memory_init();
17 if ((argc != 2) || (sscanf(argv[1], "%d%1s", &n, junk) != 1))
19 fprintf(stderr, "Usage: %s <number of chars to simulate>\n", *argv);
20 return 1;
23 b1 = buffer_new(0);
24 b2 = buffer_new(1024);
26 while (n-- > 0)
28 buffer_put(b1, &c, 1);
29 buffer_put(b2, &c, 1);
30 if (c++ == 'z')
31 c = 'a';
32 buffer_reset(b1);
33 buffer_reset(b2);
35 buffer_free(b1);
36 buffer_free(b2);
37 return 0;