6d90bfc66524c49cf961e7e624538d0e53905cbc
[lttng-tools.git] / tests / utils / testapp / gen-ust-nevents-str / gen-ust-nevents-str.c
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>
20
21 #define TRACEPOINT_DEFINE
22 #include "tp.h"
23
24 int main(int argc, char **argv)
25 {
26 int count;
27 int i;
28 int arg_i;
29
30 if (argc <= 3) {
31 fprintf(stderr, "Usage: %s COUNT STRING [STRING]...\n",
32 argv[0]);
33 return 1;
34 }
35
36 if (argc >= 2) {
37 count = atoi(argv[1]);
38 }
39
40 if (count < 0) {
41 return 0;
42 }
43
44 for (i = 0, arg_i = 2; i < count; i++) {
45 tracepoint(tp, the_string, i, arg_i, argv[arg_i]);
46
47 arg_i++;
48 if (arg_i == argc) {
49 arg_i = 2;
50 }
51 }
52
53 return 0;
54 }
This page took 0.031031 seconds and 4 git commands to generate.