tuklib_integer.h: Fix a recent copypaste error in Clang detection.
[xz/debian.git] / debug / repeat.c
bloba00bde2cd381f92d208da29aeb350b46ed64d3c4
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 /// \file repeat.c
4 /// \brief Repeats given string given times
5 ///
6 /// This program can be useful when debugging run-length encoder in
7 /// the Subblock filter, especially the condition when repeat count
8 /// doesn't fit into 28-bit integer.
9 //
10 // Author: Lasse Collin
12 // This file has been put into the public domain.
13 // You can do whatever you want with this file.
15 ///////////////////////////////////////////////////////////////////////////////
17 #include "sysdefs.h"
18 #include <stdio.h>
21 int
22 main(int argc, char **argv)
24 if (argc != 3) {
25 fprintf(stderr, "Usage: %s COUNT STRING\n", argv[0]);
26 exit(1);
29 unsigned long long count = strtoull(argv[1], NULL, 10);
30 const size_t size = strlen(argv[2]);
32 while (count-- != 0)
33 fwrite(argv[2], 1, size, stdout);
35 return !!(ferror(stdout) || fclose(stdout));