diff scripts/plot/private/__fltk_print__.m @ 14174:447b57ebc27b stable

Validate suffix when printing to {eps,ps,pdf}latex devices. * __fltk_print__.m: gl2ps is not agnostic to file suffix. * __gnuplot_print__.m: gnuplot is not agnostic to file suffix.
author Ben Abbott <bpabbott@mac.com>
date Sun, 08 Jan 2012 19:23:55 -0500
parents 72c96de7a403
children 6b2448555bbd d174210ce1ec
line wrap: on
line diff
--- a/scripts/plot/private/__fltk_print__.m
+++ b/scripts/plot/private/__fltk_print__.m
@@ -52,15 +52,17 @@
     dot = find (opts.name == ".", 1, "last");
     if ((! isempty (dot))
         && any (strcmpi (opts.name(dot:end), ...
-                {".eps", ".ps", ".pdf", ".tex", "."})))
+                {strcat(".", suffix), ".tex", "."})))
       name = opts.name(1:dot-1);
       if (dot < numel (opts.name)
           && any (strcmpi (opts.name(dot+1:end), {"eps", "ps", "pdf"})))
         ## If user provides eps/ps/pdf suffix, use it.
         suffix = opts.name(dot+1:end);
       endif
-    elseif (dot == numel (opts.name))
-      name = opts.name;
+    else
+      error ("print:invalid-suffix", 
+             "invalid suffix `%s' for device `%s'.",
+             opts.name(dot:end), lower (opts.devopt));
     endif
     gl2ps_device = {sprintf("%snotxt", lower (suffix))};
     gl2ps_device{2} = "tex";