]> git.proxmox.com Git - mirror_frr.git/blame - tests/lib/test_buffer.c
Merge pull request #12798 from donaldsharp/rib_match_multicast
[mirror_frr.git] / tests / lib / test_buffer.c
CommitLineData
acddc0ed 1// SPDX-License-Identifier: GPL-2.0-or-later
d62a17ae 2/*
46f4a4d2 3 * Copyright (C) 2004 Paul Jakma
46f4a4d2
PJ
4 */
5
4dcadf7e 6#include <zebra.h>
dff4f527 7#include <memory.h>
1c0d8808 8#include <lib_vty.h>
4dcadf7e 9#include <buffer.h>
10
11struct thread_master *master;
12
d62a17ae 13int main(int argc, char **argv)
4dcadf7e 14{
d62a17ae 15 struct buffer *b1, *b2;
16 int n;
17 char junk[3];
18 char c = 'a';
4dcadf7e 19
1c0d8808 20 lib_cmd_init();
4dcadf7e 21
d62a17ae 22 if ((argc != 2) || (sscanf(argv[1], "%d%1s", &n, junk) != 1)) {
23 fprintf(stderr, "Usage: %s <number of chars to simulate>\n",
24 *argv);
25 return 1;
26 }
27
28 b1 = buffer_new(0);
29 b2 = buffer_new(1024);
30
31 while (n-- > 0) {
32 buffer_put(b1, &c, 1);
33 buffer_put(b2, &c, 1);
34 if (c++ == 'z')
35 c = 'a';
36 buffer_reset(b1);
37 buffer_reset(b2);
38 }
39 buffer_free(b1);
40 buffer_free(b2);
41 return 0;
4dcadf7e 42}