+static void
+configure_drivers (int width, int length)
+{
+ struct string_map options, tmp;
+ struct output_driver *driver;
+
+ string_map_init (&options);
+ string_map_insert (&options, "format", "txt");
+ string_map_insert (&options, "output-file", "-");
+ string_map_insert_nocopy (&options, xstrdup ("width"),
+ xasprintf ("%d", width));
+ string_map_insert_nocopy (&options, xstrdup ("length"),
+ xasprintf ("%d", length));
+ if (emphasis != NULL)
+ string_map_insert (&options, "emphasis", emphasis);
+ if (box != NULL)
+ string_map_insert (&options, "box", box);
+
+ /* Render to stdout. */
+ string_map_clone (&tmp, &options);
+ ascii_driver = driver = output_driver_create (&tmp);
+ if (driver == NULL)
+ exit (EXIT_FAILURE);
+ output_driver_register (driver);
+ string_map_destroy (&tmp);
+
+ if (draw_mode)
+ {
+ string_map_destroy (&options);
+ return;
+ }
+
+ /* Render to render.txt. */
+ string_map_replace (&options, "output-file", "render.txt");
+ driver = output_driver_create (&options);
+ if (driver == NULL)
+ exit (EXIT_FAILURE);
+ output_driver_register (driver);
+
+#ifdef HAVE_CAIRO
+ /* Render to render.pdf. */
+ string_map_insert (&options, "output-file", "render.pdf");
+ string_map_insert (&options, "top-margin", "0");
+ string_map_insert (&options, "bottom-margin", "0");
+ string_map_insert (&options, "left-margin", "0");
+ string_map_insert (&options, "right-margin", "0");
+ string_map_insert_nocopy (&options, xstrdup ("paper-size"),
+ xasprintf ("%dx%dpt", width * 5, length * 8));
+ driver = output_driver_create (&options);
+ if (driver == NULL)
+ exit (EXIT_FAILURE);
+ output_driver_register (driver);
+#endif
+
+ string_map_insert (&options, "output-file", "render.odt");
+ driver = output_driver_create (&options);
+ if (driver == NULL)
+ exit (EXIT_FAILURE);
+ output_driver_register (driver);
+
+ string_map_destroy (&options);
+}
+