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 | |
9 | #include <stdio.h> | |
95983a02 | 10 | #include "signal-helper.h" |
5400d18f PP |
11 | |
12 | #define TRACEPOINT_DEFINE | |
13 | #include "tp.h" | |
14 | ||
15 | int main(int argc, char **argv) | |
16 | { | |
be558f88 | 17 | int count = 0, i = 0, arg_i = 0; |
5400d18f | 18 | |
95983a02 JG |
19 | if (set_signal_handler()) { |
20 | return 1; | |
21 | } | |
22 | ||
5400d18f PP |
23 | if (argc <= 3) { |
24 | fprintf(stderr, "Usage: %s COUNT STRING [STRING]...\n", | |
25 | argv[0]); | |
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 | } |