Commit | Line | Data |
---|---|---|
5400d18f PP |
1 | /* |
2 | * Copyright (C) - 2017 Philippe Proulx <pproulx@efficios.com> | |
3 | * | |
4 | * This library is free software; you can redistribute it and/or modify it | |
5 | * under the terms of the GNU Lesser General Public License as published by the | |
6 | * Free Software Foundation; version 2.1 of the License. | |
7 | * | |
8 | * This library is distributed in the hope that it will be useful, but WITHOUT | |
9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License | |
11 | * for more details. | |
12 | * | |
13 | * You should have received a copy of the GNU Lesser General Public License | |
14 | * along with this library; if not, write to the Free Software Foundation, | |
15 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
16 | */ | |
17 | ||
18 | #define _LGPL_SOURCE | |
19 | #include <stdio.h> | |
95983a02 | 20 | #include "signal-helper.h" |
5400d18f PP |
21 | |
22 | #define TRACEPOINT_DEFINE | |
23 | #include "tp.h" | |
24 | ||
25 | int main(int argc, char **argv) | |
26 | { | |
be558f88 | 27 | int count = 0, i = 0, arg_i = 0; |
5400d18f | 28 | |
95983a02 JG |
29 | if (set_signal_handler()) { |
30 | return 1; | |
31 | } | |
32 | ||
5400d18f PP |
33 | if (argc <= 3) { |
34 | fprintf(stderr, "Usage: %s COUNT STRING [STRING]...\n", | |
35 | argv[0]); | |
36 | return 1; | |
37 | } | |
38 | ||
39 | if (argc >= 2) { | |
40 | count = atoi(argv[1]); | |
41 | } | |
42 | ||
43 | if (count < 0) { | |
44 | return 0; | |
45 | } | |
46 | ||
47 | for (i = 0, arg_i = 2; i < count; i++) { | |
48 | tracepoint(tp, the_string, i, arg_i, argv[arg_i]); | |
49 | ||
50 | arg_i++; | |
51 | if (arg_i == argc) { | |
52 | arg_i = 2; | |
53 | } | |
95983a02 JG |
54 | if (should_quit) { |
55 | break; | |
56 | } | |
5400d18f PP |
57 | } |
58 | ||
59 | return 0; | |
60 | } |