+static void
+pandecode_dump_file_open(void)
+{
+ if (pandecode_dump_stream)
+ return;
+
+ const char *dump_file = debug_get_option("PANDECODE_DUMP_FILE", "pandecode.dump");
+
+ printf("pandecode: dump command stream to file %s\n", dump_file);
+ pandecode_dump_stream = fopen(dump_file, "w");
+
+ if (!pandecode_dump_stream)
+ fprintf(stderr,"pandecode: failed to open command stream log file %s\n",
+ dump_file);
+}
+
+static void
+pandecode_dump_file_close(void)
+{
+ if (pandecode_dump_stream) {
+ fclose(pandecode_dump_stream);
+ pandecode_dump_stream = NULL;
+ }
+}
+