diff scripts/plot/private/__gnuplot_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 2ff75e38c299
children 5d3a684236b0 d174210ce1ec
line wrap: on
line diff
--- a/scripts/plot/private/__gnuplot_print__.m
+++ b/scripts/plot/private/__gnuplot_print__.m
@@ -69,11 +69,14 @@
     endif
   case {"epslatex", "pslatex", "pstex", "epslatexstandalone"}
     dot = find (opts.name == ".", 1, "last");
+    n = find (opts.devopt == "l", 1);
+    suffix = opts.devopt(1:n-1);
     if (! isempty (dot))
-      if (any (strcmpi (opts.name(dot:end), {".eps", ".ps", ".pdf", ".tex", "."})))
+      if (any (strcmpi (opts.name(dot:end), {strcat(".", suffix), ".tex", "."})))
         name = opts.name(1:dot-1);
       else
-        error ("print:invalid-suffix", "unrecognized file name suffix `%s' for %s output type",
+        error ("print:invalid-suffix", 
+               "invalid suffix `%s' for device `%s'.",
                opts.name(dot:end), lower (opts.devopt));
       endif
     endif