diff --git a/src/probes/telem_record_gen.c b/src/probes/telem_record_gen.c index 172a73e..0b16e84 100644 --- a/src/probes/telem_record_gen.c +++ b/src/probes/telem_record_gen.c @@ -56,6 +56,20 @@ static GOptionEntry options[] = { { NULL } }; +const unsigned int count_chars(const char *check, const char character) +{ + unsigned int count = 0U; + if (check == NULL) { + return count; + } + for (; *check != '\0'; ++check) { + if (*check == character) { + ++count; + } + } + return count; +} + static void free_glib_strings(void) { if (config_file) { @@ -122,6 +136,12 @@ int validate_opts(void) return ret; } + if (count_chars(opt_class, '/') != 2) { + fprintf(stderr, "Error: Classification needs to be in " + "most/to/least specific format, 2 \'/\' required.\n"); + return ret; + } + /* Severity */ if ((severity) < 1 || (severity > 4)) { fprintf(stderr, "Error: Valid range for severity is 1-4\n");