paul | 4dcadf7 | 2005-04-13 03:31:35 +0000 | [diff] [blame] | 1 | #include <zebra.h> |
| 2 | #include <buffer.h> |
| 3 | |
| 4 | struct thread_master *master; |
| 5 | |
| 6 | int |
| 7 | main(int argc, char **argv) |
| 8 | { |
| 9 | struct buffer *b1, *b2; |
| 10 | int n; |
| 11 | char junk[3]; |
| 12 | char c = 'a'; |
| 13 | |
| 14 | if ((argc != 2) || (sscanf(argv[1], "%d%1s", &n, junk) != 1)) |
| 15 | { |
| 16 | fprintf(stderr, "Usage: %s <number of chars to simulate>\n", *argv); |
| 17 | return 1; |
| 18 | } |
| 19 | |
| 20 | b1 = buffer_new(0); |
| 21 | b2 = buffer_new(1024); |
| 22 | |
| 23 | while (n-- > 0) |
| 24 | { |
| 25 | buffer_put(b1, &c, 1); |
| 26 | buffer_put(b2, &c, 1); |
| 27 | if (c++ == 'z') |
| 28 | c = 'a'; |
| 29 | buffer_reset(b1); |
| 30 | buffer_reset(b2); |
| 31 | } |
| 32 | buffer_free(b1); |
| 33 | buffer_free(b2); |
| 34 | return 0; |
| 35 | } |