- if (cairo_surface_write_to_png(im->surface, im->graphfile) !=
- CAIRO_STATUS_SUCCESS) {
+ {
+ cairo_status_t status;
+
+ if (strcmp(im->graphfile, "-") == 0) {
+ status =
+ cairo_surface_write_to_png_stream(im->surface,
+ &cairo_write_func_file,
+ (void *) stdout);
+ } else {
+ status = cairo_surface_write_to_png(im->surface, im->graphfile);
+ }
+
+ if (status != CAIRO_STATUS_SUCCESS) {