paul | 4dcadf7 | 2005-04-13 03:31:35 +0000 | [diff] [blame] | 1 | #include <zebra.h> |
paul | dff4f52 | 2005-09-06 23:08:01 +0000 | [diff] [blame] | 2 | #include <memory.h> |
paul | 4dcadf7 | 2005-04-13 03:31:35 +0000 | [diff] [blame] | 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 | |
paul | dff4f52 | 2005-09-06 23:08:01 +0000 | [diff] [blame] | 15 | memory_init(); |
| 16 | |
paul | 4dcadf7 | 2005-04-13 03:31:35 +0000 | [diff] [blame] | 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 | } |