tests: compile some tools/tests as C++
[lttng-tools.git] / tests / utils / testapp / gen-ust-nevents-str / gen-ust-nevents-str.cpp
diff --git a/tests/utils/testapp/gen-ust-nevents-str/gen-ust-nevents-str.cpp b/tests/utils/testapp/gen-ust-nevents-str/gen-ust-nevents-str.cpp
new file mode 100644 (file)
index 0000000..d68501b
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2017 Philippe Proulx <pproulx@efficios.com>
+ *
+ * SPDX-License-Identifier: LGPL-2.1-only
+ *
+ */
+
+#define _LGPL_SOURCE
+#include <stdio.h>
+#include "signal-helper.h"
+
+#define TRACEPOINT_DEFINE
+#include "tp.h"
+
+int main(int argc, char **argv)
+{
+       int count = 0, i = 0, arg_i = 0;
+
+       if (set_signal_handler()) {
+               return 1;
+       }
+
+       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;
+               }
+               if (should_quit) {
+                       break;
+               }
+       }
+
+       return 0;
+}
This page took 0.028361 seconds and 4 git commands to generate.