Annotation of embedaddon/quagga/tests/test-buffer.c, revision 1.1.1.1
1.1 misho 1: #include <zebra.h>
2: #include <memory.h>
3: #include <buffer.h>
4:
5: struct thread_master *master;
6:
7: int
8: main(int argc, char **argv)
9: {
10: struct buffer *b1, *b2;
11: int n;
12: char junk[3];
13: char c = 'a';
14:
15: memory_init();
16:
17: if ((argc != 2) || (sscanf(argv[1], "%d%1s", &n, junk) != 1))
18: {
19: fprintf(stderr, "Usage: %s <number of chars to simulate>\n", *argv);
20: return 1;
21: }
22:
23: b1 = buffer_new(0);
24: b2 = buffer_new(1024);
25:
26: while (n-- > 0)
27: {
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);
34: }
35: buffer_free(b1);
36: buffer_free(b2);
37: return 0;
38: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>