]> arthur.barton.de Git - bup.git/blob - datagen.c
datagen.c: a quick program to generate a repeatable series of bytes.
[bup.git] / datagen.c
1 #include <unistd.h>
2 #include <stdio.h>
3 #include <stdlib.h>
4 #include <stdint.h>
5
6 int main(int argc, char **argv)
7 {
8     if (argc != 2)
9     {
10         fprintf(stderr, "usage: %s <kbytes>\n", argv[0]);
11         return 1;
12     }
13     
14     int kbytes = atoi(argv[1]);
15     uint32_t buf[1024/4];
16     int i;
17     
18     for (; kbytes > 0; kbytes--)
19     {
20         for (i = 0; i < sizeof(buf)/sizeof(buf[0]); i++)
21             buf[i] = random();
22         write(1, buf, sizeof(buf));
23         if (!(kbytes%1024))
24             fprintf(stderr, ".");
25     }
26     
27     return 0;
28 }