+static int scan_ch_marker(const char *channel_marker, char **channel,
+ char **marker)
+{
+ int result;
+
+ *channel = NULL;
+ *marker = NULL;
+
+ result = sscanf(channel_marker, "%a[^/]/%as", channel, marker);
+ if (result != 2) {
+ if (errno) {
+ PERROR("Failed to read channel and marker names");
+ } else {
+ ERR("Failed to parse marker and channel names");
+ }
+ if (*channel) {
+ free(*channel);
+ }
+ if (*marker) {
+ free(*marker);
+ }
+ return -1;
+ } else {
+ return 0;
+ }
+}
+
+static int scan_ch_and_num(const char *ch_num, char **channel, unsigned int *num)
+{
+ int result;
+
+ *channel = NULL;
+
+ result = sscanf(ch_num, "%a[^/]/%u", channel, num);
+ if (result != 2) {
+ if (errno) {
+ PERROR("Failed to parse channel and number");
+ } else {
+ ERR("Failed to parse channel and number");
+ }
+ if (*channel) {
+ free(*channel);
+ }
+ return -1;
+ }
+}
+