Rizin
unix-like reverse engineering framework and cli tools
repeat.c File Reference

Repeats given string given times. More...

#include "sysdefs.h"
#include <stdio.h>

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Repeats given string given times.

This program can be useful when debugging run-length encoder in the Subblock filter, especially the condition when repeat count doesn't fit into 28-bit integer.

Definition in file repeat.c.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 22 of file repeat.c.

23 {
24  if (argc != 3) {
25  fprintf(stderr, "Usage: %s COUNT STRING\n", argv[0]);
26  exit(1);
27  }
28 
29  unsigned long long count = strtoull(argv[1], NULL, 10);
30  const size_t size = strlen(argv[2]);
31 
32  while (count-- != 0)
33  fwrite(argv[2], 1, size, stdout);
34 
35  return !!(ferror(stdout) || fclose(stdout));
36 }
#define NULL
Definition: cris-opc.c:27
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void count
Definition: sflib.h:98
voidpf void uLong size
Definition: ioapi.h:138
static static fork const void static count static fd const char const char static newpath char char argv
Definition: sflib.h:40

References argv, count, test-lz4-list::exit, and NULL.