X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=tests%2Futils%2Ftestapp%2Fgen-ust-nevents-str%2Fgen-ust-nevents-str.c;fp=tests%2Futils%2Ftestapp%2Fgen-ust-nevents-str%2Fgen-ust-nevents-str.c;h=6d90bfc66524c49cf961e7e624538d0e53905cbc;hp=0000000000000000000000000000000000000000;hb=5400d18f909dbcf6cb8c794cdd33d0c2213fda18;hpb=dbfea1ab9883e8ee7b4addc43f2f25cda5fe9e6d diff --git a/tests/utils/testapp/gen-ust-nevents-str/gen-ust-nevents-str.c b/tests/utils/testapp/gen-ust-nevents-str/gen-ust-nevents-str.c new file mode 100644 index 000000000..6d90bfc66 --- /dev/null +++ b/tests/utils/testapp/gen-ust-nevents-str/gen-ust-nevents-str.c @@ -0,0 +1,54 @@ +/* + * Copyright (C) - 2017 Philippe Proulx + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by the + * Free Software Foundation; version 2.1 of the License. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#define _LGPL_SOURCE +#include + +#define TRACEPOINT_DEFINE +#include "tp.h" + +int main(int argc, char **argv) +{ + int count; + int i; + int arg_i; + + if (argc <= 3) { + fprintf(stderr, "Usage: %s COUNT STRING [STRING]...\n", + argv[0]); + return 1; + } + + if (argc >= 2) { + count = atoi(argv[1]); + } + + if (count < 0) { + return 0; + } + + for (i = 0, arg_i = 2; i < count; i++) { + tracepoint(tp, the_string, i, arg_i, argv[arg_i]); + + arg_i++; + if (arg_i == argc) { + arg_i = 2; + } + } + + return 0; +}