+/* defines a callback function that generates
+ an error if an option occurs twice */
+#define CHECK_ONCE(option) \
+static gboolean check_ ## option \
+ (const gchar *option_name, const gchar *value, \
+ gpointer data, GError **error) \
+{ \
+ (void)data; \
+ \
+ static gboolean seen = FALSE; \
+ if (seen) { \
+ g_set_error(error, G_OPTION_ERROR, G_OPTION_ERROR_FAILED, \
+ "superfluous option \"%s\"", option_name); \
+ return FALSE; \
+ } \
+ \
+ option = g_strdup(value); \
+ seen = TRUE; \
+ return TRUE; \
+}
+
+CHECK_ONCE(opt_drv)
+CHECK_ONCE(opt_config)
+CHECK_ONCE(opt_input_format)
+CHECK_ONCE(opt_output_format)
+CHECK_ONCE(opt_channels)
+CHECK_ONCE(opt_channel_group)
+CHECK_ONCE(opt_triggers)
+#ifdef HAVE_SRD
+CHECK_ONCE(opt_pds)
+CHECK_ONCE(opt_pd_stack)
+CHECK_ONCE(opt_pd_annotations)
+CHECK_ONCE(opt_pd_meta)
+CHECK_ONCE(opt_pd_binary)
+#endif
+CHECK_ONCE(opt_time)
+CHECK_ONCE(opt_samples)
+CHECK_ONCE(opt_frames)
+CHECK_ONCE(opt_get)
+
+#undef CHECK_STR_ONCE
+
+static gchar **input_file_array = NULL;
+static gchar **output_file_array = NULL;
+