aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>1998-06-09 16:46:32 +0000
committerWerner Koch <[email protected]>1998-06-09 16:46:32 +0000
commitc279427f8d0282f5b549b2fcfd35b0ba552c6cdc (patch)
treec54758b1777bde9200095cbfa68b9f288b5b6bd9
parentSicherung (diff)
downloadgnupg-c279427f8d0282f5b549b2fcfd35b0ba552c6cdc.tar.gz
gnupg-c279427f8d0282f5b549b2fcfd35b0ba552c6cdc.zip
.
-rw-r--r--tools/mk-tdata.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/tools/mk-tdata.c b/tools/mk-tdata.c
new file mode 100644
index 000000000..70358dc47
--- /dev/null
+++ b/tools/mk-tdata.c
@@ -0,0 +1,37 @@
+/* mk-tdata.c
+ *
+ * Create some simple random testdata
+ *
+ */
+
+#include <config.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+
+#ifndef RAND_MAX /* for SunOS */
+ #define RAND_MAX 32767
+#endif
+
+int
+main(int argc, char **argv)
+{
+ int i, c;
+ int limit =0;
+
+ limit = argc > 1 ? atoi(argv[1]) : 0;
+
+ srand(getpid());
+
+ for(i=0; !limit || i < limit; i++ ) {
+ #ifdef HAVE_RAND
+ c = ((unsigned)(1 + (int) (256.0*rand()/(RAND_MAX+1.0)))-1);
+ #else
+ c = ((unsigned)(1 + (int) (256.0*random()/(RAND_MAX+1.0)))-1);
+ #endif
+ putchar(c);
+ }
+ return 0;
+}
+