1 ## Copyright (C) 2006-2012 Daniel Sebald
3 ## This file is part of Octave.
5 ## Octave is free software; you can redistribute it and/or modify it
6 ## under the terms of the GNU General Public License as published by
7 ## the Free Software Foundation; either version 3 of the License, or (at
8 ## your option) any later version.
10 ## Octave is distributed in the hope that it will be useful, but
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 ## General Public License for more details.
15 ## You should have received a copy of the GNU General Public License
16 ## along with Octave; see the file COPYING. If not, see
17 ## <http://www.gnu.org/licenses/>.
20 ## @deftypefn {Function File} {@var{version} =} __gnuplot_version__ ()
21 ## Undocumented internal function.
24 ## Return the version of gnuplot we are using. Note that we do not
25 ## attempt to handle the case of the user switching to different
26 ## versions of gnuplot during the same session.
28 function version = __gnuplot_version__ ()
30 persistent __version__ = "";
32 if (isempty (__version__))
33 [status, output] = system (sprintf ("\"%s\" --version", gnuplot_binary ()));
35 ## This message ends in a newline so that the traceback messages
36 ## are skipped and people might actually see the message, read it,
37 ## comprehend it, actually take the advice it gives, and stop
38 ## asking us why plotting fails when gnuplot is not found.
39 error ("you must have gnuplot installed to display graphics; if you have gnuplot installed in a non-standard location, see the 'gnuplot_binary' function\n");
41 output = strrep (output, "gnuplot", "");
42 output = strrep (output, "patchlevel", ".");
43 output = strrep (output, "\n", "");
44 output = strrep (output, "\r", "");
45 __version__ = strrep (output, " ", "");
48 version = __version__;