Commit | Line | Data |
---|---|---|
5400d18f | 1 | /* |
9d16b343 | 2 | * Copyright (C) 2017 Philippe Proulx <pproulx@efficios.com> |
5400d18f | 3 | * |
9d16b343 | 4 | * SPDX-License-Identifier: LGPL-2.1-only |
5400d18f | 5 | * |
5400d18f PP |
6 | */ |
7 | ||
8 | #define _LGPL_SOURCE | |
c9e313bc | 9 | #include "signal-helper.hpp" |
5400d18f | 10 | |
28ab034a JG |
11 | #include <stdio.h> |
12 | ||
5400d18f PP |
13 | #define TRACEPOINT_DEFINE |
14 | #include "tp.h" | |
15 | ||
16 | int main(int argc, char **argv) | |
17 | { | |
be558f88 | 18 | int count = 0, i = 0, arg_i = 0; |
5400d18f | 19 | |
95983a02 JG |
20 | if (set_signal_handler()) { |
21 | return 1; | |
22 | } | |
23 | ||
5400d18f | 24 | if (argc <= 3) { |
28ab034a | 25 | fprintf(stderr, "Usage: %s COUNT STRING [STRING]...\n", argv[0]); |
5400d18f PP |
26 | return 1; |
27 | } | |
28 | ||
29 | if (argc >= 2) { | |
30 | count = atoi(argv[1]); | |
31 | } | |
32 | ||
33 | if (count < 0) { | |
34 | return 0; | |
35 | } | |
36 | ||
37 | for (i = 0, arg_i = 2; i < count; i++) { | |
38 | tracepoint(tp, the_string, i, arg_i, argv[arg_i]); | |
39 | ||
40 | arg_i++; | |
41 | if (arg_i == argc) { | |
42 | arg_i = 2; | |
43 | } | |
95983a02 JG |
44 | if (should_quit) { |
45 | break; | |
46 | } | |
5400d18f PP |
47 | } |
48 | ||
49 | return 0; | |
50 | } |